diff --git a/openBeken_win32_mvsc2017.vcxproj b/openBeken_win32_mvsc2017.vcxproj index 3dce08fa6..967126916 100644 --- a/openBeken_win32_mvsc2017.vcxproj +++ b/openBeken_win32_mvsc2017.vcxproj @@ -1068,6 +1068,7 @@ + diff --git a/openBeken_win32_mvsc2017.vcxproj.filters b/openBeken_win32_mvsc2017.vcxproj.filters index 7119c113e..d7c35e177 100644 --- a/openBeken_win32_mvsc2017.vcxproj.filters +++ b/openBeken_win32_mvsc2017.vcxproj.filters @@ -1304,6 +1304,9 @@ LFS + + Drv + diff --git a/src/driver/drv_pt6523.c b/src/driver/drv_pt6523.c index 8a9c91e4a..f2e14f2a0 100644 --- a/src/driver/drv_pt6523.c +++ b/src/driver/drv_pt6523.c @@ -12,6 +12,8 @@ #include "../httpserver/new_http.h" #include "../hal/hal_pins.h" +#include "drv_pt6523_font.h" + byte pt_inh = 10; byte pt_ce = 11; byte pt_clk = 24; @@ -22,6 +24,7 @@ byte g_address = 130; byte g_volumeStart = 0; byte g_volumeEnd = 8; byte g_volumeDir = 1; +bool g_symbolDisc; void PT6523_AnimateVolume(int levelValue) { float convertedLevelValue = @@ -98,7 +101,50 @@ void PT6523_Init() } int loop = 0; - +int _containerSize = 16; +byte g_container[16]; +void PT6523_SetLetters() { + byte j = 1; + int _n = 0; + for (int i = 0; i <= 14; i += 2) { + g_screen[i] = (g_container[_n] << j) | (g_container[_n + 1] >> (8 - j)); + if (i < 2) { + g_screen[i + 1] = g_container[_n + 1] << j; + } + else if (i >= _containerSize) { + g_screen[i] = g_container[_n + 1]; + g_screen[i + 1] = 0; + } + else { + g_screen[i + 1] = + (g_container[_n + 1] << j) | (g_container[_n + 2] >> (7 - j)); + } + if ((_n + 2) > _containerSize) { + _n = 0; + g_screen[i + 1] = + g_container[_containerSize] << j | g_container[0] >> (7 - j); + } + else { + _n += 2; + } + j++; + } +} +void PT6523_DrawString(char gk[]) { + int d = 0; + for (int i = 0; i < 8; i++) { + int c = gk[i] - 32; + if (c >= 0 && c <= 94) { + g_container[d] = pt_character14SEG[c][0]; + g_container[d + 1] = pt_character14SEG[c][1]; + } + else { + g_container[d] = 0; + g_container[d + 1] = 0; + } + d += 2; + } +} void PT6523_RunFrame() { for (int i = 0; i < sizeof(g_screen); i++) { @@ -109,7 +155,11 @@ void PT6523_RunFrame() // Maybe there is some specal turn-off bit here? g_symbols[i] = 0x0;// ff;// rand(); } + PT6523_DrawString("OOOOOOOOOO"); + PT6523_SetLetters(); PT6523_AnimateVolume(loop); + g_symbolDisc = loop % 2; + BIT_SET_TO(g_screen[7], 3, g_symbolDisc); loop++; loop %= 8; PT6523_Print(); diff --git a/src/driver/drv_pt6523_font.h b/src/driver/drv_pt6523_font.h new file mode 100644 index 000000000..12acaf5d5 --- /dev/null +++ b/src/driver/drv_pt6523_font.h @@ -0,0 +1,115 @@ +/* + 14 Segment Display Data for PT6523. + Created by F?rat SOYGÜL, 20 Aral?k 200x11 + (https://github.com/firatsoygul/PT6523) +*/ + +const byte pt_character14SEG[95][2] = { + {0, 0}, // SPACE - ASCII 32 + {0, 132}, // ! + {2, 0}, // " + {31, 255}, // # + {2, 242}, // $ + {5, 24}, // % + {28, 244}, // & + {2, 0}, // ' + {0, 12}, // ( + {3, 0}, // ) + {7, 28}, // * + {4, 144}, // + + {0, 4}, // , + {4, 0}, // - + {1, 0}, // . + {1, 8}, // / + {24, 99}, // 0 - ASCII 48 + {0, 11}, // 1 + {12, 113}, // 2 + {4, 115}, // 3 + {20, 19}, // 4 + {20, 114}, // 5 + {28, 114}, // 6 + {0, 67}, // 7 + {28, 115}, // 8 + {20, 115}, // 9 - ASCII 57 + {4, 32}, // : + {5, 0}, // ; + {3, 0}, // > + {4, 48}, // = + {0, 12}, // < + {12, 81}, // ? + {25, 101}, // @ + {28, 83}, // A - ASCII 65 + {0, 243}, // B + {24, 96}, // C + {0, 227}, // D + {28, 112}, // E + {28, 64}, // F + {24, 114}, // G + {28, 19}, // H + {0, 224}, // I + {8, 35}, // J + {28, 12}, // K + {24, 32}, // L + {26, 11}, // M + {26, 7}, // N + {24, 99}, // O + {28, 81}, // P + {24, 103}, // Q + {28, 85}, // R + {2, 114}, // S + {0, 192}, // T + {24, 35}, // U + {25, 8}, // V + {25, 7}, // W + {3, 12}, // X + {2, 19}, // Y + {1, 104}, // Z + {0, 12}, // [ - ASCII 91 + {0, 8}, //'\' + {3, 0}, // ] + {1, 4}, // ^ + {0, 32}, // _ + {2, 0}, // ` + {12, 116}, // a - ASCII 96 + {24, 50}, // b + {12, 48}, // c + {12, 51}, // d + {28, 113}, // e + {28, 64}, // f + {20, 115}, // g + {28, 18}, // h + {10, 0}, // i + {8, 35}, // j + {28, 12}, // k + {24, 0}, // l + {26, 11}, // M + {12, 18}, // n + {12, 50}, // o + {28, 81}, // P + {24, 103}, // Q + {12, 0}, // r + {0, 52}, // s + {0, 192}, // T + {8, 34}, // u + {9, 0}, // v + {9, 6}, // w + {3, 12}, // X + {20, 51}, // y + {5, 32}, // z + {0, 12}, // { - ASCII 123 + {0, 128}, // | + {3, 0}, // } + {4, 0}, // ~ - ASCII 126 +}; + + +// {21, 80}, //Ç - 199 +// {14, 58}, //Ö - 214 +// {10, 42}, //Ü - 220 +// {14, 58}, //ö - 246 +// {10, 42}, //ü - 252 +// {0, 0}, //? - 286 +// {0, 0}, //? - 287 +// {0, 0}, //? - 304 +// {0, 0}, //ª - 350 +// {0, 0}, //º - 351 \ No newline at end of file