diff --git a/cores/touchStealth/MessageScroller.cpp b/cores/touchStealth/MessageScroller.cpp new file mode 100644 index 0000000..f0efe26 --- /dev/null +++ b/cores/touchStealth/MessageScroller.cpp @@ -0,0 +1,81 @@ +#include +#include + +#include "MessageScroller.h" +#include "Oled.h" +#include "oled_stealth.h" +//#include "LcdConstants.h" +//#include "lcd.h" +#include "Colors.h" + +#define BUFFER_SIZE 25 +//#define TOP_MARGIN 3 +#define SIDE_MARGIN 3 +#define LINE_PADDING 2 +#define LINE_HEIGHT FONT_HEIGHT+LINE_PADDING + + +MessageScroller::MessageScroller(Oled* oled, COLOR* textColor, COLOR* bgColor) { + usedLines = 0; + this->textColor = textColor; + this->bgColor = bgColor; + this->oled = oled; + offset = 0; +} + +void MessageScroller::AddText(char* text) { + if(LCD_ROWS - usedLines <= LINE_HEIGHT ) { + ScrollScreen(LINE_HEIGHT - (LCD_ROWS-usedLines)); + } + oled->DrawString(text, SIDE_MARGIN, + convertY(usedLines), textColor, bgColor); + usedLines += LINE_HEIGHT; +} + +int MessageScroller::convertY(int y) { + int temp = y + offset; + if(temp >= LCD_ROWS) + return temp - LCD_ROWS; + else + return temp; +} + +void wait(long length) { + for(long i = 0; i < length; i++) { + asm("nop"); +}} + +void MessageScroller::ScrollScreen(int rows) { + int temp = offset + rows; + + if(temp >= LCD_ROWS) { // we must be spanning the boundary + temp -= LCD_ROWS; + //lcd_clear(0, offset, LCD_COLUMNS - 1, LCD_ROWS - 1, &BLACK); + //lcd_clear(0, 0, LCD_COLUMNS - 1, temp - 1, &BLACK); + oled->ClearRegion(0, offset, LCD_COLUMNS - 1, LCD_ROWS - 1); + wait(500); + if(temp > 0) + oled->ClearRegion(0, 0, LCD_COLUMNS - 1, temp - 1); + wait(500); + } else { + oled->ClearRegion(0, offset, LCD_COLUMNS - 1, temp - 1); + wait(500); + } + usedLines -= rows; + offset = temp; + oled->SetDisplayStartLine(offset); + return; +} + +void MessageScroller::AddFormattedText(char* format, ...) { + static char msg_buffer[BUFFER_SIZE]; + + va_list argList; + va_start(argList, format); + + vsprintf((char*)&msg_buffer, format, argList); + + va_end(argList); + + AddText(msg_buffer); +} \ No newline at end of file diff --git a/cores/touchStealth/MessageScroller.h b/cores/touchStealth/MessageScroller.h new file mode 100644 index 0000000..2af0b97 --- /dev/null +++ b/cores/touchStealth/MessageScroller.h @@ -0,0 +1,25 @@ +#ifndef MESSAGE_SCROLLER_H +#define MESSAGE_SCROLLER_H + +//#include "DataTypes.h" +#include "graphics.h" +#include "Oled.h" +#include "oled_stealth.h" + +class MessageScroller { + private: + int usedLines; + int offset; + COLOR* textColor; + COLOR* bgColor; + Oled* oled; + int convertY(int y) ; + public: + MessageScroller(Oled* oled, COLOR* textColor, COLOR* bgColor); + void AddFormattedText(char* format, ...); + void AddText(char* text); + void ScrollScreen(int rows); +}; + + +#endif \ No newline at end of file diff --git a/cores/touchStealth/Oled.cpp b/cores/touchStealth/Oled.cpp new file mode 100644 index 0000000..dac40c7 --- /dev/null +++ b/cores/touchStealth/Oled.cpp @@ -0,0 +1,500 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "Oled.h" +#include "bitops.h" +#include "binary.h" +#include "font.h" + +// commands +#define COMM_SET_COLUMN 0x15 +#define COMM_SET_ROW 0x75 +#define COMM_WRITE_RAM 0x5C +#define COMM_READ_RAM 0x5D +#define COMM_REMAP_COLOR_DEPTH 0xA0 +#define COMM_SET_DISPLAY_LINE 0xA1 +#define COMM_SET_DISPLAY_OFFSET 0xA2 +#define COMM_DISP_OFF 0xA4 +#define COMM_DISP_ON 0xA5 +#define COMM_DISP_RESET 0xA6 +#define COMM_DISP_INV 0xA7 +#define COMM_MASTER_CONFIG 0xAD +#define COMM_SLEEP_ON 0xAE +#define COMM_SLEEP_OFF 0xAF +#define COMM_SET_POWER_SAVE 0xB0 +#define COMM_SET_PHASE_PER 0xB1 +#define COMM_SET_FREQ 0xB3 +#define COMM_SET_GS_TABLE 0xB8 +#define COMM_GS_RESET 0xB9 +#define COMM_SET_COLOR_PRECHARGE 0xBB +#define COMM_SET_V_COMH 0xBE +#define COMM_SET_CLR_CONTRAST 0xC1 +#define COMM_SET_MAST_CONTRAST 0xC7 +#define COMM_SET_MUX_RATIO 0xCA +#define COMM_NOP 0xE3 +#define COMM_SET_COMM_LOCK 0xFD +#define COMM_DRAW_LINE 0x83 +#define COMM_DRAW_RECT 0x84 +#define COMM_DRAW_CIRC 0x86 +#define COMM_COPY 0x8A +#define COMM_DIM 0x8C +#define COMM_CLEAR 0x8E +#define COMM_SET_FILL 0x92 +#define COMM_SET_HORZ_SCROLL 0x96 +#define COMM_START_SCROLL 0x9E +#define COMM_STOP_SCROLL 0x9F + +// settings +#define MUX_RATIO 0x7f +//#define REMAP_COLOR_DEPTH + +// batch writes don't work at the moment because of changes +// to the DrawChar method for writing across the VRAM boundary +#define BATCH_WRITES + +#define VERTICAL_INCREMENT 1 +#define COL_ADDR_INV 2 +#define COL_SEQ_INV 4 +#define BUS_ENABLE 8 +#define SCAN_REVERSE 16 +#define ENABLE_COM_SPLIT 32 +#define COLOR_256 0 +#define COLOR_65k 64 + + +// be careful with this macro. don't pass vars with ++/-- +#define MAX(a, b) (a > b ? a : b) +#define MIN(a, b) (a < b ? a : b) + + +Oled::Oled() { + initialized = 0; + //Initialize(); +} + +void Oled::WritePixel(COLOR* color) +{ + + WriteCommand(COMM_WRITE_RAM); //enable write RAM + + SETBIT(LCD_CTRL_PORT,LCD_DC); + //LCD_CTRL_PORT ^= (1 << LCD_CS) | (1 << LCD_WR); + CLRBIT(LCD_CTRL_PORT,LCD_CS); + CLRBIT(LCD_CTRL_PORT,LCD_WR); + + + LCD_DATA_HIGH = color->red; + LCD_DATA_MED = color->green; + LCD_DATA_LOW = color->blue; + + //LCD_CTRL_PORT ^= (1 << LCD_CS) | (1 << LCD_WR); + + SETBIT(LCD_CTRL_PORT,LCD_WR); + SETBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_DC); + +} + +void Oled::Initialize() { + if(!initialized) { + initialized = 1; + //set output values + SETBIT(LCD_CTRL_PORT,LCD_DC); + SETBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_WR); + SETBIT(LCD_CTRL_PORT,LCD_RD); + LCD_DATA_LOW = 0x00; + LCD_DATA_MED = 0x00; + LCD_DATA_HIGH = 0x00; + + //setup data direction registers + SETBIT(LCD_CTRL_DDR,LCD_DC); //output + SETBIT(LCD_CTRL_DDR,LCD_CS); //output + SETBIT(LCD_CTRL_DDR,LCD_WR); //output + SETBIT(LCD_CTRL_DDR,LCD_RD); //output + SETBIT(LCD_CTRL_DDR,LCD_RESET); //output + + LCD_DATA_LOW_DDR = 0xFF; //output + LCD_DATA_MED_DDR = 0xFF; //output + LCD_DATA_HIGH_DDR = 0xFF; //output + + //init the LCD + CLRBIT(LCD_CTRL_PORT,LCD_RESET); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + SETBIT(LCD_CTRL_PORT,LCD_RESET); + + WriteCommand(COMM_DISP_RESET); + + //WriteCommand(0xAE); //display off + WriteCommand(COMM_SLEEP_ON); + + WriteCommand(COMM_SET_MUX_RATIO); // Duty + WriteData(MUX_RATIO); // 1/128 + + //WriteCommand(0xA1); //Set display start line + //WriteData(0); //0x00 start + + //WriteCommand(0xA2); //Display offset + //WriteData(0x80); + + + WriteCommand(COMM_REMAP_COLOR_DEPTH); //Color Remap + WriteData(B10111100); //65k color, 18-bit + //WriteData(B01111100); + + WriteCommand(COMM_SET_MAST_CONTRAST); //Master current control + WriteData(0x0A); //0x07 Low Brightness + //0x0A Typical + //0x0E High Brightness + + + WriteCommand(COMM_SET_CLR_CONTRAST); //Contrast levels for R, G, B + WriteData(0x55); //Red + WriteData(0x52); //Green + WriteData(0xA1); //Blue + + + WriteCommand(COMM_SET_PHASE_PER); //Phase Adjust + WriteData(0x22); // + + WriteCommand(COMM_SET_FREQ); //Frame Rate + WriteData(0xF0); //85 Hz? + //WriteData(0x10); //85 Hz? + + WriteCommand(COMM_SET_COLOR_PRECHARGE); //Set Pre-carge level for R, G, B + WriteData(0x00); //Red + WriteData(0x00); //Green + WriteData(0x00); //Blue + + + WriteCommand(COMM_MASTER_CONFIG); //Master Config + WriteData(0x8E); // + + WriteCommand(COMM_SET_POWER_SAVE); //Current Saving + WriteData(0x00); // + + WriteCommand(COMM_SET_V_COMH); //VCOMH Setting + WriteData(0x1C); // + + //WriteCommand(0xA6); //Inverse Display mode off + //WriteCommand(0xD1); //Normal Display + //WriteData(0x02); // + + WriteCommand(COMM_SLEEP_OFF); //Display On + + WriteCommand(COMM_SET_FILL); + WriteData(1); + + + SETBIT(CHARGE_PUMP_DDR, CHARGE_PUMP_PIN); //turn on the charge pump + SETBIT(CHARGE_PUMP_PORT,CHARGE_PUMP_PIN); + + Clear(); + + } +} + +void Oled::Clear() { + WriteCommand(0x8E); + WriteData(0x0); + WriteData(0x0); + WriteData(0x20); + WriteData(0x20); + return; +unsigned int i=512; + COLOR c = {0,0,0}; + /* Set XY location */ + SetColumn(0, 127); + SetRow(0, 127); + + /* Enable write of gram */ + WriteCommand(COMM_WRITE_RAM); + + /* Clear the screen */ + SETBIT(LCD_CTRL_PORT,LCD_DC); + CLRBIT(LCD_CTRL_PORT,LCD_CS); + CLRBIT(LCD_CTRL_PORT,LCD_WR); + + + /* Set the color once */ + LCD_DATA_LOW = c.blue; + LCD_DATA_MED = c.green; + LCD_DATA_HIGH = c.red; + + /* Start the clocking of the WR pin */ + + while(i--) + { + /* Set & Clear */ + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + PING |= (1 << LCD_CS); PING |= (1 << LCD_CS); + } + + SETBIT(LCD_CTRL_PORT,LCD_CS); +} + +void Oled::WriteCommand(unsigned char command) { + CLRBIT(LCD_CTRL_PORT,LCD_DC); + CLRBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_RD); + CLRBIT(LCD_CTRL_PORT,LCD_WR); + + LCD_DATA_MED = command; + LCD_DATA_MED >>= 4; //shift right by four + LCD_DATA_LOW = command; + LCD_DATA_LOW <<= 2; //shift left by two + + SETBIT(LCD_CTRL_PORT,LCD_WR); + SETBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_DC); +} + +void Oled::WriteData(unsigned char data) { + SETBIT(LCD_CTRL_PORT,LCD_DC); + CLRBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_RD); + CLRBIT(LCD_CTRL_PORT,LCD_WR); + + LCD_DATA_MED = data; + LCD_DATA_MED >>= 4; //shift right by four + LCD_DATA_LOW = data; + LCD_DATA_LOW <<= 2; //shift left by two + + SETBIT(LCD_CTRL_PORT,LCD_WR); + SETBIT(LCD_CTRL_PORT,LCD_CS); + SETBIT(LCD_CTRL_PORT,LCD_DC); +} + +void Oled::DrawChar(unsigned char ch, int x_pos, int y_pos, COLOR* fc, COLOR* bc) { + unsigned int x,shifted,on_off,letter; + unsigned int row, byte; + unsigned int tempY; + letter=ch-(32); + letter=(letter*7); + unsigned char spanned = y_pos + FONT_HEIGHT > LCD_ROWS; + +#ifdef BATCH_WRITES + SetColumn(x_pos, x_pos + FONT_WIDTH - 1); + if(spanned) { + SetRow(y_pos, LCD_ROWS - 1); + } else { + SetRow(y_pos, y_pos + FONT_HEIGHT - 1); + } + +#endif + + char* pos = (char*)font_5x7+letter; + for (row=0;row LCD_ROWS - 1) { + SetRow(tempY - LCD_ROWS, tempY - LCD_ROWS); + } else { + SetRow(tempY ,tempY); //set row + } +#endif + + on_off = shifted & B10000000; + on_off = on_off>>7; + shifted = shifted << 1; + if (on_off > 0) + { + WritePixel(fc); //write the pixel + } + else + { + WritePixel(bc); //write the pixel + + } + + } + } +} + +void Oled::DrawString(char * string, unsigned int x_pos, unsigned int y_pos, COLOR* fc, COLOR* bc) { + + while(*string) + { + DrawChar(*string++,x_pos,y_pos,fc,bc); + x_pos=x_pos+6; + } +} + +void Oled::SetColumn(int start, int end) { + if (start < 0 ){ start = 0; } + if (start >= LCD_COLUMNS ){ start = LCD_COLUMNS - 1; } + if (end < 0){ end = 0;} + if (end >= LCD_COLUMNS){ end = LCD_COLUMNS - 1;} + + //set column (x) + WriteCommand(COMM_SET_COLUMN); + WriteData(start); + WriteData(end); +} + + +void Oled::SetRow(int start, int end) { + if (start < 0 ){ start = 0; } + if (start >= LCD_ROWS ){ start = LCD_ROWS - 1; } + if (end < 0){ end = 0;} + if (end >= LCD_ROWS){ end = LCD_ROWS - 1;} + + //set row (y) + WriteCommand(COMM_SET_ROW); + WriteData(start); + WriteData(end); +} + + +void Oled::SetDisplayStartLine(int line) { + WriteCommand(COMM_SET_DISPLAY_LINE); + WriteData(line); +} + +void Oled::SetDisplayOffset(int offset) { + WriteCommand(COMM_SET_DISPLAY_OFFSET); + WriteData(offset); +} + +void Oled::ClearRegion(LCD_RECT* region) { + WriteCommand(COMM_CLEAR); + WriteData(region->left); + WriteData(region->top); + WriteData(region->right); + WriteData(region->bottom); +} + +int FixArg(int arg) +{ + if(arg < 0) + return 0; + else if(arg > 128) + return 128; +} + + +void Oled::ClearRegion(unsigned char startColumn, unsigned char startRow, + unsigned char endColumn, unsigned char endRow) { + //SetColumn(startColumn, endColumn); + //SetRow(startRow, endRow); + + WriteCommand(COMM_CLEAR); + WriteData(startColumn); + WriteData(startRow); + WriteData(endColumn); + WriteData(endRow); + return; + + int sc = FixArg(startColumn); + int sr = FixArg(startRow); + int ec = FixArg(endColumn); + int er = FixArg(endRow); + + WriteCommand(COMM_CLEAR); + WriteData(0); + WriteData(MIN(sr, er)); + WriteData(127); + WriteData(MAX(sr, er)); + return; + + + + +} + +void Oled::CopyRegion(LCD_RECT* region, unsigned char destColumn, unsigned char destRow) { + WriteCommand(COMM_COPY); + WriteData(region->left); + WriteData(region->top); + WriteData(region->right); + WriteData(region->bottom); + WriteData(destColumn); + WriteData(destRow); +} + +void Oled::DrawLine(int startColumn, int startRow, int endColumn, int endRow, COLOR* color) { + WriteCommand(COMM_DRAW_LINE); + WriteData(startColumn); + WriteData(startRow); + WriteData(endColumn); + WriteData(endRow); + WriteData( (color->red & B11111000) | (color->green >> 5)); + WriteData( ((color->green<<3) & B11100000) | (color->blue>>3) ); +} + +void Oled::DrawRectangle(unsigned char startColumn, unsigned char startRow, + unsigned char endColumn, unsigned char endRow, COLOR* lineColor, COLOR* fillColor) { + lcd_write_C(0x84); + lcd_write_D(startColumn); + lcd_write_D(startRow); + lcd_write_D(endColumn); + lcd_write_D(endRow); + lcd_write_D( (lineColor->red & B11111000) | (lineColor->green >> 5)); + lcd_write_D( ((lineColor->green<<3) & B11100000) | (lineColor->blue>>3) ); + lcd_write_D( (fillColor->red & B11111000) | (fillColor->green >> 5)); + lcd_write_D( ((fillColor->green<<3) & B11100000) | (fillColor->blue>>3) ); +} + +Oled Display = Oled(); \ No newline at end of file diff --git a/cores/touchStealth/Oled.h b/cores/touchStealth/Oled.h new file mode 100644 index 0000000..f331749 --- /dev/null +++ b/cores/touchStealth/Oled.h @@ -0,0 +1,76 @@ +#ifndef OLED_H +#define OLED_H + +//#include "DataTypes.h" +#include "graphics.h" +#include "oled_stealth.h" + +#define LCD_COLUMNS 128 +#define LCD_ROWS 128 +#define LCD_RAM_LENGTH 132 + +#define HIGH_BRIGHTNESS 0x0E +#define MED_BRIGHTNESS 0x0A +#define LOW_BRIGHTNESS 0x07 + +#define FONT_HEIGHT 7 +#define FONT_WIDTH 5 + +enum ScrollMode { + TEST = 0, + NORMAL = 1, + SLOW = 2, + SLOWEST = 3 +} ; + +class Oled { + protected: + void SetColumn(int start, int end); + void SetRow(int start, int end); + void WritePixel(COLOR* color); + void WriteCommand(unsigned char command); + void WriteData(unsigned char data); + int initialized; + //int fillEnabled; + // enable/disable circle/rectangle fill + //void SetFillEnabled(int val); + + //int reverseCopyEnabled; + //void SetReverseCopyEnabled(int val); + + //int xCopyWrapEnabled; + // enable/disable wrap around in the X direction on copy + //void SetXCopyWrapEnabled(int val); + + + public: + Oled(); + void Initialize(); + void Clear(); + void SetDisplayStartLine(int line); + void SetDisplayOffset(int offset); + void DrawChar(unsigned char ch, int x_pos, + int y_pos,COLOR* fc, COLOR* bc); + void DrawString(char * string, unsigned int x_pos, + unsigned int y_pos, COLOR* fc, COLOR* bc); + void DrawLine(int startColumn, int startRow, + int endColumn, int endRow, COLOR* color); + //void DrawRectangle(LCD_RECT* rectangle, + // COLOR* lineColor, COLOR* fillColor); + void DrawRectangle(unsigned char startColumn, unsigned char startRow, + unsigned char endColumn, unsigned char endRow, COLOR* lineColor, COLOR* fillColor); + //void DrawCircle(int centerColumn, int centerRow, int radius, + // COLOR* lineColor, COLOR* fillColor); + void CopyRegion(LCD_RECT* region, unsigned char destColumn, unsigned char destRow); + //void DimRegion(LCD_RECT* region); + void ClearRegion(LCD_RECT* region); + void ClearRegion(unsigned char startColumn, unsigned char startRow, + unsigned char endColumn, unsigned char endRow); + //void HorizontalScroll(int hOffset, int startRow, int rows, ScrollMode mode); + //void StartHorizontalScroll(); + //void StopHorizontalScroll(); + +}; + +extern Oled Display; +#endif \ No newline at end of file diff --git a/cores/touchStealth/colors.c b/cores/touchStealth/colors.c new file mode 100644 index 0000000..87f38cc --- /dev/null +++ b/cores/touchStealth/colors.c @@ -0,0 +1,8 @@ +#include "colors.h" + +COLOR BLUE = {0, 0, 255}; +COLOR BLACK = {0, 0, 0}; +COLOR RED = {255, 0, 0}; +COLOR GREEN = {0, 255, 0}; +COLOR WHITE = {255, 255, 255}; +COLOR PURPLE = {127, 0, 127}; diff --git a/cores/touchStealth/colors.h b/cores/touchStealth/colors.h new file mode 100644 index 0000000..2eb410c --- /dev/null +++ b/cores/touchStealth/colors.h @@ -0,0 +1,12 @@ +#ifndef COLORS_H +#define COLORS_H + +#include "graphics.h" +extern COLOR BLUE; +extern COLOR BLACK; +extern COLOR RED; +extern COLOR GREEN; +extern COLOR WHITE; +extern COLOR PURPLE; + +#endif \ No newline at end of file diff --git a/cores/touchStealth/font.c b/cores/touchStealth/font.c index b592ee8..ba222db 100644 --- a/cores/touchStealth/font.c +++ b/cores/touchStealth/font.c @@ -21,773 +21,775 @@ /*! Our 5x7 Font that we normally use */ //////////////////////////////////////////// -const unsigned char font_5x7[752] PROGMEM ={ - - B00000000, - B00000000, - B00000000, - B00000000, - B00000000, - B00000000, +const unsigned char font_5x7_val[752] PROGMEM ={ + + B00000000, + B00000000, + B00000000, + B00000000, + B00000000, + B00000000, B00000000, //letter Space - B00100000, - B00100000, - B00100000, - B00100000, - B00100000, - B00000000, + B00100000, + B00100000, + B00100000, + B00100000, + B00100000, + B00000000, B00100000, //letter ! - B01010000, - B01010000, - B00000000, - B00000000, - B00000000, - B00000000, + B01010000, + B01010000, + B00000000, + B00000000, + B00000000, + B00000000, B00000000, //letter " - B01010000, - B01010000, - B11111000, - B01010000, - B11111000, - B01010000, + B01010000, + B01010000, + B11111000, + B01010000, + B11111000, + B01010000, B01010000, //letter # - B00100000, - B01111000, - B10100000, - B01110000, - B00101000, - B00110000, + B00100000, + B01111000, + B10100000, + B01110000, + B00101000, + B00110000, B00100000, //letter $ - B11000000, - B11001000, - B00010000, - B00100000, - B01000000, - B10011000, + B11000000, + B11001000, + B00010000, + B00100000, + B01000000, + B10011000, B00011000, //letter % - B01000000, - B10100000, - B01000000, - B10100000, - B10010000, - B10001000, + B01000000, + B10100000, + B01000000, + B10100000, + B10010000, + B10001000, B01110000, //letter & - B00010000, - B00010000, - B00100000, - B00000000, - B00000000, - B00000000, + B00010000, + B00010000, + B00100000, + B00000000, + B00000000, + B00000000, B00000000, //letter ' - B00100000, - B01000000, - B01000000, - B01000000, - B01000000, - B01000000, + B00100000, + B01000000, + B01000000, + B01000000, + B01000000, + B01000000, B00100000, //letter ( - B00010000, - B00001000, - B00001000, - B00001000, - B00001000, - B00001000, + B00010000, + B00001000, + B00001000, + B00001000, + B00001000, + B00001000, B00010000, //letter ) - B00000000, - B10001000, - B01010000, - B11111000, - B01010000, - B10001000, + B00000000, + B10001000, + B01010000, + B11111000, + B01010000, + B10001000, B00000000, //letter * - B00000000, - B00100000, - B00100000, - B11111000, - B00100000, - B00100000, + B00000000, + B00100000, + B00100000, + B11111000, + B00100000, + B00100000, B00000000, //letter + - B00000000, - B00000000, - B00000000, - B00000000, - B01000000, - B01000000, + B00000000, + B00000000, + B00000000, + B00000000, + B01000000, + B01000000, B10000000, //letter , - B00000000, - B00000000, - B00000000, - B11111000, - B00000000, - B00000000, + B00000000, + B00000000, + B00000000, + B11111000, + B00000000, + B00000000, B00000000, //letter - - B00000000, - B00000000, - B00000000, - B00000000, - B00000000, - B11000000, + B00000000, + B00000000, + B00000000, + B00000000, + B00000000, + B11000000, B11000000, //letter . - B00000000, - B00001000, - B00010000, - B00100000, - B01000000, - B10000000, + B00000000, + B00001000, + B00010000, + B00100000, + B01000000, + B10000000, B00000000, //letter / - B01110000, - B10001000, - B10011000, - B10101000, - B11001000, - B10001000, + B01110000, + B10001000, + B10011000, + B10101000, + B11001000, + B10001000, B01110000, //letter 0 - - B00100000, - B01100000, - B00100000, - B00100000, - B00100000, - B00100000, - B01110000, //letter 1 - - B01110000, - B00001000, - B00001000, - B01110000, - B10000000, - B10000000, + + B00100000, + B01100000, + B00100000, + B00100000, + B00100000, + B00100000, + B01110000, //letter 1 + + B01110000, + B00001000, + B00001000, + B01110000, + B10000000, + B10000000, B11111000, //letter 2 - B11110000, - B00001000, - B00001000, - B01110000, - B00001000, - B00001000, + B11110000, + B00001000, + B00001000, + B01110000, + B00001000, + B00001000, B11110000, //letter 3 - B00001000, - B00011000, - B00101000, - B01001000, - B11111000, - B00001000, + B00001000, + B00011000, + B00101000, + B01001000, + B11111000, + B00001000, B00001000, //letter 4 - B11111000, - B10000000, - B10000000, - B11110000, - B00001000, - B10001000, + B11111000, + B10000000, + B10000000, + B11110000, + B00001000, + B10001000, B01110000, //letter 5 - - B01110000, - B10000000, - B10000000, - B11110000, - B10001000, - B10001000, + + B01110000, + B10000000, + B10000000, + B11110000, + B10001000, + B10001000, B01110000, //letter 6 - B11111000, - B00001000, - B00001000, - B00010000, - B00100000, - B01000000, + B11111000, + B00001000, + B00001000, + B00010000, + B00100000, + B01000000, B10000000, //letter 7 - B01110000, - B10001000, - B10001000, - B01110000, - B10001000, - B10001000, + B01110000, + B10001000, + B10001000, + B01110000, + B10001000, + B10001000, B01110000, //letter 8 - - B01110000, - B10001000, - B10001000, - B01111000, - B00010000, - B00100000, + + B01110000, + B10001000, + B10001000, + B01111000, + B00010000, + B00100000, B01000000, //letter 9 - B00000000, - B00000000, - B01100000, - B01100000, - B00000000, - B01100000, + B00000000, + B00000000, + B01100000, + B01100000, + B00000000, + B01100000, B01100000, //letter : - B00000000, - B00000000, - B01100000, - B01100000, - B00000000, - B00100000, + B00000000, + B00000000, + B01100000, + B01100000, + B00000000, + B00100000, B01000000, //letter ; - B00010000, - B00100000, - B01000000, - B10000000, - B01000000, - B00100000, + B00010000, + B00100000, + B01000000, + B10000000, + B01000000, + B00100000, B00010000, //letter < - B00000000, - B00000000, - B11111000, - B00000000, - B11111000, - B00000000, + B00000000, + B00000000, + B11111000, + B00000000, + B11111000, + B00000000, B00000000, //letter = - B01000000, - B00100000, - B00010000, - B00001000, - B00010000, - B00100000, + B01000000, + B00100000, + B00010000, + B00001000, + B00010000, + B00100000, B01000000, //letter > - B01110000, - B10001000, - B00001000, - B00110000, - B01000000, - B00000000, + B01110000, + B10001000, + B00001000, + B00110000, + B01000000, + B00000000, B01000000, //letter ? - B00100000, - B00100000, - B01110000, - B11110000, - B11110000, - B11111000, + B00100000, + B00100000, + B01110000, + B11110000, + B11110000, + B11111000, B11111000, //letter @ //-----------------------------------Capital Letters - B00100000, - B01011000, - B10001000, - B11111000, - B10001000, - B10001000, - B10001000, //letter A - - B11110000, - B10001000, - B10001000, - B11110000, - B10001000, - B10001000, + B00100000, + B01011000, + B10001000, + B11111000, + B10001000, + B10001000, + B10001000, //letter A + + B11110000, + B10001000, + B10001000, + B11110000, + B10001000, + B10001000, B11110000, //letter B - B01110000, - B10001000, - B10000000, - B10000000, - B10000000, - B10001000, + B01110000, + B10001000, + B10000000, + B10000000, + B10000000, + B10001000, B01110000, //letter C - B11110000, - B10001000, - B10001000, - B10001000, - B10001000, - B10001000, + B11110000, + B10001000, + B10001000, + B10001000, + B10001000, + B10001000, B11110000, //letter D - B11111000, - B10000000, - B10000000, - B11110000, - B10000000, - B10000000, + B11111000, + B10000000, + B10000000, + B11110000, + B10000000, + B10000000, B11111000, //letter E - B11111000, - B10000000, - B10000000, - B11110000, - B10000000, - B10000000, + B11111000, + B10000000, + B10000000, + B11110000, + B10000000, + B10000000, B10000000, //letter F - B01110000, - B10001000, - B10000000, - B10000000, - B10011000, - B10001000, + B01110000, + B10001000, + B10000000, + B10000000, + B10011000, + B10001000, B01111000, //letter G - B10001000, - B10001000, - B10001000, - B11111000, - B10001000, - B10001000, + B10001000, + B10001000, + B10001000, + B11111000, + B10001000, + B10001000, B10001000, //letter H - B01110000, - B00100000, - B00100000, - B00100000, - B00100000, - B00100000, + B01110000, + B00100000, + B00100000, + B00100000, + B00100000, + B00100000, B01110000, //letter I - B11111000, - B00010000, - B00010000, - B00010000, - B10010000, - B10010000, + B11111000, + B00010000, + B00010000, + B00010000, + B10010000, + B10010000, B01100000, //letter J - B10001000, - B10010000, - B10100000, - B11000000, - B10100000, - B10010000, + B10001000, + B10010000, + B10100000, + B11000000, + B10100000, + B10010000, B10001000, //letter K - B10000000, - B10000000, - B10000000, - B10000000, - B10000000, - B10000000, + B10000000, + B10000000, + B10000000, + B10000000, + B10000000, + B10000000, B11111000, //letter L - B10001000, - B11011000, - B10101000, - B10001000, - B10001000, - B10001000, + B10001000, + B11011000, + B10101000, + B10001000, + B10001000, + B10001000, B10001000, //letter M - B10001000, - B11001000, - B10101000, - B10011000, - B10001000, - B10001000, + B10001000, + B11001000, + B10101000, + B10011000, + B10001000, + B10001000, B10001000, //letter N - B01110000, - B10001000, - B10001000, - B10001000, - B10001000, - B10001000, + B01110000, + B10001000, + B10001000, + B10001000, + B10001000, + B10001000, B01110000, //letter O - B11110000, - B10001000, - B10001000, - B11110000, - B10000000, - B10000000, + B11110000, + B10001000, + B10001000, + B11110000, + B10000000, + B10000000, B10000000, //letter P - B01110000, - B10001000, - B10001000, - B10001000, - B10101000, - B10011000, + B01110000, + B10001000, + B10001000, + B10001000, + B10101000, + B10011000, B01111000, //letter Q - B11110000, - B10001000, - B10001000, - B11110000, - B10100000, - B10010000, + B11110000, + B10001000, + B10001000, + B11110000, + B10100000, + B10010000, B10001000, //letter R - B01111000, - B10000000, - B10000000, - B01110000, - B00001000, - B00001000, + B01111000, + B10000000, + B10000000, + B01110000, + B00001000, + B00001000, B11110000, //letter S - B11111000, - B00100000, - B00100000, - B00100000, - B00100000, - B00100000, + B11111000, + B00100000, + B00100000, + B00100000, + B00100000, + B00100000, B00100000, //letter T - B10001000, - B10001000, - B10001000, - B10001000, - B10001000, - B10001000, + B10001000, + B10001000, + B10001000, + B10001000, + B10001000, + B10001000, B01110000, //letter U - B10001000, - B10001000, - B10001000, - B10001000, - B10001000, - B01010000, + B10001000, + B10001000, + B10001000, + B10001000, + B10001000, + B01010000, B00100000, //letter V - B10001000, - B10001000, - B10001000, - B10001000, - B10101000, - B11011000, + B10001000, + B10001000, + B10001000, + B10001000, + B10101000, + B11011000, B10001000, //letter W - B10001000, - B10001000, - B01010000, - B00100000, - B01010000, - B10001000, + B10001000, + B10001000, + B01010000, + B00100000, + B01010000, + B10001000, B10001000, //letter X - B10001000, - B10001000, - B10001000, - B01010000, - B00100000, - B00100000, + B10001000, + B10001000, + B10001000, + B01010000, + B00100000, + B00100000, B00100000, //letter Y - B11111000, - B00001000, - B00010000, - B00100000, - B01000000, - B10000000, + B11111000, + B00001000, + B00010000, + B00100000, + B01000000, + B10000000, B11111000, //letter Z //-----------------------------------End capital letters - B11100000, - B10000000, - B10000000, - B10000000, - B10000000, - B10000000, + B11100000, + B10000000, + B10000000, + B10000000, + B10000000, + B10000000, B11100000, //letter [ - B00000000, - B10000000, - B01000000, - B00100000, - B00010000, - B00001000, + B00000000, + B10000000, + B01000000, + B00100000, + B00010000, + B00001000, B00000000, //letter - B00111000, - B00001000, - B00001000, - B00001000, - B00001000, - B00001000, + B00111000, + B00001000, + B00001000, + B00001000, + B00001000, + B00001000, B00111000, //letter ] - B00100000, - B01010000, - B10001000, - B00000000, - B00000000, - B00000000, + B00100000, + B01010000, + B10001000, + B00000000, + B00000000, + B00000000, B00000000, //letter ^ - B00000000, - B00000000, - B00000000, - B00000000, - B00000000, - B00000000, + B00000000, + B00000000, + B00000000, + B00000000, + B00000000, + B00000000, B11111000, //letter _ - B00010000, - B00010000, - B00001000, - B00000000, - B00000000, - B00000000, + B00010000, + B00010000, + B00001000, + B00000000, + B00000000, + B00000000, B00000000, //letter ' - B00000000, - B00000000, - B01110000, - B10001000, - B10001000, - B10011000, + B00000000, + B00000000, + B01110000, + B10001000, + B10001000, + B10011000, B01101000, //letter a - B10000000, - B10000000, - B11110000, - B10001000, - B10001000, - B10001000, + B10000000, + B10000000, + B11110000, + B10001000, + B10001000, + B10001000, B11110000, //letter b - B00000000, - B00000000, - B01111000, - B10000000, - B10000000, - B10000000, + B00000000, + B00000000, + B01111000, + B10000000, + B10000000, + B10000000, B01111000, //letter c - B00001000, - B00001000, - B01111000, - B10001000, - B10001000, - B10001000, + B00001000, + B00001000, + B01111000, + B10001000, + B10001000, + B10001000, B01111000, //letter d - B00000000, - B00000000, - B01110000, - B10001000, - B11111000, - B10000000, + B00000000, + B00000000, + B01110000, + B10001000, + B11111000, + B10000000, B01111000, //letter e - B00010000, - B00101000, - B01110000, - B00100000, - B00100000, - B00100000, + B00010000, + B00101000, + B01110000, + B00100000, + B00100000, + B00100000, B00100000, //letter f - B00000000, - B00000000, - B01110000, - B10001000, - B01111000, - B00001000, + B00000000, + B00000000, + B01110000, + B10001000, + B01111000, + B00001000, B01110000, //letter g - B10000000, - B10000000, - B11110000, - B10001000, - B10001000, - B10001000, + B10000000, + B10000000, + B11110000, + B10001000, + B10001000, + B10001000, B10001000, //letter h - B00100000, - B00000000, - B00100000, - B00100000, - B00100000, - B00100000, + B00100000, + B00000000, + B00100000, + B00100000, + B00100000, + B00100000, B00100000, //letter i - B00100000, - B00000000, - B00100000, - B00100000, - B00100000, - B10100000, + B00100000, + B00000000, + B00100000, + B00100000, + B00100000, + B10100000, B01000000, //letter j - B10000000, - B10000000, - B10001000, - B10010000, - B10100000, - B11010000, + B10000000, + B10000000, + B10001000, + B10010000, + B10100000, + B11010000, B10001000, //letter k - B00100000, - B00100000, - B00100000, - B00100000, - B00100000, - B00100000, + B00100000, + B00100000, + B00100000, + B00100000, + B00100000, + B00100000, B00100000, //letter l - B00000000, - B00000000, - B11010000, - B10101000, - B10101000, - B10101000, + B00000000, + B00000000, + B11010000, + B10101000, + B10101000, + B10101000, B10101000, //letter m - B00000000, - B00000000, - B10110000, - B11001000, - B10001000, - B10001000, + B00000000, + B00000000, + B10110000, + B11001000, + B10001000, + B10001000, B10001000, //letter n - B00000000, - B00000000, - B01110000, - B10001000, - B10001000, - B10001000, + B00000000, + B00000000, + B01110000, + B10001000, + B10001000, + B10001000, B01110000, //letter o - B00000000, - B00000000, - B11110000, - B10001000, - B11110000, - B10000000, + B00000000, + B00000000, + B11110000, + B10001000, + B11110000, + B10000000, B10000000, //letter p - B00000000, - B00000000, - B01111000, - B10001000, - B01111000, - B00001000, + B00000000, + B00000000, + B01111000, + B10001000, + B01111000, + B00001000, B00001000, //letter q - B00000000, - B00000000, - B10110000, - B11001000, - B10000000, - B10000000, + B00000000, + B00000000, + B10110000, + B11001000, + B10000000, + B10000000, B10000000, //letter r - B00000000, - B00000000, - B01111000, - B10000000, - B01110000, - B00001000, + B00000000, + B00000000, + B01111000, + B10000000, + B01110000, + B00001000, B11110000, //letter s - B00100000, - B00100000, - B01110000, - B00100000, - B00100000, - B00100000, + B00100000, + B00100000, + B01110000, + B00100000, + B00100000, + B00100000, B00110000, //letter t - B00000000, - B00000000, - B10001000, - B10001000, - B10001000, - B10011000, + B00000000, + B00000000, + B10001000, + B10001000, + B10001000, + B10011000, B01101000, //letter u - B00000000, - B00000000, - B10001000, - B10001000, - B10001000, - B01010000, + B00000000, + B00000000, + B10001000, + B10001000, + B10001000, + B01010000, B00100000, //letter v - B00000000, - B00000000, - B10001000, - B10001000, - B10101000, - B10101000, + B00000000, + B00000000, + B10001000, + B10001000, + B10101000, + B10101000, B01010000, //letter w - B00000000, - B00000000, - B10001000, - B01010000, - B00100000, - B01010000, + B00000000, + B00000000, + B10001000, + B01010000, + B00100000, + B01010000, B10001000, //letter x - B00000000, - B00000000, - B10001000, - B10001000, - B11111000, - B00001000, + B00000000, + B00000000, + B10001000, + B10001000, + B11111000, + B00001000, B01110000, //letter y - B00000000, - B00000000, - B11111000, - B00010000, - B00100000, - B01000000, + B00000000, + B00000000, + B11111000, + B00010000, + B00100000, + B01000000, B11111000, //letter z - B00100000, - B01000000, - B01000000, - B10000000, - B01000000, - B01000000, + B00100000, + B01000000, + B01000000, + B10000000, + B01000000, + B01000000, B00100000, //letter { - B00100000, - B00100000, - B00100000, - B00000000, - B00100000, - B00100000, + B00100000, + B00100000, + B00100000, + B00000000, + B00100000, + B00100000, B00100000, //letter | - B00100000, - B00010000, - B00010000, - B00001000, - B00010000, - B00010000, + B00100000, + B00010000, + B00010000, + B00001000, + B00010000, + B00010000, B00100000, //letter } - B01010000, - B10100000, - B00000000, - B00000000, - B00000000, - B00000000, - B00000000 //letter ~ + B01010000, + B10100000, + B00000000, + B00000000, + B00000000, + B00000000, + B00000000 //letter ~ }; +unsigned char *font_5x7 = &font_5x7_val; + /* INPUT VARIABLES */ /* OUTPUT VARIABLES */ /* None */ @@ -815,16 +817,16 @@ const unsigned char font_5x7[752] PROGMEM ={ *============================================================================*/ /* =========================================================================== -* FUNCTION: +* FUNCTION: * * DESIGN DESCRIPTION: * * * PARAMETER LIST: -* +* * * RETURNED: -* +* * * DESIGN OUTLINE: * @@ -848,14 +850,14 @@ unsigned int row,byte; byte = pgm_read_byte(font_5x7+letter+row); shifted = byte; - + for (x=0;x<5;x++) { - + //oled_setXY(x_pos+x, y_pos+row); on_off = shifted & B10000000; - on_off = on_off>>7; + on_off = on_off>>7; shifted = shifted << 1; if (on_off > 0) { @@ -867,23 +869,23 @@ unsigned int row,byte; dispColor(bc); dispPixel(x_pos+x, y_pos+row); //write the pixel } - + } } } /* =========================================================================== -* FUNCTION: +* FUNCTION: * * DESIGN DESCRIPTION: * * * PARAMETER LIST: -* +* * * RETURNED: -* +* * * DESIGN OUTLINE: * diff --git a/cores/touchStealth/font.h b/cores/touchStealth/font.h index c2a849b..c4bb52a 100644 --- a/cores/touchStealth/font.h +++ b/cores/touchStealth/font.h @@ -1,4 +1,4 @@ -/*! \file Font.h +/*! \file Font.h \brief Include all font definitions here. Fonts are stored in program memory */ @@ -15,7 +15,7 @@ extern "C"{ void dispPutC(unsigned char ch, unsigned int x_pos,unsigned int y_pos,COLOR fc, COLOR bc); void dispPutS(char * string,unsigned int x_pos, unsigned int y_pos, COLOR fc, COLOR bc); - +extern unsigned char *font_5x7; #ifdef __cplusplus } // extern "C" #endif