This ih my prototipe program for displaying to vfd Noritake via SC16IS752 (i2c to Serial). for program which i use, i say sorry and you can message me for i publish. thank
Revision 1:da53a4d93c33, committed 2016-08-12
- Comitter:
- irsanjul
- Date:
- Fri Aug 12 04:37:13 2016 +0000
- Parent:
- 0:51be68b5e97c
- Commit message:
- My Prototipe
Changed in this revision
diff -r 51be68b5e97c -r da53a4d93c33 Katakata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Katakata.h Fri Aug 12 04:37:13 2016 +0000 @@ -0,0 +1,34 @@ +#ifndef KATAKATA_H +#define KATAKATA_H + +char invertOn[3] = {0x1F, 'r', 1}; +char invertOff[3] = {0x1F, 'r', 0}; +const char * MMe = "* Main Menu *\r\n"; +const char * Sat = "1 "; +const char * Ent = "Entrance [1 /1 ]\r\n"; +const char * Dua = "2 "; +const char * Exi = "Exit\r\n"; +const char * Tig = "3 "; +const char * SCo = "Set Config\r\n"; +const char * Emp = "4 "; +const char * SKe = "Set Key\r\n"; +const char * Lim = "5 "; +const char * MDa = "Mode Data\r\n"; +const char * MEn = " Manual Entrance \r\n\n"; +const char * MEx = " Manual Exit \r\n\n"; +const char * MKo = " Mode Konfigurasi \r\n\n"; +const char * Set = " Set Key \r\n\n"; +const char * Mod = " Mode Data \r\n"; +const char * His = "History KTM \r\n"; +const char * Mas = "\n\n\rMasukkan Kartu\n\r"; +const char * PAS = "PAS...\n\n\r"; +const char * MTN = "PAS/MTN...\n\n\r"; +const char * PUL = "[PUL/PAS/TEK]\n\n\r"; +const char * ENT = "\n\n\r"; +const char * Noo = "No "; +const char * Bat = "Batal"; +const char * Yes = "Yes"; +const char * Lan = "Lanjut "; +uint8_t sym[] = {0xFE, 0x2B, 0x29, 0x29, 0x2B, 0xFE}; + +#endif \ No newline at end of file
diff -r 51be68b5e97c -r da53a4d93c33 Noritake.lib --- a/Noritake.lib Wed Aug 10 03:42:26 2016 +0000 +++ b/Noritake.lib Fri Aug 12 04:37:13 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/irsanjul/code/Noritake/#cbd2824917b1 +https://developer.mbed.org/users/irsanjul/code/Noritake/#1a088a2b53ec
diff -r 51be68b5e97c -r da53a4d93c33 SC16IS752.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SC16IS752.lib Fri Aug 12 04:37:13 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/irsanjul/code/SC16IS752/#85070c9144a6
diff -r 51be68b5e97c -r da53a4d93c33 SC16IS75x.lib --- a/SC16IS75x.lib Wed Aug 10 03:42:26 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/users/irsanjul/code/SC16IS752/#ad254d5f94b1
diff -r 51be68b5e97c -r da53a4d93c33 debug.h --- a/debug.h Wed Aug 10 03:42:26 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#ifndef _DEBUG_H -#define _DEBUG_H - -#if 1 // colored terminal output using ANSI escape sequences - #define COL(c) "\033[" c - #else - #define COL(c) - #endif -#define DEF COL("39m") -#define BLA COL("30m") -#define RED COL("31m") -#define GRE COL("32m") -#define YEL COL("33m") -#define BLU COL("34m") -#define MAG COL("35m") -#define CYA COL("36m") -#define WHY COL("37m") - -#endif \ No newline at end of file
diff -r 51be68b5e97c -r da53a4d93c33 main.cpp --- a/main.cpp Wed Aug 10 03:42:26 2016 +0000 +++ b/main.cpp Fri Aug 12 04:37:13 2016 +0000 @@ -5,45 +5,221 @@ #include "mbed.h" #include "query.h" +#include "Katakata.h" +#include <sstream> +#include <vector> DigitalOut myled(LED1); Serial dbg(USBTX, USBRX); Noritake_VFD_GU7000 vfd(p28, p27); -//uint8_t PGN[8][123] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x31,0x3F,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x0F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, -// 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x3F,0x7F,0xCE,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,0xF8,0xFC,0xFE,0xFF,0x7F,0x1F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x78,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xFC,0xFF,0xFF,0xFF,0x7F,0x3F,0x0F,0x03,0x00,0x00,0x0F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFC,0xF0,0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF8,0xFF,0xFF,0x7F,0x7F,0xFF,0xF7,0xE0,0xE0,0xE0,0xF0,0xF0,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x3E,0x7C,0x7C,0xF8,0xF8,0xF8,0xF8,0xFC,0xFF,0xFF,0xFF,0x7F,0x7F,0x1F, -// 0x00,0x00,0x01,0x03,0x0F,0x1F,0x1F,0x3F,0x7F,0x7F,0xF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F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, -// 0x20,0x20,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3E,0x3C,0x3C,0x38,0x38,0x30,0x30,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0F,0x1F,0x07,0x03,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3C,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x30,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x30,0x30, -// 0x07,0x07,0x01,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x83,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,0xC0,0xC0,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, -// 0xE0,0xF8,0xFE,0x7F,0x3F,0x1F,0x0F,0x07,0x07,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x11,0x7D,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x1D,0x24,0x25,0x18,0x00,0x03,0x1C,0x00,0x00,0x23,0x18,0x00,0x0F,0x01,0x21,0x25,0x1C,0x00,0x07,0x18,0x00,0x20,0x0E,0x11,0x20,0x01,0x13,0x18,0x00,0x18,0x03,0x02,0x08,0x10,0x00,0x00,0x00,0x00,0x3F,0x70,0x80,0x0E,0x11,0x20,0x21,0x32,0x1C,0x00,0x0F,0x10,0x20,0x00,0x00,0x00,0x00,0x0E,0xF0,0x00,0x1E,0x00,0x03,0x3E,0xE0,0x80,0x1F,0x05,0x20,0x21,0x18, -// 0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0x83,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,0x40,0x20,0x20,0x40,0x80,0x00,0x20,0x40,0x80,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}; - -uint8_t PGN[8][123] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x01,0x01,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,0x01,0x01,0x03,0x07,0x19,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0x7F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x3F,0x1F,0x1F,0x0F,0x07,0x07,0x0F,0x1F,0x1E,0x3E,0x3E,0x3E,0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F,0x1F,0x1F,0x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,0xFE,0xFC,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,0xF0,0xF8,0xF8,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0xF8,0xF8,0xF8,0xF0,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xE0,0xFC,0xFF,0x3F,0x1F,0x0F,0x07,0x07,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x08,0xBE,0xFF,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x1A,0x12,0x12,0x0C,0x00,0x03,0x0C,0x10,0x10,0x13,0x0C,0x00,0x07,0x1A,0x12,0x12,0x0C,0x00,0x0F,0x18,0x10,0x00,0x07,0x08,0x10,0x10,0x1F,0x00,0x00,0x0F,0x01,0x01,0x0E,0x00,0x00,0x00,0x00,0x1F,0x32,0x22,0x00,0x07,0x08,0x10,0x10,0x19,0x0E,0x00,0x0F,0x18,0x10,0x00,0x00,0x00,0x03,0x0E,0x70,0x03,0x2E,0x00,0x1F,0x32,0x22,0x00,0x07,0x1A,0x12,0x12,0x0C, - 0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x83,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,0x80,0x80,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x20,0xA0,0xA0,0xA0,0xC0,0x00,0x00,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00 - }; -int main() +void Display_init() { vfd.GU7000_cursorOff(); vfd.GU7000_clearScreen(); +} + +void Main_Menu() +{ + vector<uint8_t> Vdat; - vfd.GU7000_clearScreen(); - for(int i=0; i<8; i++) + Vdat.insert(Vdat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MMe); i++) + Vdat.push_back((uint8_t) MMe[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Sat); i++) + Vdat.push_back((uint8_t) Sat[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Ent); i++) + Vdat.push_back((uint8_t) Ent[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Dua); i++) + Vdat.push_back((uint8_t) Dua[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Exi); i++) + Vdat.push_back((uint8_t) Exi[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Tig); i++) + Vdat.push_back((uint8_t) Tig[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(SCo); i++) + Vdat.push_back((uint8_t) SCo[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Emp); i++) + Vdat.push_back((uint8_t) Emp[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(SKe); i++) + Vdat.push_back((uint8_t) SKe[i]); + + Vdat.insert(Vdat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Lim); i++) + Vdat.push_back((uint8_t) Lim[i]); + Vdat.insert(Vdat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(MDa); i++) + Vdat.push_back((uint8_t) MDa[i]); + + uint8_t tmp[128]; + copy(Vdat.begin(), Vdat.end(), tmp); + const uint8_t* data = tmp; + vfd.print(data, Vdat.size()); + Vdat.clear(); +} + +int PreMenu = 0; // 0=Main Menu; 1=Entrance; 2=Exit; 3=Set Config; 4=Set Key; 5=Mode Data +void Sub_Menu(int Menu) +{ + if(Menu != PreMenu) + { + vfd.GU7000_clearScreen(); + PreMenu = Menu; + } + + if(Menu == 0) + { + Main_Menu(); + } + + vector<uint8_t> dat; + + // Set Header + switch(Menu) { - uint8_t buffer[123]; - for(int j=0; j<123; j++) - { - buffer[j] = PGN[i][j]; - } - vfd.GU7000_setCursor(0, 8 * i); - vfd.GU7000_drawImage(123, 8, buffer); + case 0: break; + case 1: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MEn); i++) + dat.push_back((uint8_t) MEn[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 2: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MEx); i++) + dat.push_back((uint8_t) MEx[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 3: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(MKo); i++) + dat.push_back((uint8_t) MKo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 4: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Set); i++) + dat.push_back((uint8_t) Set[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + break; + + case 5: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Mod); i++) + dat.push_back((uint8_t) Mod[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + dat.push_back('\n'); + break; + + case 6: dat.insert(dat.begin(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Mod); i++) + dat.push_back((uint8_t) Mod[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(His); i++) + dat.push_back((uint8_t) His[i]); + break; + } + + if(Menu != 0) + { + for(int i=0; i<strlen(Mas); i++) + dat.push_back((uint8_t) Mas[i]); } - wait(1); + + // Set Body + switch(Menu) + { + case 0: break; + case 1: + case 2: for(int i=0; i<strlen(PAS); i++) + dat.push_back((uint8_t) PAS[i]); + break; + + case 3: + case 4: for(int i=0; i<strlen(MTN); i++) + dat.push_back((uint8_t) MTN[i]); + break; + + case 5: for(int i=0; i<strlen(PUL); i++) + dat.push_back((uint8_t) PUL[i]); + break; + + case 6: for(int i=0; i<strlen(ENT); i++) + dat.push_back((uint8_t) ENT[i]); + break; + } + + // Set Footer + switch(Menu) + { + case 0: break; + case 6: + case 1: + case 2: + case 3: + case 4: dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Noo); i++) + dat.push_back((uint8_t) Noo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Bat); i++) + dat.push_back((uint8_t) Bat[i]); + break; + + case 5: dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Yes); i++) + dat.push_back((uint8_t) Yes[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Lan); i++) + dat.push_back((uint8_t) Lan[i]); + dat.insert(dat.end(), invertOn, invertOn+sizeof(invertOn)); + for(int i=0; i<strlen(Noo); i++) + dat.push_back((uint8_t) Noo[i]); + dat.insert(dat.end(), invertOff, invertOff+sizeof(invertOff)); + for(int i=0; i<strlen(Bat); i++) + dat.push_back((uint8_t) Bat[i]); + break; + } + + uint8_t tmp[128]; + copy(dat.begin(), dat.end(), tmp); + const uint8_t* data = tmp; + vfd.print(data, dat.size()); + dat.clear(); + + dbg.printf("Switch Menu is done\r\n"); } + +DigitalOut led(LED1); +Ticker run; +void runled() +{ + led =! led; +} + +int main() +{ + run.attach(&runled, 0.5); + Display_init(); + Main_Menu(); + set_time(1256729737); + while(1) + { + time_t t = time(NULL); + char buf[32]; + strftime(buf, 32, "%d/%m/%y %H:%M:%S", localtime(&t)); + vfd.printAt(1, 8, buf); + + vfd.GU7000_drawImageAt(122, 56, 6, 8, sym); + } + +}