|
@@ -0,0 +1,263 @@
|
|
|
+#include <avr/io.h>
|
|
|
+#include "sed1335.h"
|
|
|
+#include "gtext.h"
|
|
|
+#include <avr/pgmspace.h>
|
|
|
+#include <util/delay.h>
|
|
|
+#include <string.h>
|
|
|
+
|
|
|
+unsigned char blackbg = 0; //0=bez tła, 1=tło z paskami, 2=tło jednolite
|
|
|
+unsigned char color = 0x3; //kolor tekstu
|
|
|
+
|
|
|
+PROGMEM unsigned char const FontTable[][13] = {
|
|
|
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, //
|
|
|
+ {0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, }, // ! //
|
|
|
+ {0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, // "
|
|
|
+ {0x00, 0x12, 0x12, 0x12, 0x7e, 0x24, 0x24, 0x7e, 0x48, 0x48, 0x48, 0x00, 0x00, }, // #
|
|
|
+ {0x00, 0x08, 0x3e, 0x49, 0x48, 0x38, 0x0e, 0x09, 0x49, 0x3e, 0x08, 0x00, 0x00, }, // $
|
|
|
+ {0x00, 0x31, 0x4a, 0x4a, 0x34, 0x08, 0x08, 0x16, 0x29, 0x29, 0x46, 0x00, 0x00, }, // %
|
|
|
+ {0x00, 0x1c, 0x22, 0x22, 0x22, 0x1c, 0x39, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00, }, // &
|
|
|
+ {0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, // '
|
|
|
+ {0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, }, // (
|
|
|
+ {0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, }, // )
|
|
|
+ {0x00, 0x00, 0x00, 0x08, 0x49, 0x2a, 0x1c, 0x2a, 0x49, 0x08, 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, 0x38, 0x38, 0x18, 0x30, }, // , //
|
|
|
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, // - //
|
|
|
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, }, // .
|
|
|
+ {0x00, 0x02, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, }, // /
|
|
|
+ {0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, }, // 0 //
|
|
|
+ {0x00, 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xfe, 0x00, 0x00, }, // 1 //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x1c, 0x30, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, }, // 2 //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x3c, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // 3 //
|
|
|
+ {0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xcc, 0xff, 0x0c, 0x0c, 0x0c, 0x00, 0x00, }, // 4 //
|
|
|
+ {0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, }, // 5 //
|
|
|
+ {0x00, 0x3c, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // 6 //
|
|
|
+ {0x00, 0xfe, 0x06, 0x06, 0x0c, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, }, // 7 //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // 8 //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, }, // 9 //
|
|
|
+ {0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, }, // :
|
|
|
+ {0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00, }, // ;
|
|
|
+ {0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, }, // < //
|
|
|
+ {0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, }, // =
|
|
|
+ {0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, }, // >
|
|
|
+ {0x00, 0x3c, 0x42, 0x42, 0x02, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, }, // ?
|
|
|
+ {0x00, 0x1c, 0x22, 0x4a, 0x56, 0x52, 0x52, 0x52, 0x4e, 0x20, 0x1e, 0x00, 0x00, }, // @
|
|
|
+ {0x00, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, }, // A //
|
|
|
+ {0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, }, // B //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // C //
|
|
|
+ {0x00, 0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x00, 0x00, }, // D //
|
|
|
+ {0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, }, // E //
|
|
|
+ {0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, }, // F //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0xc0, 0xce, 0xc6, 0xc6, 0xc6, 0x3a, 0x00, 0x00, }, // G //
|
|
|
+ {0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, }, // H //
|
|
|
+ {0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, }, // I //
|
|
|
+ {0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x38, 0x00, 0x00, }, // J //
|
|
|
+ {0x00, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0x00, 0x00, }, // K //
|
|
|
+ {0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, }, // L //
|
|
|
+ {0x00, 0xc6, 0xee, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, }, // M //
|
|
|
+ {0x00, 0xc6, 0xe6, 0xe6, 0xf6, 0xf6, 0xde, 0xde, 0xce, 0xce, 0xc6, 0x00, 0x00, }, // N //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // O //
|
|
|
+ {0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, }, // P //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xda, 0xe6, 0x7c, 0x03, 0x00, }, // Q //
|
|
|
+ {0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0xfc, 0xd8, 0xcc, 0xcc, 0xc6, 0xc6, 0x00, 0x00, }, // R //
|
|
|
+ {0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0x30, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // S //
|
|
|
+ {0x00, 0xfe, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, }, // T //
|
|
|
+ {0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // U //
|
|
|
+ {0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, }, // V //
|
|
|
+ {0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xee, 0xee, 0xc6, 0x00, 0x00, }, // W //
|
|
|
+ {0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, }, // X //
|
|
|
+ {0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, }, // Y //
|
|
|
+ {0x00, 0xfe, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, }, // Z //
|
|
|
+ {0x0e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, }, // [
|
|
|
+ {0x00, 0xc0, 0xc0, 0xe0, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x06, 0x06, 0x00, 0x00, }, // odwrotny /
|
|
|
+ {0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x70, 0x00, }, // ]
|
|
|
+ {0x18, 0x3c, 0x7e, 0xdb, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, }, // ^ ↑
|
|
|
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, }, // _
|
|
|
+ {0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, // `
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0xc6, 0xc6, 0xc6, 0x3a, 0x00, 0x00, }, // a //
|
|
|
+ {0xc0, 0xc0, 0xc0, 0xdc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xdc, 0x00, 0x00, }, // b //
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, }, // c //
|
|
|
+ {0x06, 0x06, 0x06, 0x3e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x3a, 0x00, 0x00, }, // d //
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, }, // e //
|
|
|
+ {0x1c, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, }, // f //
|
|
|
+ {0x00, 0x00, 0x06, 0x3a, 0xcc, 0xcc, 0xcc, 0x38, 0x60, 0xfc, 0xc6, 0xc6, 0x7c, }, // g //
|
|
|
+ {0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, }, // h //
|
|
|
+ {0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, }, // i //
|
|
|
+ {0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xd8, 0x70, }, // j //
|
|
|
+ {0xc0, 0xc0, 0xc0, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0x00, 0x00, }, // k //
|
|
|
+ {0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, }, // l //
|
|
|
+ {0x00, 0x00, 0x00, 0xec, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, }, // m //
|
|
|
+ {0x00, 0x00, 0x00, 0xdc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, }, // n //
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // o //
|
|
|
+ {0x00, 0x00, 0x00, 0xdc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xdc, 0xc0, 0xc0, }, // p //
|
|
|
+ {0x00, 0x00, 0x00, 0x3a, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x3e, 0x06, 0x06, }, // q //
|
|
|
+ {0x00, 0x00, 0x00, 0xdc, 0xe6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, }, // r //
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x30, 0x0c, 0x06, 0xc6, 0x7c, 0x00, 0x00, }, // s //
|
|
|
+ {0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1c, 0x00, 0x00, }, // t //
|
|
|
+ {0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x76, 0x00, 0x00, }, // u //
|
|
|
+ {0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x38, 0x38, 0x00, 0x00, }, // v //
|
|
|
+ {0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, }, // w //
|
|
|
+ {0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0xc6, 0x00, 0x00, }, // x //
|
|
|
+ {0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x66, 0x3e, 0x06, 0x0e, 0xfc, }, // y //
|
|
|
+ {0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xfe, 0x00, 0x00, }, // z //
|
|
|
+ {0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, // 0x7b ° //
|
|
|
+ {0x7C, 0x42, 0x42, 0x7C, 0x48, 0x44, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, }, // 0x7c małe R na górze
|
|
|
+ {0xff, 0xff, 0xff, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x3c, 0x3c, 0x3c, }, // 0x7d brzydki wykrzyknik
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0xc6, 0xc6, 0xc6, 0x3a, 0x18, 0x0c, }, // 0x7e ą //
|
|
|
+ {0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, }, // 0x7f ę //
|
|
|
+ {0x00, 0x38, 0x18, 0x18, 0x18, 0x1e, 0x78, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, }, // 0x80 ł //
|
|
|
+ {0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0x30, 0x0c, 0x06, 0xc6, 0x7c, 0x00, 0x00, }, // 0x81 ś //
|
|
|
+ {0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // 0x82 ó //
|
|
|
+ {0x18, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, }, // 0x83 Ó //
|
|
|
+ {0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, }, // 0x84 ramka pusta
|
|
|
+ {0x00, 0x00, 0x00, 0xff, 0x83, 0x85, 0x85, 0xc9, 0xa9, 0x91, 0xff, 0x00, 0x00, }, // 0x85 ramka z ptaszkiem
|
|
|
+ {0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xdb, 0x7e, 0x3c, 0x18, }, // 0x86 ↓
|
|
|
+};
|
|
|
+
|
|
|
+void GLCD_Clear(void){ //zastępuję funkcję z sed1335.c
|
|
|
+ unsigned int i;
|
|
|
+
|
|
|
+ GLCD_SetCursorAddress(SED1335_GRAPHICSTART);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ for(i = 0; i < SED1335_GRAPHICSIZE; i++)
|
|
|
+ GLCD_WriteData(0x00);
|
|
|
+
|
|
|
+ GLCD_SetCursorAddress(SED1335_TGRAPHICSTART);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ for(i = 0; i < SED1335_GRAPHICSIZE; i++)
|
|
|
+ GLCD_WriteData(0x00);
|
|
|
+
|
|
|
+ GLCD_WriteCommand(SED1335_DISP_ON);
|
|
|
+ GLCD_WriteData(SED1335_FLASH);
|
|
|
+}
|
|
|
+
|
|
|
+void GLCD_TLGoTo(unsigned int x, unsigned int y){
|
|
|
+ GLCD_SetCursorAddress(SED1335_TGRAPHICSTART + y*80 + x*2);
|
|
|
+}
|
|
|
+
|
|
|
+static unsigned char cur_x, cur_y;
|
|
|
+
|
|
|
+void GLCD_GraphicGoTo_T(unsigned int x, unsigned int y){
|
|
|
+ GLCD_SetCursorAddress(SED1335_GRAPHICSTART + y*80 + x*2);
|
|
|
+}
|
|
|
+
|
|
|
+void grayscale(const unsigned char * const c_ptr){ //zamień dane z FontTable na takie do wysłania do lcd, i wyślij
|
|
|
+ unsigned char x;
|
|
|
+ unsigned char i,j;
|
|
|
+ char c = pgm_read_byte(c_ptr);
|
|
|
+ for(i=0;i<2;i++){
|
|
|
+ x = 0;
|
|
|
+ for(j=0;j<4;j++){
|
|
|
+ x <<= 2;
|
|
|
+ if(c&128){
|
|
|
+ x |= color;
|
|
|
+ }
|
|
|
+ c <<= 1;
|
|
|
+ }
|
|
|
+ GLCD_WriteData(x);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/*inline static void ch_pos(void){
|
|
|
+ if(cur_x>X_MAX){
|
|
|
+ cur_x = 0;
|
|
|
+ if(++cur_y>Y_MAX) cur_y = 0;
|
|
|
+ }
|
|
|
+}*/
|
|
|
+#define ch_pos() if(cur_x>X_MAX){ cur_x=0; if(++cur_y>Y_MAX) cur_y=0; }
|
|
|
+
|
|
|
+void cursor(unsigned char x, unsigned char y){ //ustaw kursor tekstowy
|
|
|
+ if(x>X_MAX) x=X_MAX;
|
|
|
+ if(y>Y_MAX) y=Y_MAX;
|
|
|
+ cur_x = x;
|
|
|
+ cur_y = y;
|
|
|
+}
|
|
|
+
|
|
|
+void background(unsigned char cnt){ //rysowanie tła - do reszty funkcji
|
|
|
+ unsigned char i, tmp_cnt, tmp_data;
|
|
|
+ for(i=0;i<13;i++){
|
|
|
+ tmp_data = blackbg?((i==0||i==12)&&blackbg!=2?0xaa:0x55):0;
|
|
|
+ tmp_cnt = cnt;
|
|
|
+ GLCD_GraphicGoTo_T(cur_x, cur_y*15+i);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ while(tmp_cnt--){
|
|
|
+ GLCD_WriteData(tmp_data);
|
|
|
+ GLCD_WriteData(tmp_data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GLCD_WriteCommand(SED1335_DISP_ON);
|
|
|
+ GLCD_WriteData(SED1335_FLASH);
|
|
|
+}
|
|
|
+
|
|
|
+void puttext_P(const char *text){ //wypisz tekst z flasha
|
|
|
+ unsigned char i=0;
|
|
|
+ static char buffer[X_MAX+1];
|
|
|
+ while((buffer[i++] = pgm_read_byte(text++)));
|
|
|
+ puttext(buffer);
|
|
|
+}
|
|
|
+
|
|
|
+void puttext(const char *text){ //wypisz tekst z ramu
|
|
|
+ register unsigned char cnt=0, i, j;
|
|
|
+ cnt = strlen(text);
|
|
|
+
|
|
|
+ background(cnt);
|
|
|
+
|
|
|
+ for(i=0;i<13;i++){
|
|
|
+ GLCD_TLGoTo(cur_x, cur_y*15+i);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ for(j=0;j<cnt;j++){
|
|
|
+ grayscale(&FontTable[text[j]-' '][i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cur_x += cnt;
|
|
|
+ ch_pos();
|
|
|
+ GLCD_WriteCommand(SED1335_DISP_ON);
|
|
|
+ GLCD_WriteData(SED1335_FLASH);
|
|
|
+}
|
|
|
+
|
|
|
+void putchar(char c){ //wypisz jeden znak
|
|
|
+ unsigned char i;
|
|
|
+ background(1);
|
|
|
+ for(i=0; i<13; i++){
|
|
|
+ GLCD_TLGoTo(cur_x, cur_y*15+i);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ grayscale(&FontTable[c-' '][i]);
|
|
|
+ }
|
|
|
+ ++cur_x;
|
|
|
+ ch_pos();
|
|
|
+ GLCD_WriteCommand(SED1335_DISP_ON);
|
|
|
+ GLCD_WriteData(SED1335_FLASH);
|
|
|
+}
|
|
|
+
|
|
|
+void clear_to(unsigned char pos){ //wyczyść do pozycji
|
|
|
+ unsigned char i, j, cnt;
|
|
|
+ cnt = pos-cur_x+1; //ilość znaków do wyczyszczenia
|
|
|
+
|
|
|
+ background(cnt);
|
|
|
+
|
|
|
+ for(i=0;i<13;i++){
|
|
|
+ GLCD_TLGoTo(cur_x, cur_y*15+i);
|
|
|
+ GLCD_WriteCommand(SED1335_MWRITE);
|
|
|
+ for(j=0;j<cnt;j++){
|
|
|
+ GLCD_WriteData(0); //dwa razy bo 2bpp, stąd dwa bajty na znak
|
|
|
+ GLCD_WriteData(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(pos > X_MAX){
|
|
|
+ cur_x = 0;
|
|
|
+ if(++cur_y > Y_MAX) cur_y = 0;
|
|
|
+ } else {
|
|
|
+ cur_x = pos+1;
|
|
|
+ }
|
|
|
+ GLCD_WriteCommand(SED1335_DISP_ON);
|
|
|
+ GLCD_WriteData(SED1335_FLASH);
|
|
|
+}
|
|
|
+/*
|
|
|
+void clearline(void){ //wyczyść do końca linii - nie używać - zamiast tego jest makro
|
|
|
+ while(cur_x <= X_MAX){
|
|
|
+ putchar(' ');
|
|
|
+ if(!cur_x) break;
|
|
|
+ }
|
|
|
+}*/
|
|
|
+
|
|
|
+
|