oled
Revision 0:847d62ecf52e, committed 2017-08-27
- Comitter:
- mijimy
- Date:
- Sun Aug 27 06:12:47 2017 +0000
- Commit message:
- oled;
Changed in this revision
diff -r 000000000000 -r 847d62ecf52e Draw2D.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Draw2D.h Sun Aug 27 06:12:47 2017 +0000 @@ -0,0 +1,12 @@ + +extern void draw_Line(int x1, int y1, int x2, int y2, uint16_t fg_color, uint16_t bg_color); + +extern void draw_Circle(int xc, int yc, int r, uint16_t fg_color, uint16_t bg_color); + +extern void draw_Rectangle(int x0, int y0, int x1, int y1, uint16_t fg_color, uint16_t bg_color); + +extern void fill_Rectangle(int x0, int y0, int x1, int y1, uint16_t fg_color, uint16_t bg_color); + +extern void draw_Triangle(int x0, int y0, int x1, int y1, int x2, int y2, uint16_t fg_color, uint16_t bg_color); + +
diff -r 000000000000 -r 847d62ecf52e Font5x7.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Font5x7.h Sun Aug 27 06:12:47 2017 +0000 @@ -0,0 +1,101 @@ +// standard ascii 5x7 font +// defines ascii characters 0x20-0x7F (32-127) +const unsigned char Font5x7[96*5] = { + 0x00, 0x00, 0x00, 0x00, 0x00,// (space) + 0x00, 0x00, 0x5F, 0x00, 0x00,// ! + 0x00, 0x07, 0x00, 0x07, 0x00,// " + 0x14, 0x7F, 0x14, 0x7F, 0x14,// # + 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ + 0x23, 0x13, 0x08, 0x64, 0x62,// % + 0x36, 0x49, 0x55, 0x22, 0x50,// & + 0x00, 0x05, 0x03, 0x00, 0x00,// ' + 0x00, 0x1C, 0x22, 0x41, 0x00,// ( + 0x00, 0x41, 0x22, 0x1C, 0x00,// ) + 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * + 0x08, 0x08, 0x3E, 0x08, 0x08,// + + 0x00, 0x50, 0x30, 0x00, 0x00,// , + 0x08, 0x08, 0x08, 0x08, 0x08,// - + 0x00, 0x60, 0x60, 0x00, 0x00,// . + 0x20, 0x10, 0x08, 0x04, 0x02,// / + 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 + 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 + 0x42, 0x61, 0x51, 0x49, 0x46,// 2 + 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 + 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 + 0x27, 0x45, 0x45, 0x45, 0x39,// 5 + 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 + 0x01, 0x71, 0x09, 0x05, 0x03,// 7 + 0x36, 0x49, 0x49, 0x49, 0x36,// 8 + 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 + 0x00, 0x36, 0x36, 0x00, 0x00,// : + 0x00, 0x56, 0x36, 0x00, 0x00,// ; + 0x00, 0x08, 0x14, 0x22, 0x41,// < + 0x14, 0x14, 0x14, 0x14, 0x14,// = + 0x41, 0x22, 0x14, 0x08, 0x00,// > + 0x02, 0x01, 0x51, 0x09, 0x06,// ? + 0x32, 0x49, 0x79, 0x41, 0x3E,// @ + 0x7E, 0x11, 0x11, 0x11, 0x7E,// A + 0x7F, 0x49, 0x49, 0x49, 0x36,// B + 0x3E, 0x41, 0x41, 0x41, 0x22,// C + 0x7F, 0x41, 0x41, 0x22, 0x1C,// D + 0x7F, 0x49, 0x49, 0x49, 0x41,// E + 0x7F, 0x09, 0x09, 0x01, 0x01,// F + 0x3E, 0x41, 0x41, 0x51, 0x32,// G + 0x7F, 0x08, 0x08, 0x08, 0x7F,// H + 0x00, 0x41, 0x7F, 0x41, 0x00,// I + 0x20, 0x40, 0x41, 0x3F, 0x01,// J + 0x7F, 0x08, 0x14, 0x22, 0x41,// K + 0x7F, 0x40, 0x40, 0x40, 0x40,// L + 0x7F, 0x02, 0x04, 0x02, 0x7F,// M + 0x7F, 0x04, 0x08, 0x10, 0x7F,// N + 0x3E, 0x41, 0x41, 0x41, 0x3E,// O + 0x7F, 0x09, 0x09, 0x09, 0x06,// P + 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q + 0x7F, 0x09, 0x19, 0x29, 0x46,// R + 0x46, 0x49, 0x49, 0x49, 0x31,// S + 0x01, 0x01, 0x7F, 0x01, 0x01,// T + 0x3F, 0x40, 0x40, 0x40, 0x3F,// U + 0x1F, 0x20, 0x40, 0x20, 0x1F,// V + 0x7F, 0x20, 0x18, 0x20, 0x7F,// W + 0x63, 0x14, 0x08, 0x14, 0x63,// X + 0x03, 0x04, 0x78, 0x04, 0x03,// Y + 0x61, 0x51, 0x49, 0x45, 0x43,// Z + 0x00, 0x00, 0x7F, 0x41, 0x41,// [ + 0x02, 0x04, 0x08, 0x10, 0x20,// "\" + 0x41, 0x41, 0x7F, 0x00, 0x00,// ] + 0x04, 0x02, 0x01, 0x02, 0x04,// ^ + 0x40, 0x40, 0x40, 0x40, 0x40,// _ + 0x00, 0x01, 0x02, 0x04, 0x00,// ` + 0x20, 0x54, 0x54, 0x54, 0x78,// a + 0x7F, 0x48, 0x44, 0x44, 0x38,// b + 0x38, 0x44, 0x44, 0x44, 0x20,// c + 0x38, 0x44, 0x44, 0x48, 0x7F,// d + 0x38, 0x54, 0x54, 0x54, 0x18,// e + 0x08, 0x7E, 0x09, 0x01, 0x02,// f + 0x08, 0x14, 0x54, 0x54, 0x3C,// g + 0x7F, 0x08, 0x04, 0x04, 0x78,// h + 0x00, 0x44, 0x7D, 0x40, 0x00,// i + 0x20, 0x40, 0x44, 0x3D, 0x00,// j + 0x00, 0x7F, 0x10, 0x28, 0x44,// k + 0x00, 0x41, 0x7F, 0x40, 0x00,// l + 0x7C, 0x04, 0x18, 0x04, 0x78,// m + 0x7C, 0x08, 0x04, 0x04, 0x78,// n + 0x38, 0x44, 0x44, 0x44, 0x38,// o + 0x7C, 0x14, 0x14, 0x14, 0x08,// p + 0x08, 0x14, 0x14, 0x18, 0x7C,// q + 0x7C, 0x08, 0x04, 0x04, 0x08,// r + 0x48, 0x54, 0x54, 0x54, 0x20,// s + 0x04, 0x3F, 0x44, 0x40, 0x20,// t + 0x3C, 0x40, 0x40, 0x20, 0x7C,// u + 0x1C, 0x20, 0x40, 0x20, 0x1C,// v + 0x3C, 0x40, 0x30, 0x40, 0x3C,// w + 0x44, 0x28, 0x10, 0x28, 0x44,// x + 0x0C, 0x50, 0x50, 0x50, 0x3C,// y + 0x44, 0x64, 0x54, 0x4C, 0x44,// z + 0x00, 0x08, 0x36, 0x41, 0x00,// { + 0x00, 0x00, 0x7F, 0x00, 0x00,// | + 0x00, 0x41, 0x36, 0x08, 0x00,// } + 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> + 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- +}; +
diff -r 000000000000 -r 847d62ecf52e Font8x16.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Font8x16.h Sun Aug 27 06:12:47 2017 +0000 @@ -0,0 +1,241 @@ +const unsigned char Font8x16[]={ +/* */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* ! */ +0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* " */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, +/* # */ +0x00,0x00,0x00,0xC0,0x30,0xC0,0x30,0x00,0xC8,0x39,0xCF,0x39,0x0F,0x09,0x01,0x00, +/* $ */ +0xE0,0x10,0x10,0xF8,0x10,0x10,0x60,0x00,0x30,0x41,0x42,0xFF,0x42,0x44,0x38,0x00, +/* % */ +0xC0,0x20,0x10,0xE0,0x20,0xE0,0x18,0x00,0x01,0xC2,0x31,0x0C,0x73,0x88,0x44,0x38 +, +/* & */ +0x00,0xE0,0x10,0x10,0xE0,0x00,0x00,0x00,0x78,0x85,0x82,0x8D,0x70,0xA2,0x9E,0x42 +, +/* ' */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* ( */ +0xC0,0x30,0x08,0x04,0x00,0x00,0x00,0x00,0x1F,0x60,0x80,0x00,0x00,0x00,0x00,0x00 +, +/* ) */ +0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x1F,0x00,0x00,0x00,0x00 +, +/* * */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFE,0x28,0x44,0x00,0x00,0x00 +, +/* + */ +0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x00, +/* , */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* - */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00 +, +/* . */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* / */ +0x00,0x00,0x80,0x70,0x00,0x00,0x00,0x00,0xE0,0x1C,0x03,0x00,0x00,0x00,0x00,0x00 +, +/* 0 */ +0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x3F,0x40,0x80,0x80,0x40,0x3F,0x00,0x00, +/* 1 */ +0x20,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x80,0x00,0x00,0x00,0x00,0x00, +/* 2 */ +0x60,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0xC0,0xA0,0x90,0x88,0x86,0xC1,0x00,0x00 +, +/* 3 */ +0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x80,0x80,0x82,0x83,0x44,0x38,0x00,0x00 +, +/* 4 */ +0x00,0x00,0x80,0x60,0xF0,0x00,0x00,0x00,0x18,0x16,0x11,0x10,0xFF,0x10,0x00,0x00, +/* 5 */ +0x00,0xF0,0x10,0x10,0x10,0x10,0x00,0x00,0x80,0x81,0x81,0x81,0x42,0x3C,0x00,0x00 +, +/* 6 */ +0x80,0x40,0x20,0x10,0x10,0x10,0x00,0x00,0x3F,0x42,0x81,0x81,0x42,0x3C,0x00,0x00 +, +/* 7 */ +0x70,0x10,0x10,0x10,0x90,0x70,0x00,0x00,0x00,0x00,0xE0,0x1C,0x03,0x00,0x00,0x00 +, +/* 8 */ +0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x38,0x45,0x82,0x82,0x45,0x38,0x00,0x00 +, +/* 9 */ +0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x83,0x84,0x88,0x48,0x24,0x1F,0x00,0x00 +, +/* : */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC3,0xC3,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* ; */ +0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,0x00 +, +/* < */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x28,0x44,0x44,0x82,0x00,0x00 +, +/* = */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88 +, +/* > */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x44,0x44,0x28,0x28,0x10,0x00,0x00 +, +/* ? */ +0xE0,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0xD8,0x06,0x01,0x00,0x00,0x00 +, +/* @ */ +0xC0,0x20,0x10,0x90,0x90,0x10,0xA0,0xC0,0x3F,0x40,0x8F,0x90,0x90,0x8F,0x50,0x5F, +/* A */ +0x00,0x00,0x80,0x70,0x80,0x00,0x00,0x00,0x80,0xF0,0x8F,0x08,0x8F,0xF0,0x80,0x00, +/* B */ +0x10,0xF0,0x10,0x10,0x10,0x20,0xC0,0x00,0x80,0xFF,0x82,0x82,0x82,0x45,0x38,0x00, +/* C */ +0xC0,0x20,0x10,0x10,0x10,0x20,0x70,0x00,0x3F,0x40,0x80,0x80,0x80,0x80,0x40,0x00 +, +/* D */ +0x10,0xF0,0x10,0x10,0x10,0x60,0x80,0x00,0x80,0xFF,0x80,0x80,0x80,0x60,0x1F,0x00, +/* E */ +0x10,0xF0,0x10,0x10,0x10,0x10,0x70,0x00,0x80,0xFF,0x82,0x82,0x82,0x87,0xE0,0x00, +/* F */ +0x10,0xF0,0x10,0x10,0x10,0x10,0x70,0x00,0x80,0xFF,0x82,0x02,0x02,0x07,0x00,0x00, +/* G */ +0xC0,0x20,0x10,0x10,0x20,0x70,0x00,0x00,0x3F,0x40,0x80,0x80,0x84,0x7C,0x04,0x00 +, +/* H */ +0x10,0xF0,0x10,0x00,0x10,0xF0,0x10,0x00,0x80,0xFF,0x82,0x02,0x82,0xFF,0x80,0x00, +/* I */ +0x10,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x80,0x00,0x00,0x00,0x00,0x00, +/* J */ +0x00,0x00,0x10,0xF0,0x10,0x00,0x00,0x00,0x40,0x80,0x80,0x7F,0x00,0x00,0x00,0x00, +/* K */ +0x10,0xF0,0x10,0x80,0x50,0x30,0x10,0x00,0x80,0xFF,0x83,0x0C,0xB0,0xC0,0x80,0x00, +/* L */ +0x10,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x80,0x80,0x80,0xC0,0x20,0x00, +/* M */ +0x10,0xF0,0x80,0x00,0x80,0xF0,0x10,0x00,0x80,0xFF,0x83,0x3C,0x83,0xFF,0x80,0x00, +/* N */ +0x10,0xF0,0xC0,0x00,0x10,0xF0,0x10,0x00,0x80,0xFF,0x80,0x0F,0x30,0xFF,0x00,0x00, +/* O */ +0x80,0x60,0x10,0x10,0x10,0x60,0x80,0x00,0x1F,0x60,0x80,0x80,0x80,0x60,0x1F,0x00, +/* P */ +0x10,0xF0,0x10,0x10,0x10,0x20,0xC0,0x00,0x80,0xFF,0x84,0x04,0x04,0x02,0x01,0x00, +/* Q */ +0xE0,0x18,0x04,0x04,0x04,0x18,0xE0,0x00,0x07,0x18,0x20,0x20,0x60,0x98,0x87,0x00 +, +/* R */ +0x10,0xF0,0x10,0x10,0x10,0x20,0xC0,0x00,0x80,0xFF,0x84,0x0C,0x34,0xC2,0x81,0x00, +/* S */ +0xC0,0x20,0x10,0x10,0x10,0x20,0x70,0x00,0xE0,0x41,0x82,0x82,0x84,0x48,0x30,0x00 +, +/* T */ +0x30,0x10,0x10,0xF0,0x10,0x10,0x30,0x00,0x00,0x00,0x80,0xFF,0x80,0x00,0x00,0x00, +/* U */ +0x10,0xF0,0x10,0x00,0x10,0xF0,0x10,0x00,0x00,0x7F,0x80,0x80,0x80,0x7F,0x00,0x00, +/* V */ +0x10,0xF0,0x10,0x00,0x10,0xF0,0x10,0x00,0x00,0x01,0x1E,0xE0,0x1E,0x01,0x00,0x00, +/* W */ +0x10,0xF0,0x10,0xC0,0x10,0xF0,0x10,0x00,0x00,0x0F,0xF0,0x0F,0xF0,0x0F,0x00,0x00, +/* X */ +0x10,0x70,0x90,0x00,0x90,0x70,0x10,0x00,0x80,0xE0,0x99,0x06,0x99,0xE0,0x80,0x00 +, +/* Y */ +0x10,0x70,0x90,0x00,0x90,0x70,0x10,0x00,0x00,0x00,0x83,0xFC,0x83,0x00,0x00,0x00 +, +/* Z */ +0x70,0x10,0x10,0x10,0x10,0xD0,0x30,0x00,0xC0,0xB0,0x88,0x86,0x81,0x80,0xE0,0x00 +, +/* [ */ +0xFC,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x80,0x00,0x00,0x00,0x00,0x00, +/* \ */ +0x70,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x1C,0xE0,0x00,0x00,0x00,0x00 +, +/* ] */ +0x04,0x04,0xFC,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0x00,0x00,0x00,0x00,0x00, +/* ^ */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x06,0x18,0x60,0x80,0x00 +, +/* _ */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 +, +/* ` */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x60,0x40,0x80,0x00,0x00,0x00,0x00 +, +/* a */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x91,0x89,0x49,0xFE,0x80,0x00,0x00 +, +/* b */ +0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x81,0x81,0x42,0x3C,0x00,0x00, +/* c */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x81,0x81,0x81,0x42,0x00,0x00 +, +/* d */ +0x00,0x00,0x00,0x10,0xF0,0x00,0x00,0x00,0x3C,0x42,0x81,0x81,0x7F,0x80,0x00,0x00, +/* e */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x4A,0x89,0x89,0x8A,0x4C,0x00,0x00 +, +/* f */ +0x00,0x00,0xE0,0x10,0x10,0x20,0x00,0x00,0x01,0x81,0xFF,0x81,0x01,0x00,0x00,0x00, +/* g */ +0x80,0x40,0x40,0x40,0x80,0x40,0x00,0x00,0x53,0xAC,0xA4,0xA4,0xA3,0x40,0x00,0x00, +/* h */ +0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x01,0x01,0xFE,0x80,0x00,0x00, +/* i */ +0x00,0xB0,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xFF,0x80,0x00,0x00,0x00,0x00,0x00, +/* j */ +0x00,0x00,0x80,0xCC,0x00,0x00,0x00,0x00,0x40,0x80,0x80,0x7F,0x00,0x00,0x00,0x00 +, +/* k */ +0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x98,0x25,0xC3,0x81,0x00,0x00, +/* l */ +0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x80,0x00,0x00,0x00,0x00,0x00, +/* m */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xFE,0x01,0xFE,0x01,0xFE,0x80,0x00, +/* n */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xFE,0x01,0x01,0xFE,0x80,0x00,0x00, +/* o */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x81,0x81,0x42,0x3C,0x00,0x00 +, +/* p */ +0x40,0x80,0x40,0x40,0x80,0x00,0x00,0x00,0x80,0xFF,0xA0,0x20,0x10,0x0F,0x00,0x00, +/* q */ +0x00,0x80,0x40,0x40,0x80,0x40,0x00,0x00,0x0F,0x10,0x20,0xA0,0xFF,0x80,0x00,0x00, +/* r */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xFF,0x82,0x01,0x01,0x00,0x00,0x00, +/* s */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE6,0x49,0x89,0x91,0x92,0x67,0x00,0x00 +, +/* t */ +0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x7F,0x81,0x81,0x40,0x00,0x00 +, +/* u */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x7F,0x80,0x81,0x7F,0x80,0x00,0x00, +/* v */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x39,0xC0,0x39,0x07,0x01,0x00 +, +/* w */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x1F,0xE1,0x1C,0xE1,0x1F,0x01,0x00, +/* x */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x18,0x18,0xE7,0x81,0x00,0x00 +, +/* y */ +0x40,0xC0,0x40,0x00,0x40,0xC0,0x40,0x00,0x80,0x81,0x46,0x38,0x06,0x01,0x00,0x00 +, +/* z */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC3,0xA1,0x91,0x89,0x85,0xC3,0x00,0x00 +, +/* { */ +0x00,0xF0,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0x7D,0x80,0x00,0x00,0x00,0x00,0x00 +, +/* | */ +0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* } */ +0x08,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7D,0x02,0x00,0x00,0x00,0x00,0x00 +, +/* ~ */ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x60,0xC0,0x80,0x80,0x60 +}; +
diff -r 000000000000 -r 847d62ecf52e I2C_SSD1306Z.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/I2C_SSD1306Z.cpp Sun Aug 27 06:12:47 2017 +0000 @@ -0,0 +1,451 @@ +// +// SSD1306Z LCD Driver: 0.96" lcd LY096BG30 +// +// Interface: I2C +// pin1: Vcc +// pin2: Gnd +// pin3: SCL +// pin4: SDA + +#include "mbed.h" +#include "I2C_SSD1306Z.h" +#include "Font8x16.h" +#include "Font5x7.h" + + +//I2C i2c(I2C_SDA, I2C_SCL); +extern I2C i2c; + +char DisplayBuffer[128*8]; + +#if 1 + +void lcdWriteCommand(uint8_t lcd_Command) +{ + + char data[2]; + data[0]=0x0; + data[1]=lcd_Command; + // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data); + // i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1); + i2c.write(LCD_I2C_SLA, data, 2, 0); + +} + +void lcdWriteData(uint8_t lcd_Data) +{ + + char data[2]; + data[0]=0x40; + data[1]=lcd_Data; + // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data); + //i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1); + i2c.write(LCD_I2C_SLA, data, 2, 0); +} + +#else + +void lcdWriteCommand(uint8_t lcd_Command) +{ + uint8_t data[1]; + data[0]=lcd_Command; + // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x00, 1, data); + i2c_write_data_block(LCD_I2C_SLA, 0x00, data,1); + +} + +void lcdWriteData(uint8_t lcd_Data) +{ + uint8_t data[1]; + data[0]=lcd_Data; + // I2C_writeBytes(LCD_I2C_PORT, LCD_I2C_SLA, 0x40, 1, data); + i2c_write_data_block(LCD_I2C_SLA, 0x40,data,1); +} + +#endif + +void lcdSetAddr(uint8_t column, uint8_t page) +{ column+=2; + lcdWriteCommand(0xb0+page); // set page address + lcdWriteCommand(0x10 | ((column & 0xf0) >> 4)); // set column address MSB + lcdWriteCommand(0x00 | (column & 0x0f) ); // set column address LSB +} + +void Init_LCD(void) +{ + lcdWriteCommand(0xae); //display off + lcdWriteCommand(0x20); //Set Memory Addressing Mode + lcdWriteCommand(0x10); //00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid + lcdWriteCommand(0xb0); //Set Page Start Address for Page Addressing Mode,0-7 + lcdWriteCommand(0xc8); //Set COM Output Scan Direction + lcdWriteCommand(0x04);//---set low column address + lcdWriteCommand(0x14);//---set high column address + lcdWriteCommand(0x40);//--set start line address + lcdWriteCommand(0x81);//--set contrast control register + lcdWriteCommand(0x7f); + lcdWriteCommand(0xa1);//--set segment re-map 0 to 127 + lcdWriteCommand(0xa6);//--set normal display + lcdWriteCommand(0xa8);//--set multiplex ratio(1 to 64) + lcdWriteCommand(0x3F);// + lcdWriteCommand(0xa4);//0xa4,Output follows RAM content;0xa5,Output ignores RAM content + lcdWriteCommand(0xd3);//-set display offset + lcdWriteCommand(0x00);//-not offset + lcdWriteCommand(0xd5);//--set display clock divide ratio/oscillator frequency + lcdWriteCommand(0xf0);//--set divide ratio + lcdWriteCommand(0xd9);//--set pre-charge period + lcdWriteCommand(0x22); // + lcdWriteCommand(0xda);//--set com pins hardware configuration + lcdWriteCommand(0x12); + lcdWriteCommand(0xdb);//--set vcomh + lcdWriteCommand(0x20);//0x20,0.77xVcc + lcdWriteCommand(0x8d);//--set DC-DC enable + lcdWriteCommand(0x14);// + lcdWriteCommand(0xaf);//--turn on lcd panel +} + +void clear_LCD(void) +{ + int16_t x, Y; + for (Y=0;Y<LCD_Ymax/8;Y++) + { + lcdSetAddr(0, Y); + for (x=0;x<LCD_Xmax;x++) + lcdWriteData(0x00); + } +} + +// print char function using Font5x7 +void printC_5x7 (int16_t x, int16_t y, unsigned char ascii_code) +{ + uint8_t i; + if (x<(LCD_Xmax-5) && y<(LCD_Ymax-7)) { + if (ascii_code<0x20) ascii_code=0x20; + else if (ascii_code>0x7F) ascii_code=0x20; + for (i=0;i<5;i++) { + lcdSetAddr((LCD_Xmax+1-x-i), (y/8)); + lcdWriteData(Font5x7[(ascii_code-0x20)*5+5-i]); + } + } +} + +void print_C(uint8_t Line, uint8_t Col, char ascii) +{ + uint8_t j, i, tmp; + for (j=0;j<2;j++) { + lcdSetAddr(Col*8, Line*2+j); + for (i=0;i<8;i++) { + tmp=Font8x16[(ascii-0x20)*16+j*8+i]; + lcdWriteData(tmp); + } + } +} + +void print_Line(uint8_t line, char text[]) +{ + uint8_t Col; + for (Col=0; Col<strlen(text); Col++) + print_C(line, Col, text[Col]); +} + +void printS(int16_t x, int16_t y, char text[]) +{ + int8_t i; + for (i=0;i<strlen(text);i++) + print_C(x+i*8, y,text[i]); +} + +void printS_5x7(int16_t x, int16_t y, char text[]) +{ + uint8_t i; + for (i=0;i<strlen(text);i++) { + printC_5x7(x,y,text[i]); + x=x+5; + } +} + +void draw_Pixel(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor) +{ + if (fgColor!=0) + DisplayBuffer[x+y/8*LCD_Xmax] |= (0x01<<(y%8)); + else + DisplayBuffer[x+y/8*LCD_Xmax] &= (0xFE<<(y%8)); + + lcdSetAddr(x, y/8); + lcdWriteData(DisplayBuffer[x+y/8*LCD_Xmax]); +} + +void draw_Bmp8x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,k, kx,ky; + if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check + for (i=0;i<8;i++){ + kx=x+i; + t=bitmap[i]; + for (k=0;k<8;k++) { + ky=y+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } +} + +void draw_Bmp32x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,k, kx,ky; + if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check + for (i=0;i<32;i++){ + kx=x+i; + t=bitmap[i]; + for (k=0;k<8;k++) { + ky=y+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } +} + +void draw_Bmp120x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,k, kx,ky; + if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check + for (i=0;i<120;i++){ + kx=x+i; + t=bitmap[i]; + for (k=0;k<8;k++) { + ky=y+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } +} + +void draw_Bmp8x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,k, kx,ky; + if (x<(LCD_Xmax-7) && y<(LCD_Ymax-7)) // boundary check + for (i=0;i<8;i++){ + kx=x+i; + t=bitmap[i]; + for (k=0;k<8;k++) { + ky=y+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + t=bitmap[i+8]; + for (k=0;k<8;k++) { + ky=y+k+8; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } +} + +void draw_Bmp16x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,k,kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-7)) // boundary check + for (i=0;i<16;i++) + { + kx=x+i; + t=bitmap[i]; + for (k=0;k<8;k++) { + ky=y+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } +} + +void draw_Bmp16x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,j,k, kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check + for (j=0;j<2; j++){ + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp16x24(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,j,k, kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-15)) // boundary check + for (j=0;j<3; j++){ + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp16x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t, i,j,k, kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check + for (j=0;j<4; j++) { + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp16x40(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t, i,j,k, kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-31)) // boundary check + for (j=0;j<5; j++) { + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp16x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,j,k,kx,ky; + if (x<(LCD_Xmax-15) && y<(LCD_Ymax-47)) // boundary check + for (j=0;j<6; j++) { + k=x; + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp16x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,j,k,kx,ky; + if (x<(LCD_Xmax-15) && y==0) // boundary check + for (j=0;j<8; j++) { + k=x; + for (i=0;i<16;i++) { + kx=x+i; + t=bitmap[i+j*16]; + for (k=0;k<8;k++) { + ky=y+j*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp32x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,jx,jy,k,kx,ky; + if (x<(LCD_Xmax-31) && y<(LCD_Ymax-15)) // boundary check + for (jy=0;jy<2;jy++) + for (jx=0;jx<2;jx++) { + k=x; + for (i=0;i<16;i++) { + kx=x+jx*16+i; + t=bitmap[i+jx*16+jy*32]; + for (k=0;k<8;k++) { + ky=y+jy*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp32x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,jx,jy,k, kx,ky; + if (x<(LCD_Xmax-31) && y<(LCD_Ymax-31)) // boundary check + for (jy=0;jy<4;jy++) + for (jx=0;jx<2;jx++) { + k=x; + for (i=0;i<16;i++) { + kx=x+jx*16+i; + t=bitmap[i+jx*16+jy*32]; + for (k=0;k<8;k++) { + ky=y+jy*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp32x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,jx,jy,k, kx,ky; + if (x<(LCD_Xmax-31) && y<(LCD_Ymax-47)) // boundary check + for (jy=0;jy<6;jy++) + for (jx=0;jx<2;jx++) { + k=x; + for (i=0;i<16;i++) { + kx=x+jx*16+i; + t=bitmap[i+jx*16+jy*32]; + for (k=0;k<8;k++) { + ky=y+jy*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp32x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t,i,jx,jy,k, kx,ky; + if (x<(LCD_Xmax-31) && y==0) // boundary check + for (jy=0;jy<8;jy++) + for (jx=0;jx<2;jx++) { + k=x; + for (i=0;i<16;i++) { + kx=x+jx*16+i; + t=bitmap[i+jx*16+jy*32]; + for (k=0;k<8;k++) { + ky=y+jy*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_Bmp64x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]) +{ + uint8_t t, i,jx,jy,k, kx,ky; + if (x<(LCD_Xmax-63) && y==0) // boundary check + for (jy=0;jy<8;jy++) + for (jx=0;jx<4;jx++) { + k=x; + for (i=0;i<16;i++) { + kx=x+jx*16+i; + t=bitmap[i+jx*16+jy*64]; + for (k=0;k<8;k++) { + ky=y+jy*8+k; + if (t&(0x01<<k)) draw_Pixel(kx,ky,fgColor,bgColor); + } + } + } +} + +void draw_LCD(const unsigned char *buffer) +{ + uint8_t x,y; + for (x=0; x<LCD_Xmax; x++) { + for (y=0; y<(LCD_Ymax/8); y++) { + lcdSetAddr(x ,y); + lcdWriteData(buffer[x+y*LCD_Xmax]); + } + } +} +
diff -r 000000000000 -r 847d62ecf52e I2C_SSD1306Z.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/I2C_SSD1306Z.h Sun Aug 27 06:12:47 2017 +0000 @@ -0,0 +1,42 @@ +// +// SSD1306Z LCD Driver: 0.96" OLED LY096BG30 +// + + +//#define LCD_I2C_SLA 0x3c +#define LCD_I2C_SLA 0x78 + +#define LCD_Xmax 128 +#define LCD_Ymax 64 +#define FG_COLOR 0xFFFF +#define BG_COLOR 0x0000 + + +extern void Init_LCD(void); +extern void clear_LCD(void); +extern void print_C(uint8_t Line, uint8_t Col, char ascii); +extern void printC_5x7(int16_t x, int16_t y, unsigned char ascii_code); +extern void print_Line(uint8_t line, char text[]); +//extern void print_Line(uint8_t line, char *Text); +extern void printS(int16_t x, int16_t y, char text[]); +extern void printS_5x7(int16_t x, int16_t y, char text[]); + +extern void draw_Pixel(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor); +extern void draw_Bmp8x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp32x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp120x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp8x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x8(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x24(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x40(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp16x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp32x16(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp32x32(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp32x48(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp32x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_Bmp64x64(int16_t x, int16_t y, uint16_t fgColor, uint16_t bgColor, unsigned char bitmap[]); +extern void draw_LCD(const unsigned char *buffer); +