Shuffled libraries to match current circuit/code

This commit is contained in:
Mike C 2013-04-25 18:10:09 -04:00
parent dd981aa44d
commit 782b620cd4
21 changed files with 308 additions and 1546 deletions

3
.gitmodules vendored
View file

@ -7,3 +7,6 @@
[submodule "Libraries/Adafruit-SD"]
path = Libraries/Adafruit-SD
url = git://github.com/adafruit/SD.git
[submodule ".\\Libraries\\Adafruit-RTClib"]
path = .\\Libraries\\Adafruit-RTClib
url = git://github.com/adafruit/RTClib.git

@ -0,0 +1 @@
Subproject commit 08c0e614d045f243f0d7ce46f5edbd0b3a2336fd

View file

@ -1,623 +0,0 @@
/*
LCDShield.cpp - Arduino Library to control a Nokia 6100 LCD,
specifically that found on SparkFun's Color LCD Shield.
This code should work for both Epson and Phillips display drivers
normally found on the Color LCD Shield.
License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free
to use and abuse this code however you'd like. If you find it useful
please attribute, and SHARE-ALIKE!
This is based on code by Mark Sproul, and Peter Davenport.
Thanks to Coleman Sellers and Harold Timmis for help getting it to work with the Phillips Driver 7-31-2011
*/
#include "ColorLCDShield.h"
/*extern "C" {
#include "wiring.h"
}*/
#include "Arduino.h"
static char x_offset = 0;
static char y_offset = 0;
LCDShield::LCDShield()
{
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
DDRB = ((1<<DIO)|(1<<SCK_PIN)); //Set DIO and SCK_PIN pins on PORTB as outputs
DDRH = ((1<<CS)|(1<<LCD_RES)); //Set CS and RES pins PORTH as outputs
#elif defined(__AVR_ATmega32U4__)
DDRB = (1<<LCD_RES) | (1<<CS) | (1<<DIO);
DDRC = (1<<SCK_PIN);
#else
DDRB = ((1<<CS)|(1<<DIO)|(1<<SCK_PIN)|(1<<LCD_RES)); //Set the control pins as outputs
#endif
DDRD = 0x00;
PORTD = 0xFF;
}
void LCDShield::LCDCommand(unsigned char data)
{
char jj;
cbi(LCD_PORT_CS, CS); // enable chip
cbi(LCD_PORT_DIO, DIO); // output low on data out (9th bit low = command)
cbi(LCD_PORT_SCK, SCK_PIN); // send clock pulse
delayMicroseconds(1);
sbi(LCD_PORT_SCK, SCK_PIN);
for (jj = 0; jj < 8; jj++)
{
if ((data & 0x80) == 0x80)
sbi(LCD_PORT_DIO, DIO);
else
cbi(LCD_PORT_DIO, DIO);
cbi(LCD_PORT_SCK, SCK_PIN); // send clock pulse
delayMicroseconds(1);
sbi(LCD_PORT_SCK, SCK_PIN);
data <<= 1;
}
sbi(LCD_PORT_CS, CS); // disable
}
void LCDShield::LCDData(unsigned char data)
{
char j;
cbi(LCD_PORT_CS, CS); // enable chip
sbi(LCD_PORT_DIO, DIO); // output high on data out (9th bit high = data)
cbi(LCD_PORT_SCK, SCK_PIN); // send clock pulse
delayMicroseconds(1);
sbi(LCD_PORT_SCK, SCK_PIN); // send clock pulse
for (j = 0; j < 8; j++)
{
if ((data & 0x80) == 0x80)
sbi(LCD_PORT_DIO, DIO);
else
cbi(LCD_PORT_DIO, DIO);
cbi(LCD_PORT_SCK, SCK_PIN); // send clock pulse
delayMicroseconds(1);
sbi(LCD_PORT_SCK, SCK_PIN);
data <<= 1;
}
LCD_PORT_CS |= (1<<CS); // disable
}
void LCDShield::init(int type, bool colorSwap)
{
driver = type;
// Initialize the control pins, and reset display:
cbi(LCD_PORT_SCK, SCK_PIN); // CLK = LOW
cbi(LCD_PORT_DIO, DIO); // DIO = LOW
delayMicroseconds(10); // 10us delay
sbi(LCD_PORT_CS, CS); // CS = HIGH
delayMicroseconds(10); // 10uS Delay
cbi(LCD_PORT_RES, LCD_RES); // RESET = LOW
delay(200); // 200ms delay
sbi(LCD_PORT_RES, LCD_RES); // RESET = HIGH
delay(200); // 200ms delay
sbi(LCD_PORT_SCK, SCK_PIN); // SCK_PIN = HIGH
sbi(LCD_PORT_DIO, DIO); // DIO = HIGH
delayMicroseconds(10); // 10us delay
if (driver == EPSON)
{
LCDCommand(DISCTL); // Display control (0xCA)
LCDData(0x0C); // 12 = 1100 - CL dividing ratio [don't divide] switching period 8H (default)
LCDData(0x20); // nlines/4 - 1 = 132/4 - 1 = 32 duty
LCDData(0x00); // No inversely highlighted lines
LCDCommand(COMSCN); // common scanning direction (0xBB)
LCDData(0x01); // 1->68, 132<-69 scan direction
LCDCommand(OSCON); // internal oscialltor ON (0xD1)
LCDCommand(SLPOUT); // sleep out (0x94)
LCDCommand(PWRCTR); // power ctrl (0x20)
LCDData(0x0F); // everything on, no external reference resistors
LCDCommand(DISINV); // invert display mode (0xA7)
LCDCommand(DATCTL); // data control (0xBC)
LCDData(0x03); // Inverse page address, reverse rotation column address, column scan-direction !!! try 0x01
LCDData(0x00); // normal RGB arrangement
LCDData(0x02); // 16-bit Grayscale Type A (12-bit color)
LCDCommand(VOLCTR); // electronic volume, this is the contrast/brightness (0x81)
LCDData(32); // volume (contrast) setting - fine tuning, original (0-63)
LCDData(3); // internal resistor ratio - coarse adjustment (0-7)
LCDCommand(NOP); // nop (0x25)
delay(100);
LCDCommand(DISON); // display on (0xAF)
}
else if (driver == PHILIPS)
{
LCDCommand(SLEEPOUT); // Sleep Out (0x11)
LCDCommand(BSTRON); // Booster voltage on (0x03)
LCDCommand(DISPON); // Display on (0x29)
//LCDCommand(INVON); // Inversion on (0x20)
// 12-bit color pixel format:
LCDCommand(COLMOD); // Color interface format (0x3A)
LCDData(0x03); // 0b011 is 12-bit/pixel mode
LCDCommand(MADCTL); // Memory Access Control(PHILLIPS)
if (colorSwap)
LCDData(0x08);
else
LCDData(0x00);
LCDCommand(SETCON); // Set Contrast(PHILLIPS)
LCDData(0x30);
LCDCommand(NOPP); // nop(PHILLIPS)
}
}
void LCDShield::clear(int color)
{
if (driver) // if it's an Epson
{
LCDCommand(PASET);
LCDData(0);
LCDData(131);
LCDCommand(CASET);
LCDData(0);
LCDData(131);
LCDCommand(RAMWR);
}
else // otherwise it's a phillips
{
LCDCommand(PASETP);
LCDData(0);
LCDData(131);
LCDCommand(CASETP);
LCDData(0);
LCDData(131);
LCDCommand(RAMWRP);
}
for(unsigned int i=0; i < (131*131)/2; i++)
{
LCDData((color>>4)&0x00FF);
LCDData(((color&0x0F)<<4)|(color>>8));
LCDData(color&0x0FF);
}
x_offset = 0;
y_offset = 0;
}
void LCDShield::contrast(char setting)
{
if (driver == EPSON)
{
setting &= 0x3F; // 2 msb's not used, mask out
LCDCommand(VOLCTR); // electronic volume, this is the contrast/brightness(EPSON)
LCDData(setting); // volume (contrast) setting - course adjustment, -- original was 24
LCDData(3); // TODO: Make this coarse adjustment variable, 3's a good place to stay
}
else if (driver == PHILIPS)
{
setting &= 0x7F; // msb is not used, mask it out
LCDCommand(SETCON); // contrast command (PHILLIPS)
LCDData(setting); // volume (contrast) setting - course adjustment, -- original was 24
}
}
// Added by Steve Sparks @ Big Nerd Ranch.
// This swaps the Epson RGB order into the Philips RGB order. (Or, vice versa, I suppose.)
uint16_t LCDShield::swapColors(uint16_t in) {
return ((in & 0x000F)<<8)|(in & 0x00F0)|((in & 0x0F00)>>8);
}
void LCDShield::setPixel(int color, unsigned char x, unsigned char y)
{
y = (COL_HEIGHT - 1) - y;
x = (ROW_LENGTH - 1) - x;
if (driver == EPSON) // if it's an epson
{
LCDCommand(PASET); // page start/end ram
LCDData(x);
LCDData(ENDPAGE);
LCDCommand(CASET); // column start/end ram
LCDData(y);
LCDData(ENDCOL);
LCDCommand(RAMWR); // write
LCDData((color>>4)&0x00FF);
LCDData(((color&0x0F)<<4)|(color>>8));
LCDData(color&0x0FF);
}
else if (driver == PHILIPS) // otherwise it's a phillips
{
LCDCommand(PASETP); // page start/end ram
LCDData(x);
LCDData(x);
LCDCommand(CASETP); // column start/end ram
LCDData(y);
LCDData(y);
LCDCommand(RAMWRP); // write
LCDData((unsigned char)((color>>4)&0x00FF));
LCDData((unsigned char)(((color&0x0F)<<4)|0x00));
}
}
// 2/18/2013 This Methos added by Tony Contrada in order to create arc segments in varied line thickness, or Filled
void LCDShield::setArc(int x0, int y0, int radius, int arcSegments[], int numSegments, int lineThickness, int color)
{
//Line Thickness (Num Pixels)
if(lineThickness == FILL) lineThickness = radius;
for(int i = 0; i < lineThickness; i++)
{
int f = 1 - radius;
int ddF_x = 0;
int ddF_y = -2 * radius;
int x = 0;
int y = radius;
while(x < y)
{
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
for(int i = 0; i < numSegments; i++)
{
if(arcSegments[i] == NNE) setPixel(color, x0 - y, y0 + x); //SHOW NNE
if(arcSegments[i] == ENE) setPixel(color, x0 - x, y0 + y); //SHOW ENE
if(arcSegments[i] == ESE) setPixel(color, x0 + x, y0 + y); //SHOW ESE
if(arcSegments[i] == SSE) setPixel(color, x0 + y, y0 + x); //SHOW SSE
if(arcSegments[i] == SSW) setPixel(color, x0 + y, y0 - x); //SHOW SSW
if(arcSegments[i] == WSW) setPixel(color, x0 + x, y0 - y); //SHOW WSW
if(arcSegments[i] == WNW) setPixel(color, x0 - x, y0 - y); //SHOW WNW
if(arcSegments[i] == NNW) setPixel(color, x0 - y, y0 - x); //SHOW NNW
}
}
radius--;
}
}
// 2/22/2013 - Modified by Tony Contrada to include Line Thickness (in pixels) or a Filled Circle
void LCDShield::setCircle (int x0, int y0, int radius, int color, int lineThickness)
{
if(lineThickness == FILL) lineThickness = radius;
for(int r = 0; r < lineThickness; r++)
{
int f = 1 - radius;
int ddF_x = 0;
int ddF_y = -2 * radius;
int x = 0;
int y = radius;
setPixel(color, x0, y0 + radius);
setPixel(color, x0, y0 - radius);
setPixel(color, x0 + radius, y0);
setPixel(color, x0 - radius, y0);
while(x < y)
{
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
setPixel(color, x0 + x, y0 + y);
setPixel(color, x0 - x, y0 + y);
setPixel(color, x0 + x, y0 - y);
setPixel(color, x0 - x, y0 - y);
setPixel(color, x0 + y, y0 + x);
setPixel(color, x0 - y, y0 + x);
setPixel(color, x0 + y, y0 - x);
setPixel(color, x0 - y, y0 - x);
}
radius--;
}
}
void LCDShield::setChar(char c, int x, int y, int fColor, int bColor)
{
y = (COL_HEIGHT - 1) - y; // make display "right" side up
x = (ROW_LENGTH - 2) - x;
int i,j;
unsigned int nCols;
unsigned int nRows;
unsigned int nBytes;
unsigned char PixelRow;
unsigned char Mask;
unsigned int Word0;
unsigned int Word1;
unsigned char *pFont;
unsigned char *pChar;
// get pointer to the beginning of the selected font table
pFont = (unsigned char *)FONT8x16;
// get the nColumns, nRows and nBytes
nCols = *pFont;
nRows = *(pFont + 1);
nBytes = *(pFont + 2);
// get pointer to the last byte of the desired character
pChar = pFont + (nBytes * (c - 0x1F)) + nBytes - 1;
if (driver) // if it's an epson
{
// Row address set (command 0x2B)
LCDCommand(PASET);
LCDData(x);
LCDData(x + nRows - 1);
// Column address set (command 0x2A)
LCDCommand(CASET);
LCDData(y);
LCDData(y + nCols - 1);
// WRITE MEMORY
LCDCommand(RAMWR);
// loop on each row, working backwards from the bottom to the top
for (i = nRows - 1; i >= 0; i--) {
// copy pixel row from font table and then decrement row
PixelRow = *pChar++;
// loop on each pixel in the row (left to right)
// Note: we do two pixels each loop
Mask = 0x80;
for (j = 0; j < nCols; j += 2)
{
// if pixel bit set, use foreground color; else use the background color
// now get the pixel color for two successive pixels
if ((PixelRow & Mask) == 0)
Word0 = bColor;
else
Word0 = fColor;
Mask = Mask >> 1;
if ((PixelRow & Mask) == 0)
Word1 = bColor;
else
Word1 = fColor;
Mask = Mask >> 1;
// use this information to output three data bytes
LCDData((Word0 >> 4) & 0xFF);
LCDData(((Word0 & 0xF) << 4) | ((Word1 >> 8) & 0xF));
LCDData(Word1 & 0xFF);
}
}
}
else
{
fColor = swapColors(fColor);
bColor = swapColors(bColor);
// Row address set (command 0x2B)
LCDCommand(PASETP);
LCDData(x);
LCDData(x + nRows - 1);
// Column address set (command 0x2A)
LCDCommand(CASETP);
LCDData(y);
LCDData(y + nCols - 1);
// WRITE MEMORY
LCDCommand(RAMWRP);
// loop on each row, working backwards from the bottom to the top
pChar+=nBytes-1; // stick pChar at the end of the row - gonna reverse print on phillips
for (i = nRows - 1; i >= 0; i--) {
// copy pixel row from font table and then decrement row
PixelRow = *pChar--;
// loop on each pixel in the row (left to right)
// Note: we do two pixels each loop
Mask = 0x01; // <- opposite of epson
for (j = 0; j < nCols; j += 2)
{
// if pixel bit set, use foreground color; else use the background color
// now get the pixel color for two successive pixels
if ((PixelRow & Mask) == 0)
Word0 = bColor;
else
Word0 = fColor;
Mask = Mask << 1; // <- opposite of epson
if ((PixelRow & Mask) == 0)
Word1 = bColor;
else
Word1 = fColor;
Mask = Mask << 1; // <- opposite of epson
// use this information to output three data bytes
LCDData((Word0 >> 4) & 0xFF);
LCDData(((Word0 & 0xF) << 4) | ((Word1 >> 8) & 0xF));
LCDData(Word1 & 0xFF);
}
}
}
}
void LCDShield::setStr(char *pString, int x, int y, int fColor, int bColor)
{
x = x + 16;
y = y + 8;
int originalY = y;
// loop until null-terminator is seen
while (*pString != 0x00) {
// draw the character
setChar(*pString++, x, y, fColor, bColor);
// advance the y position
y = y + 8;
// bail out if y exceeds 131
if (y > 131) {
x = x + 16;
y = originalY;
}
if (x > 123) break;
}
}
void LCDShield::setLine(int x0, int y0, int x1, int y1, int color)
{
int dy = y1 - y0; // Difference between y0 and y1
int dx = x1 - x0; // Difference between x0 and x1
int stepx, stepy;
if (dy < 0)
{
dy = -dy;
stepy = -1;
}
else
stepy = 1;
if (dx < 0)
{
dx = -dx;
stepx = -1;
}
else
stepx = 1;
dy <<= 1; // dy is now 2*dy
dx <<= 1; // dx is now 2*dx
setPixel(color, x0, y0);
if (dx > dy)
{
int fraction = dy - (dx >> 1);
while (x0 != x1)
{
if (fraction >= 0)
{
y0 += stepy;
fraction -= dx;
}
x0 += stepx;
fraction += dy;
setPixel(color, x0, y0);
}
}
else
{
int fraction = dx - (dy >> 1);
while (y0 != y1)
{
if (fraction >= 0)
{
x0 += stepx;
fraction -= dy;
}
y0 += stepy;
fraction += dx;
setPixel(color, x0, y0);
}
}
}
void LCDShield::setRect(int x0, int y0, int x1, int y1, unsigned char fill, int color)
{
// check if the rectangle is to be filled
if (fill == 1)
{
int xDiff;
if(x0 > x1)
xDiff = x0 - x1; //Find the difference between the x vars
else
xDiff = x1 - x0;
while(xDiff > 0)
{
setLine(x0, y0, x0, y1, color);
if(x0 > x1)
x0--;
else
x0++;
xDiff--;
}
}
else
{
// best way to draw an unfilled rectangle is to draw four lines
setLine(x0, y0, x1, y0, color);
setLine(x0, y1, x1, y1, color);
setLine(x0, y0, x0, y1, color);
setLine(x1, y0, x1, y1, color);
}
}
void LCDShield::printLogo(void)
{
int x = 4, y = 25, logo_ix = 0, z;
char logo;
for (logo_ix = 0; logo_ix < 1120; logo_ix++)
{
logo = logo_spark[logo_ix];
for (z = 0; z < 8; z++)
{
if ((logo & 0x80) == 0x80) setPixel(RED, y, x);
x++;
if (x == 132)
{
x = 4;
y++;
}
logo <<= 1;
}
}
}
void LCDShield::off(void)
{
if (driver) // If it's an epson
LCDCommand(DISOFF);
else // otherwise it's a phillips
LCDCommand(DISPOFF);
}
void LCDShield::on(void)
{
if (driver) // If it's an epson
LCDCommand(DISON);
else // otherwise it's a phillips
LCDCommand(DISPON);
}

