first commit
This commit is contained in:
24
libraries/BigCrystal/LICENSE
Executable file
24
libraries/BigCrystal/LICENSE
Executable file
@@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
43
libraries/BigCrystal/README.md
Executable file
43
libraries/BigCrystal/README.md
Executable file
@@ -0,0 +1,43 @@
|
||||
BigCrystal
|
||||
==========
|
||||
|
||||
Arduino Library for displaying double height characters on an LCD display. This library is
|
||||
compatible with the standard LiquidCrystal library dictributed with the Arduino IDE and
|
||||
also with the [New LiquidCrystal](https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home)
|
||||
which is a drop in replacement for the standard library.
|
||||
|
||||
The New LiquidCrystal library supports connections to LCDs using
|
||||
* 4 bit parallel interface
|
||||
* 8 bit parallel interface
|
||||
* I<sup>2</sup>C expansion boards
|
||||
* Shift registers
|
||||
|
||||
Note that this version of the library is incompatible with version 1 to implement compatibility
|
||||
with the New LiquidCrystal library.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
Thanks to Bill Perry who reviewed the original code and suggested I base this library on
|
||||
the New LiquidCrystal library by F. Malpartida. Thak you also to Tim Eckel who wrote the
|
||||
[LCDBitmap](http://code.google.com/p/arduino-lcd-bitmap/) library whose code gave me insight
|
||||
on how to make this library compatible with both the standard LiquidCrystal and New
|
||||
LiquidCrystal libraries.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
You must install the BigCrystal library into your Arduino library directory. Optionally, you
|
||||
can remove the standard LiquidCrystal library and replace it with the New LiquidCrystal library.
|
||||
|
||||
BigCrystal is implemented as a wrapper around an LCD object, created using either the standard or
|
||||
new LiquidCrystal libraries. The lcd object is passed through to the BigCrystal constructor.
|
||||
|
||||
BigCrystal exposes all LiquidCrystal public methods and delegates to the underlying object. This
|
||||
means that once the BigCrytal object is created, you just need to reference that instance instead
|
||||
of using both the BigCrystal instance and the underling LiquidCrystal instance.
|
||||
|
||||
The following methods are available to display double height characters:
|
||||
* writeBig(char c, uint8_t row, uint8_t col) - writes a single large character to the specified coordinates.
|
||||
* printBig(char* str, uint8_t row, uint8_t col) - writes a String to the specified coordinates.
|
||||
* widthBig(char c) - returns the width in characters of the specified large character.
|
||||
Includes the one column space following the character.
|
||||
33
libraries/BigCrystal/examples/NewLCD_I2C/AllCharacters/AllCharacters.ino
Executable file
33
libraries/BigCrystal/examples/NewLCD_I2C/AllCharacters/AllCharacters.ino
Executable file
@@ -0,0 +1,33 @@
|
||||
#include <Wire.h>
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
LiquidCrystal_I2C lcd(0x38); // Set the LCD I2C address
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4); // Set to your LCD size
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Displays all characters is big front from 0x00 (space) to 0x5A (Z)
|
||||
for (char c = 0x20; c <= 0x5A; c++) {
|
||||
// Clear out the maximum width so that pars of wider
|
||||
// characters are removed
|
||||
clear();
|
||||
|
||||
bigCrystal.writeBig(c, 0, 0);
|
||||
bigCrystal.setCursor(7, 0);
|
||||
bigCrystal.write(c);
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bigCrystal.setCursor(i, 0);
|
||||
bigCrystal.print(' ');
|
||||
bigCrystal.setCursor(i, 1);
|
||||
bigCrystal.print(' ');
|
||||
}
|
||||
}
|
||||
16
libraries/BigCrystal/examples/NewLCD_I2C/PrintString/PrintString.ino
Executable file
16
libraries/BigCrystal/examples/NewLCD_I2C/PrintString/PrintString.ino
Executable file
@@ -0,0 +1,16 @@
|
||||
#include <Wire.h>
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Set up according to your LCD pins
|
||||
LiquidCrystal_I2C lcd(0x38); // Set the LCD I2C address
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4);
|
||||
|
||||
bigCrystal.printBig("10:22", 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
34
libraries/BigCrystal/examples/NewLCD_SR/AllCharacters/AllCharacters.ino
Executable file
34
libraries/BigCrystal/examples/NewLCD_SR/AllCharacters/AllCharacters.ino
Executable file
@@ -0,0 +1,34 @@
|
||||
#include <LiquidCrystal_SR.h>
|
||||
#include <LCDBitmap.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Set up according to your shift register pins
|
||||
LiquidCrystal_SR lcd(8, 7, TWO_WIRE);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4); // Set to your LCD size
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Displays all characters is big front from 0x00 (space) to 0x5A (Z)
|
||||
for (char c = 0x20; c <= 0x5A; c++) {
|
||||
// Clear out the maximum width so that pars of wider
|
||||
// characters are removed
|
||||
clear();
|
||||
|
||||
bigCrystal.writeBig(c, 0, 0);
|
||||
bigCrystal.setCursor(7, 0);
|
||||
bigCrystal.write(c);
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bigCrystal.setCursor(i, 0);
|
||||
bigCrystal.print(' ');
|
||||
bigCrystal.setCursor(i, 1);
|
||||
bigCrystal.print(' ');
|
||||
}
|
||||
}
|
||||
16
libraries/BigCrystal/examples/NewLCD_SR/PrintString/PrintString.ino
Executable file
16
libraries/BigCrystal/examples/NewLCD_SR/PrintString/PrintString.ino
Executable file
@@ -0,0 +1,16 @@
|
||||
#include <LiquidCrystal_SR.h>
|
||||
#include <LCDBitmap.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Set up according to your shift register pins
|
||||
LiquidCrystal_SR lcd(8, 7, TWO_WIRE);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4);
|
||||
|
||||
bigCrystal.printBig("10:22", 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
33
libraries/BigCrystal/examples/NewLCD_SR2W/AllCharacters/AllCharacters.ino
Executable file
33
libraries/BigCrystal/examples/NewLCD_SR2W/AllCharacters/AllCharacters.ino
Executable file
@@ -0,0 +1,33 @@
|
||||
#include <LiquidCrystal_SR2W.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Change to your shift register pins
|
||||
LiquidCrystal_SR2W lcd(2, 3);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4); // Set to your LCD size
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Displays all characters is big front from 0x00 (space) to 0x5A (Z)
|
||||
for (char c = 0x20; c <= 0x5A; c++) {
|
||||
// Clear out the maximum width so that pars of wider
|
||||
// characters are removed
|
||||
clear();
|
||||
|
||||
bigCrystal.writeBig(c, 0, 0);
|
||||
bigCrystal.setCursor(7, 0);
|
||||
bigCrystal.write(c);
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bigCrystal.setCursor(i, 0);
|
||||
bigCrystal.print(' ');
|
||||
bigCrystal.setCursor(i, 1);
|
||||
bigCrystal.print(' ');
|
||||
}
|
||||
}
|
||||
15
libraries/BigCrystal/examples/NewLCD_SR2W/PrintString/PrintString.ino
Executable file
15
libraries/BigCrystal/examples/NewLCD_SR2W/PrintString/PrintString.ino
Executable file
@@ -0,0 +1,15 @@
|
||||
#include <LiquidCrystal_SR2W.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Change to your shift register pins
|
||||
LiquidCrystal_SR2W lcd(2, 3);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4);
|
||||
|
||||
bigCrystal.printBig("10:22", 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
34
libraries/BigCrystal/examples/NewLCD_SR3W/AllCharacters/AllCharacters.ino
Executable file
34
libraries/BigCrystal/examples/NewLCD_SR3W/AllCharacters/AllCharacters.ino
Executable file
@@ -0,0 +1,34 @@
|
||||
#include <LiquidCrystal_SR3W.h>
|
||||
#include <LCDBitmap.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Set to your shift rgister pins
|
||||
LiquidCrystal_SR3W lcd(2, 3, 4, 7, POSITIVE);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4); // Set to your LCD size
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Displays all characters is big front from 0x00 (space) to 0x5A (Z)
|
||||
for (char c = 0x20; c <= 0x5A; c++) {
|
||||
// Clear out the maximum width so that pars of wider
|
||||
// characters are removed
|
||||
clear();
|
||||
|
||||
bigCrystal.writeBig(c, 0, 0);
|
||||
bigCrystal.setCursor(7, 0);
|
||||
bigCrystal.write(c);
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bigCrystal.setCursor(i, 0);
|
||||
bigCrystal.print(' ');
|
||||
bigCrystal.setCursor(i, 1);
|
||||
bigCrystal.print(' ');
|
||||
}
|
||||
}
|
||||
16
libraries/BigCrystal/examples/NewLCD_SR3W/PrintString/PrintString.ino
Executable file
16
libraries/BigCrystal/examples/NewLCD_SR3W/PrintString/PrintString.ino
Executable file
@@ -0,0 +1,16 @@
|
||||
#include <LiquidCrystal_SR3W.h>
|
||||
#include <LCDBitmap.h>
|
||||
#include <BigCrystal.h>
|
||||
|
||||
// Set to your shift rgister pins
|
||||
LiquidCrystal_SR3W lcd(2, 3, 4, 7, POSITIVE);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4);
|
||||
|
||||
bigCrystal.printBig("10:22", 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <BigCrystal.h>
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
// Set up according to your LCD pins
|
||||
LiquidCrystal lcd(22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4); // Set to your LCD size
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Displays all characters is big front from 0x00 (space) to 0x5A (Z)
|
||||
for (char c = 0x20; c <= 0x5A; c++) {
|
||||
// Clear out the maximum width so that pars of wider
|
||||
// characters are removed
|
||||
clear();
|
||||
|
||||
bigCrystal.writeBig(c, 0, 0);
|
||||
bigCrystal.setCursor(7, 0);
|
||||
bigCrystal.write(c);
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bigCrystal.setCursor(i, 0);
|
||||
bigCrystal.print(' ');
|
||||
bigCrystal.setCursor(i, 1);
|
||||
bigCrystal.print(' ');
|
||||
}
|
||||
}
|
||||
15
libraries/BigCrystal/examples/StandardLibrary/PrintString/PrintString.ino
Executable file
15
libraries/BigCrystal/examples/StandardLibrary/PrintString/PrintString.ino
Executable file
@@ -0,0 +1,15 @@
|
||||
#include <BigCrystal.h>
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
// Set up according to your LCD pins
|
||||
LiquidCrystal lcd(22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32);
|
||||
BigCrystal bigCrystal(&lcd);
|
||||
|
||||
void setup() {
|
||||
bigCrystal.begin(20, 4);
|
||||
|
||||
bigCrystal.printBig("10:22", 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
19
libraries/BigCrystal/keywords.txt
Executable file
19
libraries/BigCrystal/keywords.txt
Executable file
@@ -0,0 +1,19 @@
|
||||
#######################################
|
||||
# Syntax Coloring Map For BigCrystal
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
|
||||
BigCrystal KEYWORD1
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
widthBig KEYWORD2
|
||||
writeBig KEYWORD2
|
||||
printBig KEYWORD2
|
||||
|
||||
|
||||
10
libraries/BigCrystal/library.properties
Executable file
10
libraries/BigCrystal/library.properties
Executable file
@@ -0,0 +1,10 @@
|
||||
name=BigCrystal
|
||||
version=2.0.1
|
||||
author=Greg Tan <greg@gregtan.com>
|
||||
maintainer=Greg Tan <greg@gregtan.com>
|
||||
sentence=A library that displays double height characters on LCD displays.
|
||||
paragraph=The library works with LCD displays connected via 4 bit parallel, 8 bit parallel, I2C (using the PFC8573) and shift registers.
|
||||
category=Display
|
||||
url=https://github.com/gregington/BigCrystal
|
||||
architectures=*
|
||||
|
||||
140
libraries/BigCrystal/src/BigCrystal.cpp
Executable file
140
libraries/BigCrystal/src/BigCrystal.cpp
Executable file
@@ -0,0 +1,140 @@
|
||||
#include "BigFont.h"
|
||||
#include "BigCrystal.h"
|
||||
|
||||
#ifndef LiquidCrystal_h // New liquid crystal library
|
||||
BigCrystal::BigCrystal(LCD *display) {
|
||||
#else // Standard library
|
||||
BigCrystal::BigCrystal(LiquidCrystal *display) {
|
||||
#endif
|
||||
_display = display;
|
||||
createCustomChars();
|
||||
}
|
||||
|
||||
|
||||
/* Creates custom font shapes for LCD characters 0 through to 7
|
||||
* used in displaying big fonts
|
||||
*/
|
||||
void BigCrystal::createCustomChars() {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
uint8_t customChar[8];
|
||||
for (uint8_t j = 0; j < 8; j++) {
|
||||
customChar[j] = pgm_read_byte(BF_fontShapes + (i * 8) + j);
|
||||
}
|
||||
_display->createChar(i, customChar);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t BigCrystal::widthBig(char c) {
|
||||
if (!supported(c)) {
|
||||
return 0; // we don't support characters outside this range
|
||||
}
|
||||
char ch = toUpperCase(c);
|
||||
|
||||
uint8_t tableCode;
|
||||
uint8_t index;
|
||||
getTableCodeAndIndex(ch, tableCode, index);
|
||||
|
||||
uint8_t width = getWidthFromTableCode(tableCode);
|
||||
if (width == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return width + 1; // add one for space after character
|
||||
}
|
||||
|
||||
uint8_t BigCrystal::writeBig(char c, uint8_t col, uint8_t row) {
|
||||
if (!supported(c)) {
|
||||
return 0; // we don't support characters outside this range
|
||||
}
|
||||
char ch = toUpperCase(c);
|
||||
|
||||
uint8_t tableCode;
|
||||
uint8_t index;
|
||||
getTableCodeAndIndex(ch, tableCode, index);
|
||||
|
||||
const uint8_t* table = getTable(tableCode);
|
||||
if (table == NULL) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t width = getWidthFromTableCode(tableCode);
|
||||
|
||||
int tableOffset = (width * 2) * index;
|
||||
|
||||
// Write first row
|
||||
setCursor(col, row);
|
||||
for (uint8_t i = 0; i < width; i++) {
|
||||
write(pgm_read_byte_near(table + tableOffset + i));
|
||||
}
|
||||
|
||||
// Write second row
|
||||
setCursor(col, row + 1);
|
||||
for (uint8_t i = 0; i < width; i++) {
|
||||
write(pgm_read_byte_near(table + tableOffset + width + i));
|
||||
}
|
||||
|
||||
// Clear last column
|
||||
clearColumn(col + width, row);
|
||||
|
||||
return width + 1; // add one for the cleared column
|
||||
}
|
||||
|
||||
uint8_t BigCrystal::printBig(char *str, uint8_t col, uint8_t row) {
|
||||
uint8_t width = 0;
|
||||
char *c = str;
|
||||
while (*c != '\0') {
|
||||
width += writeBig(*c, col + width, row);
|
||||
*c++;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
void BigCrystal::getTableCodeAndIndex(char c, uint8_t& tableCode, uint8_t& index) {
|
||||
uint8_t tableAndIndex = pgm_read_byte_near(BF_characters + c - ' ');
|
||||
// Top 3 bits are the table, bottom 5 are index into table
|
||||
tableCode = (uint8_t) ((tableAndIndex & 0xE0) >> 5);
|
||||
index = (uint8_t) (tableAndIndex & 0x1F);
|
||||
}
|
||||
|
||||
const uint8_t* BigCrystal::getTable(uint8_t tableCode) {
|
||||
switch (tableCode) {
|
||||
case BF_WIDTH1_TABLE:
|
||||
return BF_width1;
|
||||
case BF_WIDTH2_TABLE:
|
||||
return BF_width2;
|
||||
case BF_WIDTH3_TABLE:
|
||||
return BF_width3;
|
||||
case BF_WIDTH4_TABLE:
|
||||
return BF_width4;
|
||||
case BF_WIDTH5_TABLE:
|
||||
return BF_width5;
|
||||
case BF_WIDTH3_SYMBOLS_TABLE:
|
||||
return BF_width3Symbols;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t BigCrystal::getWidthFromTableCode(uint8_t tableCode) {
|
||||
if (tableCode == BF_WIDTH3_SYMBOLS_TABLE) {
|
||||
return 3;
|
||||
}
|
||||
return tableCode;
|
||||
}
|
||||
|
||||
bool BigCrystal::supported(char c) {
|
||||
return (c >= ' ' && c <= 'Z') || (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
char BigCrystal::toUpperCase(char c) {
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
return c &0x5f;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void BigCrystal::clearColumn(uint8_t col, uint8_t row) {
|
||||
setCursor(col, row);
|
||||
write(0x20);
|
||||
setCursor(col, row + 1);
|
||||
write(0x20);
|
||||
}
|
||||
114
libraries/BigCrystal/src/BigCrystal.h
Executable file
114
libraries/BigCrystal/src/BigCrystal.h
Executable file
@@ -0,0 +1,114 @@
|
||||
#ifndef BigCrystal_h
|
||||
#define BigCrystal_h
|
||||
|
||||
#include "BigFont.h"
|
||||
#include <Print.h>
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
#include <LiquidCrystal.h>
|
||||
#ifndef LiquidCrystal_h // Using the new LiquidCrystal library
|
||||
#ifdef LiquidCrystal_4bit_h || LiquidCrystal_I2C_h || _LIQUIDCRYSTAL_SR_ || _LIQUIDCRYSTAL_SR2W_ || _LIQUIDCRYSTAL_SR3W_H_ // Using the New LiquidCrystal library
|
||||
#include "LCD.h"
|
||||
#else
|
||||
#error You must install New LiquidCrystal library to work with non-4bit projects: http:/bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Class that displays text on a Hitachi HD44780 compatible display. As well
|
||||
* as displaying standard text, doubli height characters can also be displayed.
|
||||
*/
|
||||
class BigCrystal : public Print {
|
||||
public:
|
||||
/* Creates a BigCrystal instance.
|
||||
* Parameters:
|
||||
* lcd: A LiquidCrystal or LCD instance.
|
||||
*/
|
||||
#ifndef LiquidCrystal_h // New liquid crystal library
|
||||
BigCrystal(LCD *display);
|
||||
#else
|
||||
BigCrystal(LiquidCrystal *display);
|
||||
#endif
|
||||
BigCrystal(uint8_t rs, uint8_t enable,
|
||||
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
|
||||
|
||||
/* Returns the width in columns of the specified character.
|
||||
* If the character cannot be printed big, then zero is returned.
|
||||
* Parameters:
|
||||
* c: the character whose width is required
|
||||
* Returns:
|
||||
* the width of the character, including the empty spacer column,
|
||||
* or zero if the character cannot be displayed.
|
||||
*/
|
||||
uint8_t widthBig(char c);
|
||||
|
||||
/* Writes the specified character to the coordinate specified on the display.
|
||||
* Parameters:
|
||||
* c: the character to display
|
||||
* col: the column on the display where the left edge of the character starts
|
||||
* row: the row on the display where the top of the character starts
|
||||
* Returns:
|
||||
* the width of the character displayed, including the empty spacer column,
|
||||
* or zero if the character cannot be displayed.
|
||||
*/
|
||||
uint8_t writeBig(char c, uint8_t col, uint8_t row);
|
||||
|
||||
/* Writes the specified string from left to right, starting at the specified
|
||||
* display coordinate. No bounds checks are made to ensure that the string
|
||||
* will fit on the display. On a four line or greater display, characters will
|
||||
* not wrap onto lower display rows.
|
||||
* Parameters:
|
||||
* str: the String to display
|
||||
* col: the column on the display where the left edge of the first character
|
||||
* starts
|
||||
* row: the row on the display where the top edge of characters start
|
||||
* Returns:
|
||||
* the total width of all printed characters, including all empty spacer columns
|
||||
*/
|
||||
uint8_t printBig(char *str, uint8_t col, uint8_t row);
|
||||
|
||||
/* Delegate methods to underlying LCD instance */
|
||||
inline void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS) {
|
||||
_display->begin(cols, rows, charsize);
|
||||
}
|
||||
inline void clear() { _display->clear(); }
|
||||
inline void home() { _display->home(); }
|
||||
inline void noDisplay() { _display->noDisplay(); }
|
||||
inline void display() { _display->display(); }
|
||||
inline void noBlink() { _display->noBlink(); }
|
||||
inline void blink() { _display->blink(); }
|
||||
inline void noCursor() { _display->noCursor(); }
|
||||
inline void cursor() { _display->cursor(); }
|
||||
inline void scrollDisplayLeft() { _display->scrollDisplayLeft(); }
|
||||
inline void scrollDisplayRight() { _display->scrollDisplayRight(); }
|
||||
inline void leftToRight() { _display->leftToRight(); }
|
||||
inline void rightToLeft() { _display->rightToLeft(); }
|
||||
inline void autoscroll() { _display->autoscroll(); }
|
||||
inline void noAutoscroll() { _display->noAutoscroll(); }
|
||||
inline void createChar(uint8_t location, uint8_t charmap[]) { _display->createChar(location, charmap); }
|
||||
inline void setCursor(uint8_t col, uint8_t row) { _display->setCursor(col, row); }
|
||||
inline virtual size_t write(uint8_t value) { _display->write(value); }
|
||||
|
||||
using Print::write;
|
||||
private:
|
||||
void createCustomChars();
|
||||
uint8_t getWidthFromTableCode(uint8_t tableCode);
|
||||
const uint8_t* getTable(uint8_t tableCode);
|
||||
void getTableCodeAndIndex(char c, uint8_t &tableCode, uint8_t &index);
|
||||
void clearColumn(uint8_t row, uint8_t col);
|
||||
char toUpperCase(char c);
|
||||
bool supported(char c);
|
||||
#ifndef LiquidCrystal_h // Using New LquidCrystal library
|
||||
LCD *_display;
|
||||
#else
|
||||
LiquidCrystal *_display;
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
233
libraries/BigCrystal/src/BigFont.c
Executable file
233
libraries/BigCrystal/src/BigFont.c
Executable file
@@ -0,0 +1,233 @@
|
||||
#include "BigFont.h"
|
||||
|
||||
//************************************************************************
|
||||
//* A set of custom made large numbers for a 16x2 LCD using the
|
||||
//* LiquidCrystal librabry. Works with displays compatible with the
|
||||
//* Hitachi HD44780 driver.
|
||||
//*
|
||||
//* orginal developed by Michael Pilcher 2/9/2010
|
||||
//* there are 8 entries, 8 bytes per entry
|
||||
//* these are the building blocks to make the numbers
|
||||
//*
|
||||
//* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265696343
|
||||
//************************************************************************
|
||||
|
||||
|
||||
//* The LL, LT, UB, ect... are abreviations to designate which segment was which when referencing the large '0'.
|
||||
//* LT= left top
|
||||
//* UB= upper bar
|
||||
//* RT= right top
|
||||
//* LL= lower left
|
||||
//* LB= lower bar
|
||||
//* LR= lower right
|
||||
//* UMB= upper middle bars(upper middle section of the '8')
|
||||
//* LMB= lower middle bars(lower middle section of the '8')
|
||||
|
||||
|
||||
const uint8_t BF_fontShapes[] PROGMEM = {
|
||||
//* LT[8] =
|
||||
B00111,
|
||||
B01111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
//* UB[8] =
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
//* RT[8] =
|
||||
B11100,
|
||||
B11110,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
//* LL[8] =
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B01111,
|
||||
B00111,
|
||||
//* LB[8] =
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
//* LR[8] =
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B11110,
|
||||
B11100,
|
||||
//* UMB[8] =
|
||||
B11111,
|
||||
B11111,
|
||||
B11111,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B11111,
|
||||
B11111,
|
||||
//* LMB[8] =
|
||||
B11111,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B00000,
|
||||
B11111,
|
||||
B11111,
|
||||
B11111
|
||||
};
|
||||
|
||||
/* Stores the table storing character data and index into the corresponding
|
||||
* array for the character width that the data starts. 3 bits for
|
||||
* width and 5 bits for the index. index 0 of this table is for
|
||||
* ASCII 0x20 (space) */
|
||||
const uint8_t BF_characters[] PROGMEM = {
|
||||
(BF_WIDTH1_TABLE << 5) | 0, // 0x20 (space)
|
||||
(BF_WIDTH1_TABLE << 5) | 1, // 0x21 !
|
||||
(BF_WIDTH3_SYMBOLS_TABLE << 5) | 0, // 0x22 "
|
||||
BF_NOT_SUPPORTED, // 0x23 #
|
||||
BF_NOT_SUPPORTED, // 0x24 $
|
||||
BF_NOT_SUPPORTED, // 0x25 %
|
||||
BF_NOT_SUPPORTED, // 0x26 &
|
||||
(BF_WIDTH1_TABLE << 5) | 2, // 0x27 '
|
||||
(BF_WIDTH1_TABLE << 5) | 3, // 0x28 (
|
||||
(BF_WIDTH1_TABLE << 5) | 4, // 0x29 )
|
||||
BF_NOT_SUPPORTED, // 0x2A *
|
||||
(BF_WIDTH3_SYMBOLS_TABLE << 5) | 1, // 0x2B +
|
||||
(BF_WIDTH1_TABLE << 5) | 5, // 0x2C ,
|
||||
(BF_WIDTH2_TABLE << 5) | 0, // 0x2D -
|
||||
(BF_WIDTH1_TABLE << 5) | 6, // 0x2E .
|
||||
BF_NOT_SUPPORTED, // 0x2F /
|
||||
(BF_WIDTH3_TABLE << 5) | 0, // 0x30 0
|
||||
(BF_WIDTH3_TABLE << 5) | 1, // 0x31 1
|
||||
(BF_WIDTH3_TABLE << 5) | 2, // 0x32 2
|
||||
(BF_WIDTH3_TABLE << 5) | 3, // 0x33 3
|
||||
(BF_WIDTH3_TABLE << 5) | 4, // 0x34 4
|
||||
(BF_WIDTH3_TABLE << 5) | 5, // 0x35 5
|
||||
(BF_WIDTH3_TABLE << 5) | 6, // 0x36 6
|
||||
(BF_WIDTH3_TABLE << 5) | 7, // 0x37 7
|
||||
(BF_WIDTH3_TABLE << 5) | 8, // 0x38 8
|
||||
(BF_WIDTH3_TABLE << 5) | 9, // 0x39 9
|
||||
(BF_WIDTH1_TABLE << 5) | 7, // 0x3A :
|
||||
(BF_WIDTH1_TABLE << 5) | 8, // 0x3B ;
|
||||
BF_NOT_SUPPORTED, // 0x3C <
|
||||
(BF_WIDTH2_TABLE << 5) | 1, // 0x3D =
|
||||
BF_NOT_SUPPORTED, // 0x3E <
|
||||
(BF_WIDTH3_SYMBOLS_TABLE << 5) | 2, // 0x3F ?
|
||||
BF_NOT_SUPPORTED, // 0x40 @
|
||||
(BF_WIDTH3_TABLE << 5) | 10, // 0x41 A
|
||||
(BF_WIDTH3_TABLE << 5) | 11, // 0x42 B
|
||||
(BF_WIDTH3_TABLE << 5) | 12, // 0x43 C
|
||||
(BF_WIDTH3_TABLE << 5) | 13, // 0x44 D
|
||||
(BF_WIDTH3_TABLE << 5) | 14, // 0x45 E
|
||||
(BF_WIDTH3_TABLE << 5) | 15, // 0x46 F
|
||||
(BF_WIDTH3_TABLE << 5) | 16, // 0x47 G
|
||||
(BF_WIDTH3_TABLE << 5) | 17, // 0x48 H
|
||||
(BF_WIDTH3_TABLE << 5) | 18, // 0x49 I
|
||||
(BF_WIDTH3_TABLE << 5) | 19, // 0x4A J
|
||||
(BF_WIDTH3_TABLE << 5) | 20, // 0x4B K
|
||||
(BF_WIDTH3_TABLE << 5) | 21, // 0x4C L
|
||||
(BF_WIDTH5_TABLE << 5) | 0, // 0x4D M
|
||||
(BF_WIDTH4_TABLE << 5) | 0, // 0x4E N
|
||||
(BF_WIDTH3_TABLE << 5) | 0, // 0x4F O; same as 0, so re-use
|
||||
(BF_WIDTH3_TABLE << 5) | 22, // 0x50 P
|
||||
(BF_WIDTH4_TABLE << 5) | 1, // 0x51 Q
|
||||
(BF_WIDTH3_TABLE << 5) | 23, // 0x52 R
|
||||
(BF_WIDTH3_TABLE << 5) | 24, // 0x53 S
|
||||
(BF_WIDTH3_TABLE << 5) | 25, // 0x54 T
|
||||
(BF_WIDTH3_TABLE << 5) | 26, // 0x55 U
|
||||
(BF_WIDTH4_TABLE << 5) | 2, // 0x56 V
|
||||
(BF_WIDTH5_TABLE << 5) | 1, // 0x57 W
|
||||
(BF_WIDTH3_TABLE << 5) | 27, // 0x58 X
|
||||
(BF_WIDTH3_TABLE << 5) | 28, // 0x59 Y
|
||||
(BF_WIDTH3_TABLE << 5) | 29 // 0x5A Z
|
||||
};
|
||||
|
||||
const uint8_t BF_width1[] PROGMEM = {
|
||||
0x20, 0x20, // 0x20 space
|
||||
0x00, 0x04, // 0x21 !
|
||||
0x05, 0x20, // 0x27 '
|
||||
0x00, 0x03, // 0x28 (
|
||||
0x02, 0x05, // 0x29 )
|
||||
0x20, 0x05, // 0x2C ,
|
||||
0x20, 0x04, // 0x2E .
|
||||
0x6F, 0x6F, // 0x3A :
|
||||
0x01, 0x05 // 0x3B ;
|
||||
};
|
||||
|
||||
const uint8_t BF_width2[] PROGMEM = {
|
||||
0x04, 0x04, 0x20, 0x20, // 0x2D -
|
||||
0x04, 0x04, 0x07, 0x07 // 0x3D =
|
||||
};
|
||||
|
||||
const uint8_t BF_width3[] PROGMEM = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, // 0x30 0, 0x4F O
|
||||
0x01, 0x02, 0x20, 0x04, 0xFF, 0x04, // 0x31 1
|
||||
0x06, 0x06, 0x02, 0x03, 0x04, 0x04, // 0x32 2
|
||||
0x06, 0x06, 0x02, 0x04, 0x04, 0x05, // 0x33 3
|
||||
0x03, 0x04, 0x02, 0x20, 0x20, 0x05, // 0x34 4
|
||||
0xFF, 0x06, 0x06, 0x04, 0x04, 0x05, // 0x35 5
|
||||
0x00, 0x06, 0x06, 0x03, 0x04, 0x05, // 0x36 6
|
||||
0x01, 0x01, 0x02, 0x20, 0x00, 0x20, // 0x37 7
|
||||
0x00, 0x06, 0x02, 0x03, 0x04, 0x05, // 0x38 8
|
||||
0x00, 0x06, 0x02, 0x20, 0x20, 0x05, // 0x39 9
|
||||
0x00, 0x06, 0x02, 0xFF, 0x20, 0xFF, // 0x41 A
|
||||
0xFF, 0x06, 0x05, 0xFF, 0x07, 0x02, // 0x42 B
|
||||
0x00, 0x01, 0x01, 0x03, 0x04, 0x04, // 0x43 C
|
||||
0xFF, 0x01, 0x02, 0xFF, 0x04, 0x05, // 0x44 D
|
||||
0xFF, 0x06, 0x06, 0xFF, 0x07, 0x07, // 0x45 E
|
||||
0xFF, 0x06, 0x06, 0xFF, 0x20, 0x20, // 0x46 F
|
||||
0x00, 0x01, 0x01, 0x03, 0x04, 0x02, // 0x47 G
|
||||
0xFF, 0x04, 0xFF, 0xFF, 0x20, 0xFF, // 0x48 H
|
||||
0x01, 0xFF, 0x01, 0x04, 0xFF, 0x04, // 0x49 I
|
||||
0x20, 0x20, 0xFF, 0x04, 0x04, 0x05, // 0x4A J
|
||||
0xFF, 0x04, 0x05, 0xFF, 0x20, 0x02, // 0x4B K
|
||||
0xFF, 0x20, 0x20, 0xFF, 0x04, 0x04, // 0x4C L
|
||||
0x00, 0x06, 0x02, 0x03, 0x20, 0x20, // 0x50 P
|
||||
0x00, 0x06, 0x05, 0x03, 0x20, 0x02, // 0x52 R
|
||||
0x00, 0x06, 0x06, 0x07, 0x07, 0x05, // 0x53 S
|
||||
0x01, 0x02, 0x01, 0x20, 0x05, 0x20, // 0x54 T
|
||||
0x02, 0x20, 0x02, 0x03, 0x04, 0x05, // 0x55 U
|
||||
0x03, 0x04, 0x05, 0x00, 0x20, 0x02, // 0x58 X
|
||||
0x03, 0x04, 0x05, 0x20, 0x05, 0x20, // 0x59 Y
|
||||
0x01, 0x06, 0x05, 0x00, 0x07, 0x04 // 0x5A Z
|
||||
};
|
||||
|
||||
const uint8_t BF_width3Symbols[] PROGMEM = {
|
||||
0x05, 0x20, 0x05, 0x20, 0x20, 0x20, // 0x22 "
|
||||
0x04, 0xFF, 0x04, 0x01, 0xFF, 0x01, // 0x2B +
|
||||
0x01, 0x06, 0x02, 0x20, 0x07, 0x20 // 0x3F ?
|
||||
};
|
||||
|
||||
const uint8_t BF_width4[] PROGMEM = {
|
||||
0x00, 0x03, 0x20, 0x02, 0x03, 0x20, 0x02, 0x05, // 0x4E N
|
||||
0x00, 0x01, 0x02, 0x20, 0x03, 0x04, 0x03, 0x04, // 0x51 Q
|
||||
0x03, 0x20, 0x20, 0x05, 0x20, 0x03, 0x05, 0x20 // 0x56 V
|
||||
};
|
||||
|
||||
const uint8_t BF_width5[] PROGMEM = {
|
||||
0x00, 0x01, 0x03, 0x01, 0x02, 0x03, 0x20, 0x20, 0x20, 0x05, // 0x4D M
|
||||
0x00, 0x20, 0x20, 0x20, 0x02, 0x03, 0x04, 0x00, 0x04, 0x05 // 0x57 W
|
||||
};
|
||||
35
libraries/BigCrystal/src/BigFont.h
Executable file
35
libraries/BigCrystal/src/BigFont.h
Executable file
@@ -0,0 +1,35 @@
|
||||
#ifndef BigFont_h
|
||||
#define BigFont_h
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
//************************************************************************
|
||||
//* A set of custom made large numbers for a 16x2 LCD using the
|
||||
//* LiquidCrystal librabry. Works with displays compatible with the
|
||||
//* Hitachi HD44780 driver.
|
||||
//*
|
||||
//* orginal developed by Michael Pilcher 2/9/2010
|
||||
//* there are 8 entries, 8 bytes per entry
|
||||
//* these are the building blocks to make the numbers
|
||||
//*
|
||||
//* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265696343
|
||||
//************************************************************************
|
||||
|
||||
#define BF_NOT_SUPPORTED 0
|
||||
#define BF_WIDTH1_TABLE 0x01
|
||||
#define BF_WIDTH2_TABLE 0x02
|
||||
#define BF_WIDTH3_TABLE 0x03
|
||||
#define BF_WIDTH4_TABLE 0x04
|
||||
#define BF_WIDTH5_TABLE 0x05
|
||||
#define BF_WIDTH3_SYMBOLS_TABLE 0x06
|
||||
|
||||
const extern uint8_t BF_fontShapes[64] PROGMEM;
|
||||
const extern uint8_t BF_characters[59] PROGMEM;
|
||||
const extern uint8_t BF_width1[18] PROGMEM;
|
||||
const extern uint8_t BF_width2[8] PROGMEM;
|
||||
const extern uint8_t BF_width3[180] PROGMEM;
|
||||
const extern uint8_t BF_width3Symbols[18] PROGMEM;
|
||||
const extern uint8_t BF_width4[24] PROGMEM;
|
||||
const extern uint8_t BF_width5[20] PROGMEM;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user