View file

@ -1,384 +0,0 @@
/*
ColorLCDShield.h - Arduino Library to control a Nokia 6100 LCD,
specifically that found on SparkFun's Color LCD Shield.
This code should work for both Epson and Phillips display drivers
normally found on the Color LCD Shield.
License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free
to use and abuse this code however you'd like. If you find it useful
please attribute, and SHARE-ALIKE!
This is based on code by Mark Sproul, and Peter Davenport.
*/
#ifndef ColorLCDShield_H
#define ColorLCDShield_H
#define PHILLIPS 0
#define PHILIPS 0
#define EPSON 1
//#include <WProgram.h>
#include <inttypes.h>
//*******************************************************
// Macros
//*******************************************************
#define sbi(var, mask) ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask))
//********************************************************************
//
// LCD Dimension Definitions
//
//********************************************************************
#define ROW_LENGTH 132
#define COL_HEIGHT 132
#define ENDPAGE 132
#define ENDCOL 130
//********************************************************************
//
// EPSON Controller Definitions
//
//********************************************************************
#define DISON 0xAF // Display on
#define DISOFF 0xAE // Display off
#define DISNOR 0xA6 // Normal display
#define DISINV 0xA7 // Inverse display
#define SLPIN 0x95 // Sleep in
#define SLPOUT 0x94 // Sleep out
#define COMSCN 0xBB // Common scan direction
#define DISCTL 0xCA // Display control
#define PASET 0x75 // Page address set
#define CASET 0x15 // Column address set
#define DATCTL 0xBC // Data scan direction, etc.
#define RGBSET8 0xCE // 256-color position set
#define RAMWR 0x5C // Writing to memory
#define RAMRD 0x5D // Reading from memory
#define PTLIN 0xA8 // Partial display in
#define PTLOUT 0xA9 // Partial display out
#define RMWIN 0xE0 // Read and modify write
#define RMWOUT 0xEE // End
#define ASCSET 0xAA // Area scroll set
#define SCSTART 0xAB // Scroll start set
#define OSCON 0xD1 // Internal oscillation on
#define OSCOFF 0xD2 // Internal osciallation off
#define PWRCTR 0x20 // Power control
#define VOLCTR 0x81 // Electronic volume control
#define VOLUP 0xD6 // Increment electronic control by 1
#define VOLDOWN 0xD7 // Decrement electronic control by 1
#define TMPGRD 0x82 // Temperature gradient set
#define EPCTIN 0xCD // Control EEPROM
#define EPCOUT 0xCC // Cancel EEPROM control
#define EPMWR 0xFC // Write into EEPROM
#define EPMRD 0xFD // Read from EEPROM
#define EPSRRD1 0x7C // Read register 1
#define EPSRRD2 0x7D // Read register 2
#define NOP 0x25 // No op
//********************************************************************
//
// PHILLIPS Controller Definitions
//
//********************************************************************
//LCD Commands
#define NOPP 0x00 // No operation
#define BSTRON 0x03 // Booster voltage on
#define SLEEPIN 0x10 // Sleep in
#define SLEEPOUT 0x11 // Sleep out
#define NORON 0x13 // Normal display mode on
#define INVOFF 0x20 // Display inversion off
#define INVON 0x21 // Display inversion on
#define SETCON 0x25 // Set contrast
#define DISPOFF 0x28 // Display off
#define DISPON 0x29 // Display on
#define CASETP 0x2A // Column address set
#define PASETP 0x2B // Page address set
#define RAMWRP 0x2C // Memory write
#define RGBSET 0x2D // Color set
#define MADCTL 0x36 // Memory data access control
#define COLMOD 0x3A // Interface pixel format
#define DISCTR 0xB9 // Super frame inversion
#define EC 0xC0 // Internal or external oscillator
//*******************************************************
// 12-Bit Color Definitions
//*******************************************************
#define BLACK 0x000
#define NAVY 0x008
#define BLUE 0x00F
#define TEAL 0x088
#define EMERALD 0x0C5
#define GREEN 0x0F0
#define CYAN 0x0FF
#define SLATE 0x244
#define INDIGO 0x408
#define TURQUOISE 0x4ED
#define OLIVE 0x682
#define MAROON 0x800
#define PURPLE 0x808
#define GRAY 0x888
#define SKYBLUE 0x8CE
#define BROWN 0xB22
#define CRIMSON 0xD13
#define ORCHID 0xD7D
#define RED 0xF00
#define MAGENTA 0xF0F
#define ORANGE 0xF40
#define PINK 0xF6A
#define CORAL 0xF75
#define SALMON 0xF87
#define GOLD 0xFD0
#define YELLOW 0xFF0
#define WHITE 0xFFF
//*******************************************************
// Circle Definitions
//*******************************************************
#define FILL 0
//******************************************************
// Arc Definitions
//******************************************************
#define ESE 1
#define ENE 2
#define WSW 3
#define WNW 4
#define SSE 5
#define NNE 6
#define SSW 7
#define NNW 8
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
//* Arduino Mega 2560 bit numbers
#define LCD_RES 5 // D8
#define CS 6 // D9
#define DIO 5 // D11
#define SCK_PIN 7 // D13
//* Arduino Mega ports
//* NOTE: See LCDShield::LCDShield() if making changes here
#define LCD_PORT_CS PORTH
#define LCD_PORT_SCK PORTB
#define LCD_PORT_RES PORTH
#define LCD_PORT_DIO PORTB
#elif defined (__AVR_ATmega32U4__)
//* Standard Arduino Leonardo port bits
#define LCD_RES 4 // D8
#define CS 5 // D9
#define DIO 7 // D11
#define SCK_PIN 7 // D13
//* Arduino Leonardo ports:
#define LCD_PORT_RES PORTB
#define LCD_PORT_CS PORTB
#define LCD_PORT_DIO PORTB
#define LCD_PORT_SCK PORTC
#else
//* Arduino Duemilanove bit numbers
#define LCD_RES 0 // D8
#define CS 1 // D9
#define DIO 3 // D11
#define SCK_PIN 5 // D13
//#define LCD_PORT PORTB
//* Arduino Duemilanove ports
#define LCD_PORT_CS PORTB
#define LCD_PORT_SCK PORTB
#define LCD_PORT_RES PORTB
#define LCD_PORT_DIO PORTB
#endif
const unsigned char FONT8x16[97][16] = {
{0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // columns, rows, bytes, ...
{0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // columns, rows, bytes, ...
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // ' '
{0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // '!'
{0x00,0x63,0x63,0x63,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '"'
{0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00}, // '#'
{0x0C,0x0C,0x3E,0x63,0x61,0x60,0x3E,0x03,0x03,0x43,0x63,0x3E,0x0C,0x0C,0x00,0x00}, // '$'
{0x00,0x00,0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x33,0x63,0x00,0x00,0x00,0x00}, // '%'
{0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00},
{0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x0C,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x42,0x66,0x3C,0xFF,0x3C,0x66,0x42,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00},
{0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x63,0x6B,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // '0'
{0x00,0x00,0x0C,0x1C,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x03,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x03,0x03,0x1E,0x03,0x03,0x03,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x06,0x0E,0x1E,0x36,0x66,0x66,0x7F,0x06,0x06,0x0F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x60,0x60,0x60,0x7E,0x03,0x03,0x63,0x73,0x3E,0x00,0x00,0x00,0x00}, // '5'
{0x00,0x00,0x1C,0x30,0x60,0x60,0x7E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x63,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3F,0x03,0x03,0x06,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // ':'
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00},
{0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x06,0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x6F,0x6B,0x6B,0x6E,0x60,0x60,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // 'A'
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x33,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1E,0x00,0x00,0x00,0x00}, // 'C'
{0x00,0x00,0x7C,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00},
{0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x6F,0x63,0x63,0x37,0x1D,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // 'H'
{0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x0F,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x73,0x33,0x36,0x36,0x3C,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00},
{0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x77,0x7F,0x6B,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x63,0x00,0x00,0x00,0x00},
{0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x6B,0x6F,0x3E,0x06,0x07,0x00,0x00},
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3E,0x63,0x63,0x30,0x1C,0x06,0x03,0x63,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,0x00,0x00},
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x36,0x00,0x00,0x00,0x00},
{0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00},
{0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x63,0x43,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00}, // 'Z'
{0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x00}, // '\'
{0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00},
{0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00}, // '^'
{0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3C,0x46,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // '_'
{0x00,0x00,0x70,0x30,0x30,0x3C,0x36,0x33,0x33,0x33,0x33,0x6E,0x00,0x00,0x00,0x00}, // '`'
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00,0x00}, // 'a'
{0x00,0x00,0x0E,0x06,0x06,0x1E,0x36,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x7E,0x60,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x1C,0x36,0x32,0x30,0x7C,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00},
{0x00,0x00,0x70,0x30,0x30,0x36,0x3B,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00},
{0x00,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00},
{0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3C,0x36,0x33,0x73,0x00,0x00,0x00,0x00},
{0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x6E,0x7F,0x6B,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x78,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x38,0x0E,0x03,0x63,0x3E,0x00,0x00,0x00,0x00},
{0x00,0x00,0x08,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x1B,0x0E,0x00,0x00,0x00,0x00}, // 't'
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x36,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x63,0x36,0x1C,0x1C,0x1C,0x36,0x63,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x7F,0x66,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00}, // 'z'
{0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00}, // '{'
{0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00}, // '|'
{0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00}, // '}'
{0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // '~'
};
static char logo_spark[1120] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x20,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0f,0xe0,0x9f,0x01,0xfc,0x09,0x9e,0x1e,0x7f,0x70,0x73,0x9f,0x00,0x00,0x00,0x00,
0x3f,0xf1,0xff,0x87,0xfe,0x3f,0xde,0x3d,0xff,0x78,0xf3,0xff,0x80,0x00,0x00,0x00,
0x3c,0xf9,0xff,0xc7,0xdf,0x3f,0xde,0x79,0xff,0x78,0xf3,0xff,0xc0,0x00,0x00,0x00,
0x78,0x79,0xc3,0xcf,0x0f,0x3f,0x1c,0xf0,0x3c,0x78,0xf3,0xe3,0xc0,0x00,0x00,0x00,
0x7c,0x01,0xc1,0xe0,0x0f,0x3e,0x1f,0xe0,0x3c,0x78,0xf3,0xc3,0xc0,0x00,0x00,0x00,
0x3f,0xc1,0x81,0xe0,0x3f,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x1f,0xf1,0x81,0xe3,0xff,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x07,0xf9,0x81,0xe7,0xef,0x3c,0x1f,0xf0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x00,0xf9,0x81,0xef,0x07,0x3c,0x1e,0xf8,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x78,0x79,0xc1,0xef,0x0f,0x3c,0x1e,0x78,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x78,0x79,0xe3,0xcf,0x0f,0x3c,0x1e,0x3c,0x3c,0x7c,0xf3,0xc1,0xc0,0x00,0x00,0x00,
0x3f,0xf9,0xff,0xcf,0xff,0x3c,0x1e,0x3e,0x3c,0x7f,0xf3,0xc1,0xcf,0x00,0x00,0x00,
0x1f,0xf1,0xff,0x87,0xff,0x3c,0x1e,0x1e,0x3c,0x3f,0xf3,0xc1,0xc7,0x00,0x00,0x00,
0x07,0xc1,0x9e,0x03,0xe0,0x00,0x00,0x02,0x00,0x0e,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0x80,0x00,0x00,0x00,0xc0,0x00,0x00,0x18,0x00,0x00,0x08,0x08,0x00,0x00,
0x00,0x01,0x87,0xc3,0x03,0xe0,0xe1,0xf0,0xf8,0x3e,0x33,0x08,0x3e,0x1e,0x00,0x00,
0x00,0x01,0x86,0x03,0x03,0x01,0xb0,0xe0,0xdc,0x66,0x3b,0x08,0x66,0x32,0x00,0x00,
0x00,0x00,0x87,0xc3,0x03,0xe1,0x80,0x40,0xd8,0x63,0x3b,0x08,0x60,0x3c,0x00,0x00,
0x00,0x00,0x87,0x83,0x03,0xc1,0x80,0x40,0xf8,0x63,0x3f,0x08,0x60,0x0e,0x00,0x00,
0x00,0x00,0x06,0x03,0x03,0x01,0xb0,0x40,0xd8,0x66,0x37,0x08,0x66,0x32,0x00,0x00,
0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0xc8,0x3e,0x33,0x08,0x3e,0x3e,0x00,0x00,
0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0x88,0x3c,0x33,0x08,0x3c,0x1e,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
class LCDShield
{
private:
void LCDCommand(unsigned char data);
void LCDData(unsigned char data);
uint8_t driver;
uint16_t swapColors(uint16_t in);
public:
LCDShield();
void init(int type, bool colorSwap = 0);
void clear(int color);
void contrast(char setting);
void setPixel(int color, unsigned char x, unsigned char y);
void setCircle (int x0, int y0, int radius, int color, int lineThickness = 1);
void setArc(int x0, int y0, int radius, int segments[], int numSegments, int lineThickness, int color);
void setChar(char c, int x, int y, int fColor, int bColor);
void setStr(char *pString, int x, int y, int fColor, int bColor);
void setLine(int x0, int y0, int x1, int y1, int color);
void setRect(int x0, int y0, int x1, int y1, unsigned char fill, int color);
void printLogo(void);
void on(void);
void off(void);
};
#endif // ColorLCDShield_H

View file

@ -1,28 +0,0 @@
#######################################
# Syntax Coloring Map For Twitter
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
LCDShield KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
init KEYWORD2
clear KEYWORD2
contrast KEYWORD2
setPixel KEYWORD2
setChar KEYWORD2
setStr KEYWORD2
setLine KEYWORD2
setRect KEYWORD2
setCircle KEYWORD2
setArc KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################

View file

@ -1,73 +0,0 @@
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "Metro.h"
Metro::Metro(unsigned long interval_millis)
{
this->autoreset = 0;
interval(interval_millis);
reset();
}
// New creator so I can use either the original check behavior or benjamin.soelberg's
// suggested one (see below).
// autoreset = 0 is benjamin.soelberg's check behavior
// autoreset != 0 is the original behavior
Metro::Metro(unsigned long interval_millis, uint8_t autoreset)
{
this->autoreset = autoreset; // Fix by Paul Bouchier
interval(interval_millis);
reset();
}
void Metro::interval(unsigned long interval_millis)
{
this->interval_millis = interval_millis;
}
// Benjamin.soelberg's check behavior:
// When a check is true, add the interval to the internal counter.
// This should guarantee a better overall stability.
// Original check behavior:
// When a check is true, add the interval to the current millis() counter.
// This method can add a certain offset over time.
char Metro::check()
{
if (millis() - this->previous_millis >= this->interval_millis) {
// As suggested by benjamin.soelberg@gmail.com, the following line
// this->previous_millis = millis();
// was changed to
// this->previous_millis += this->interval_millis;
// If the interval is set to 0 we revert to the original behavior
if (this->interval_millis <= 0 || this->autoreset ) {
this->previous_millis = millis();
} else {
this->previous_millis += this->interval_millis;
}
return 1;
}
return 0;
}
void Metro::reset()
{
this->previous_millis = millis();
}

View file

@ -1,26 +0,0 @@
#ifndef Metro_h
#define Metro_h
#include <inttypes.h>
class Metro
{
public:
Metro(unsigned long interval_millis);
Metro(unsigned long interval_millis, uint8_t autoreset);
void interval(unsigned long interval_millis);
char check();
void reset();
private:
uint8_t autoreset;
unsigned long previous_millis, interval_millis;
};
#endif

Binary file not shown.

View file

@ -1,7 +0,0 @@
VERSION 2.3.2
¥ Added this->autoreset = 0; to Metro(unsigned long interval_millis) as suggested by Paul Bouchier
VERSION 2.3.1
¥ Updated for Arduino 1.0

View file

@ -1,36 +0,0 @@
/*
This code will blink an LED attached to pin 13 on and off.
It will stay on for 0.25 seconds.
It will stay off for 1 second.
*/
#include <Metro.h> //Include Metro library
#define LED 13 // Define the led's pin
//Create a variable to hold theled's current state
int state = HIGH;
// Instanciate a metro object and set the interval to 250 milliseconds (0.25 seconds).
Metro ledMetro = Metro(250);
void setup()
{
pinMode(LED,OUTPUT);
digitalWrite(LED,state);
}
void loop()
{
if (ledMetro.check() == 1) { // check if the metro has passed its interval .
if (state==HIGH) {
state=LOW;
ledMetro.interval(250); // if the pin is HIGH, set the interval to 0.25 seconds.
}
else {
ledMetro.interval(1000); // if the pin is LOW, set the interval to 1 second.
state=HIGH;
}
digitalWrite(LED,state);
}
}

View file

@ -1,51 +0,0 @@
// This code will blink output 13 every 250 ms
// abd will blink output 9 every 125 ms
#include <Metro.h> // Include Metro library
#define LED0 13 // Define a LED pin
#define LED1 9 // Define another LED pin
// Create variables to hold the LED states
int state0 = HIGH;
int state1 = HIGH;
// Instantiate a metro object and set the interval to 250 milliseconds (0.25 seconds).
Metro metro0 = Metro(500);
// Instantiate another metro object and set the interval to 125 milliseconds (0.125 seconds).
Metro metro1 = Metro(125);
void setup()
{
pinMode(LED0,OUTPUT);
digitalWrite(LED0,state0);
pinMode(LED1,OUTPUT);
digitalWrite(LED1,state1);
}
void loop()
{
if (metro0.check() == 1) { // check if the metro has passed its interval .
if (state0==HIGH) {
state0=LOW;
} else {
state0=HIGH;
}
digitalWrite(LED0,state0);
}
if (metro1.check() == 1) { // check if the metro has passed its interval .
if (state1==HIGH) {
state1=LOW;
} else {
state1=HIGH;
}
digitalWrite(LED1,state1);
}
}

View file

@ -1,24 +0,0 @@
// This example sends a Serial message every 250 milliseconds
#include <Metro.h> // Include the Metro library
Metro serialMetro = Metro(250); // Instantiate an instance
void setup() {
Serial.begin(115200); // Start the Serial communication
}
void loop() {
if (serialMetro.check() == 1) { // check if the metro has passed it's interval .
// Output all the analog readings seperated by a space character
for (int i = 0; i < 6; i++ ) {
Serial.print (analogRead( i) );
Serial.print(32,BYTE);
}
// Terminate message with a linefeed and a carriage return
Serial.print(13,BYTE);
Serial.print(10,BYTE);
}
}

View file

@ -0,0 +1,240 @@
// Code by JeeLabs http://news.jeelabs.org/code/
// Released to the public domain! Enjoy!
#include <Wire.h>
#include <avr/pgmspace.h>
#include "RTClib.h"
#define DS1307_ADDRESS 0x68
#define SECONDS_PER_DAY 86400L
#define SECONDS_FROM_1970_TO_2000 946684800
#if (ARDUINO >= 100)
#include <Arduino.h> // capital A so it is error prone on case-sensitive filesystems
#else
#include <WProgram.h>
#endif
int i = 0; //The new wire library needs to take an int when you are sending for the zero register
////////////////////////////////////////////////////////////////////////////////
// utility code, some of this could be exposed in the DateTime API if needed
const uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 }; //has to be const or compiler compaints
// number of days since 2000/01/01, valid for 2001..2099
static uint16_t date2days(uint16_t y, uint8_t m, uint8_t d) {
if (y >= 2000)
y -= 2000;
uint16_t days = d;
for (uint8_t i = 1; i < m; ++i)
days += pgm_read_byte(daysInMonth + i - 1);
if (m > 2 && y % 4 == 0)
++days;
return days + 365 * y + (y + 3) / 4 - 1;
}
static long time2long(uint16_t days, uint8_t h, uint8_t m, uint8_t s) {
return ((days * 24L + h) * 60 + m) * 60 + s;
}
////////////////////////////////////////////////////////////////////////////////
// DateTime implementation - ignores time zones and DST changes
// NOTE: also ignores leap seconds, see http://en.wikipedia.org/wiki/Leap_second
DateTime::DateTime (uint32_t t) {
t -= SECONDS_FROM_1970_TO_2000; // bring to 2000 timestamp from 1970
ss = t % 60;
t /= 60;
mm = t % 60;
t /= 60;
hh = t % 24;
uint16_t days = t / 24;
uint8_t leap;
for (yOff = 0; ; ++yOff) {
leap = yOff % 4 == 0;
if (days < 365 + leap)
break;
days -= 365 + leap;
}
for (m = 1; ; ++m) {
uint8_t daysPerMonth = pgm_read_byte(daysInMonth + m - 1);
if (leap && m == 2)
++daysPerMonth;
if (days < daysPerMonth)
break;
days -= daysPerMonth;
}
d = days + 1;
}
DateTime::DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec) {
if (year >= 2000)
year -= 2000;
yOff = year;
m = month;
d = day;
hh = hour;
mm = min;
ss = sec;
}
static uint8_t conv2d(const char* p) {
uint8_t v = 0;
if ('0' <= *p && *p <= '9')
v = *p - '0';
return 10 * v + *++p - '0';
}
// A convenient constructor for using "the compiler's time":
// DateTime now (__DATE__, __TIME__);
// NOTE: using PSTR would further reduce the RAM footprint
DateTime::DateTime (const char* date, const char* time) {
// sample input: date = "Dec 26 2009", time = "12:34:56"
yOff = conv2d(date + 9);
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
switch (date[0]) {
case 'J': m = date[1] == 'a' ? 1 : m = date[2] == 'n' ? 6 : 7; break;
case 'F': m = 2; break;
case 'A': m = date[2] == 'r' ? 4 : 8; break;
case 'M': m = date[2] == 'r' ? 3 : 5; break;
case 'S': m = 9; break;
case 'O': m = 10; break;
case 'N': m = 11; break;
case 'D': m = 12; break;
}
d = conv2d(date + 4);
hh = conv2d(time);
mm = conv2d(time + 3);
ss = conv2d(time + 6);
}
uint8_t DateTime::dayOfWeek() const {
uint16_t day = date2days(yOff, m, d);
return (day + 6) % 7; // Jan 1, 2000 is a Saturday, i.e. returns 6
}
uint32_t DateTime::unixtime(void) const {
uint32_t t;
uint16_t days = date2days(yOff, m, d);
t = time2long(days, hh, mm, ss);
t += SECONDS_FROM_1970_TO_2000; // seconds from 1970 to 2000
return t;
}
////////////////////////////////////////////////////////////////////////////////
// RTC_DS1307 implementation
static uint8_t bcd2bin (uint8_t val) { return val - 6 * (val >> 4); }
static uint8_t bin2bcd (uint8_t val) { return val + 6 * (val / 10); }
uint8_t RTC_DS1307::begin(void) {
return 1;
}
#if (ARDUINO >= 100)
uint8_t RTC_DS1307::isrunning(void) {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(i);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 1);
uint8_t ss = Wire.read();
return !(ss>>7);
}
void RTC_DS1307::adjust(const DateTime& dt) {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(i);
Wire.write(bin2bcd(dt.second()));
Wire.write(bin2bcd(dt.minute()));
Wire.write(bin2bcd(dt.hour()));
Wire.write(bin2bcd(0));
Wire.write(bin2bcd(dt.day()));
Wire.write(bin2bcd(dt.month()));
Wire.write(bin2bcd(dt.year() - 2000));
Wire.write(i);
Wire.endTransmission();
}
DateTime RTC_DS1307::now() {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(i);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 7);
uint8_t ss = bcd2bin(Wire.read() & 0x7F);
uint8_t mm = bcd2bin(Wire.read());
uint8_t hh = bcd2bin(Wire.read());
Wire.read();
uint8_t d = bcd2bin(Wire.read());
uint8_t m = bcd2bin(Wire.read());
uint16_t y = bcd2bin(Wire.read()) + 2000;
return DateTime (y, m, d, hh, mm, ss);
}
#else
uint8_t RTC_DS1307::isrunning(void) {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.send(i);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 1);
uint8_t ss = Wire.receive();
return !(ss>>7);
}
void RTC_DS1307::adjust(const DateTime& dt) {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.send(i);
Wire.send(bin2bcd(dt.second()));
Wire.send(bin2bcd(dt.minute()));
Wire.send(bin2bcd(dt.hour()));
Wire.send(bin2bcd(0));
Wire.send(bin2bcd(dt.day()));
Wire.send(bin2bcd(dt.month()));
Wire.send(bin2bcd(dt.year() - 2000));
Wire.send(i);
Wire.endTransmission();
}
DateTime RTC_DS1307::now() {
Wire.beginTransmission(DS1307_ADDRESS);
Wire.send(i);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 7);
uint8_t ss = bcd2bin(Wire.receive() & 0x7F);
uint8_t mm = bcd2bin(Wire.receive());
uint8_t hh = bcd2bin(Wire.receive());
Wire.receive();
uint8_t d = bcd2bin(Wire.receive());
uint8_t m = bcd2bin(Wire.receive());
uint16_t y = bcd2bin(Wire.receive()) + 2000;
return DateTime (y, m, d, hh, mm, ss);
}
#endif
////////////////////////////////////////////////////////////////////////////////
// RTC_Millis implementation
long RTC_Millis::offset = 0;
void RTC_Millis::adjust(const DateTime& dt) {
offset = dt.unixtime() - millis() / 1000;
}
DateTime RTC_Millis::now() {
return (uint32_t)(offset + millis() / 1000);
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,47 @@
// Code by JeeLabs http://news.jeelabs.org/code/
// Released to the public domain! Enjoy!
// Simple general-purpose date/time class (no TZ / DST / leap second handling!)
class DateTime {
public:
DateTime (uint32_t t =0);
DateTime (uint16_t year, uint8_t month, uint8_t day,
uint8_t hour =0, uint8_t min =0, uint8_t sec =0);
DateTime (const char* date, const char* time);
uint16_t year() const { return 2000 + yOff; }
uint8_t month() const { return m; }
uint8_t day() const { return d; }
uint8_t hour() const { return hh; }
uint8_t minute() const { return mm; }
uint8_t second() const { return ss; }
uint8_t dayOfWeek() const;
// 32-bit times as seconds since 1/1/2000
long secondstime() const;
// 32-bit times as seconds since 1/1/1970
uint32_t unixtime(void) const;
protected:
uint8_t yOff, m, d, hh, mm, ss;
};
// RTC based on the DS1307 chip connected via I2C and the Wire library
class RTC_DS1307 {
public:
static uint8_t begin(void);
static void adjust(const DateTime& dt);
uint8_t isrunning(void);
static DateTime now();
};
// RTC using the internal millis() clock, has to be initialized before use
// NOTE: this clock won't be correct once the millis() timer rolls over (>49d?)
class RTC_Millis {
public:
static void begin(const DateTime& dt) { adjust(dt); }
static void adjust(const DateTime& dt);
static DateTime now();
protected:
static long offset;
};

View file

@ -1,23 +1,32 @@
#######################################
# Syntax Coloring Map For Test
# Syntax Coloring Map For RTC
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
Metro KEYWORD1
DateTime KEYWORD1
RTC_DS1307 KEYWORD1
RTC_Millis KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
check KEYWORD2
interval KEYWORD2
#######################################
# Instances (KEYWORD2)
#######################################
year KEYWORD2
month KEYWORD2
day KEYWORD2
hour KEYWORD2
minute KEYWORD2
second KEYWORD2
dayOfWeek KEYWORD2
secondstime KEYWORD2
unixtime KEYWORD2
begin KEYWORD2
adjust KEYWORD2
isrunning KEYWORD2
now KEYWORD2
#######################################
# Constants (LITERAL1)

View file

@ -1,73 +0,0 @@
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "Metro.h"
Metro::Metro(unsigned long interval_millis)
{
this->autoreset = 0;
interval(interval_millis);
reset();
}
// New creator so I can use either the original check behavior or benjamin.soelberg's
// suggested one (see below).
// autoreset = 0 is benjamin.soelberg's check behavior
// autoreset != 0 is the original behavior
Metro::Metro(unsigned long interval_millis, uint8_t autoreset)
{
this->autoreset = autoreset; // Fix by Paul Bouchier
interval(interval_millis);
reset();
}
void Metro::interval(unsigned long interval_millis)
{
this->interval_millis = interval_millis;
}
// Benjamin.soelberg's check behavior:
// When a check is true, add the interval to the internal counter.
// This should guarantee a better overall stability.
// Original check behavior:
// When a check is true, add the interval to the current millis() counter.
// This method can add a certain offset over time.
char Metro::check()
{
if (millis() - this->previous_millis >= this->interval_millis) {
// As suggested by benjamin.soelberg@gmail.com, the following line
// this->previous_millis = millis();
// was changed to
// this->previous_millis += this->interval_millis;
// If the interval is set to 0 we revert to the original behavior
if (this->interval_millis <= 0 || this->autoreset ) {
this->previous_millis = millis();
} else {
this->previous_millis += this->interval_millis;
}
return 1;
}
return 0;
}
void Metro::reset()
{
this->previous_millis = millis();
}

View file

@ -1,26 +0,0 @@
#ifndef Metro_h
#define Metro_h
#include <inttypes.h>
class Metro
{
public:
Metro(unsigned long interval_millis);
Metro(unsigned long interval_millis, uint8_t autoreset);
void interval(unsigned long interval_millis);
char check();
void reset();
private:
uint8_t autoreset;
unsigned long previous_millis, interval_millis;
};
#endif

View file

@ -1,160 +0,0 @@
/*
Serial Adapter Project: Dynamic serial TTY passthroughs
by: Mike Crosson
Nusku Networks
date: 2013/03/09
license: CC-BY SA 3.0 - Creative commons share-alike 3.0
use this code however you'd like, just keep this license and
attribute.
*/
#include <Arduino.h>
#include "Project.h"
#include "UI.h"
// Figure out offsets for text printing
int xLoc(float toSkip) { // Physically -- vertical
return (CHAR_HEIGHT * toSkip) + (CHAR_HEIGHT / 2);
}
int yLoc (float toSkip) { // Physical -- horizontal
return (CHAR_WIDTH * toSkip) + (CHAR_WIDTH / 2);
}
void setLineSpeed(linespeed aLineSpeed) {
if (aLineSpeed >= maxlinespeed) {
currentLineSpeed = (linespeed)0;
}
else {
currentLineSpeed = aLineSpeed;
}
bool sel = selectedMode == modelinespeed ? true : false;
printLineSpeed(currentLineSpeed, sel);
}
void setMode(serialmode aMode) {
if (aMode != modelinespeed) {
serialmode previousMode = currentMode;
currentMode = aMode;
lcd.setStr(" ", xLoc(previousMode), yLoc(0), TEXT, BACKGROUND);
lcd.setStr("*", xLoc(currentMode), yLoc(0), TEXT, BACKGROUND);
}
else {
setLineSpeed((linespeed)(currentLineSpeed + 1));
}
}
void setSelection(serialmode aMode) {
serialmode previousSelection = selectedMode;
selectedMode = aMode;
int yLocOne = yLoc(1);
int xSelected = 0;
if (selectedMode != modelinespeed) {
xSelected = xLoc(selectedMode) + CHAR_HEIGHT;
}
int xPrevious = 0;
if (previousSelection != modelinespeed) {
xPrevious = xLoc(previousSelection) + CHAR_HEIGHT;
}
int previousLength = 0;
if (previousSelection != modelinespeed) {
previousLength = strlen(modeToText[previousSelection]) * CHAR_WIDTH;
}
int selectedLength = 0;
if (selectedMode != modelinespeed) {
selectedLength = strlen(modeToText[selectedMode]) * CHAR_WIDTH;
}
if (selectedMode != modelinespeed) {
lcd.setLine(xSelected, yLocOne, xSelected, yLocOne + selectedLength, HILIGHT);
}
else {
printLineSpeed(currentLineSpeed, true);
}
if (previousSelection != modelinespeed) {
lcd.setLine(xPrevious, yLocOne, xPrevious, yLocOne + previousLength, BACKGROUND);
}
else {
printLineSpeed(currentLineSpeed, false);
}
}
void printTitles() {
lcd.setStr(" RX Ln Spd Tx ", xLoc(5), 0, TEXT, BACKGROUND);
}
void printMode(serialmode aMode) {
lcd.setStr(modeToText[aMode], xLoc(aMode), yLoc(1), TEXT, BACKGROUND);
}
void printLineSpeed(linespeed aLineSpeed, bool selected) {
int xPosText = xLoc(6);
int yPosText = yLoc(5);
int xPosLine = xLoc(7);
int yPosLine = yLoc(5);
char* toPrint = linespeeds[aLineSpeed].description;
int length = strlen(toPrint);
lcd.setStr(" ", xPosText, yPosText, BACKGROUND, BACKGROUND);
lcd.setLine(xPosLine, yPosLine, xPosLine, yPosLine + 7 * CHAR_WIDTH, BACKGROUND);
lcd.setStr(toPrint, xPosText, yPosText, TEXT, BACKGROUND);
if (selected) {
lcd.setLine(xPosLine, yPosLine, xPosLine, yPosLine + length * CHAR_WIDTH, HILIGHT);
}
}
void printRx(bool show) {
int vertXPosStart = xLoc(6.25);
int vertYPosStart = yLoc(1.5);
int vertXPosEnd = xLoc(7.25);
int vertYPosEnd = yLoc(1.5);
int lftXPosStart = vertXPosEnd;
int lftYPosStart = vertYPosStart;
int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2);
int lftYPosEnd = vertYPosStart - CHAR_WIDTH;
int rtXPosStart = vertXPosEnd;
int rtYPosStart = vertYPosStart;
int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2);
int rtYPosEnd = vertYPosStart + CHAR_WIDTH;
int color = show ? EMERALD : BACKGROUND;
lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color);
lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color);
lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color);
}
void printTx(bool show) {
int vertXPosStart = xLoc(6.25);
int vertYPosStart = yLoc(13.5);
int vertXPosEnd = xLoc(7.25);
int vertYPosEnd = yLoc(13.5);
int lftXPosStart = vertXPosStart;
int lftYPosStart = vertYPosStart;
int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2);
int lftYPosEnd = vertYPosStart - CHAR_WIDTH;
int rtXPosStart = vertXPosStart;
int rtYPosStart = vertYPosStart;
int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2);
int rtYPosEnd = vertYPosStart + CHAR_WIDTH;
int color = show ? SKYBLUE : BACKGROUND;
lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color);
lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color);
lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color);
}

View file

@ -1,27 +0,0 @@
/*
Serial Adapter Project: Dynamic serial TTY passthroughs
by: Mike Crosson
Nusku Networks
date: 2013/03/09
license: CC-BY SA 3.0 - Creative commons share-alike 3.0
use this code however you'd like, just keep this license and
attribute.
*/
// Font sizes
#define CHAR_WIDTH 8
#define CHAR_HEIGHT 16
void setLineSpeed(linespeed aLineSpeed);
void setMode(serialmode aMode);
void setSelection(serialmode aMode);
void printTitles();
void printMode(serialmode aMode);
void printLineSpeed(linespeed aLineSpeed, bool selected);
void printRx(bool show);
void printTx(bool show);
int xLoc(float toSkip);
int yLoc (float toSkip);