PT6523 text (font)

This commit is contained in:
Tester23
2023-10-28 18:58:39 +02:00
parent a1e3886dae
commit c000268ba3
4 changed files with 170 additions and 1 deletions

View File

@ -1068,6 +1068,7 @@
<ClInclude Include="src\driver\drv_dht_internal.h" />
<ClInclude Include="src\driver\drv_ht16k33.h" />
<ClInclude Include="src\driver\drv_max72xx_internal.h" />
<ClInclude Include="src\driver\drv_pt6523_font.h" />
<ClInclude Include="src\driver\drv_sgp.h" />
<ClInclude Include="src\driver\drv_sht3x.h" />
<ClInclude Include="src\driver\drv_sm2235.h" />

View File

@ -1304,6 +1304,9 @@
<ClInclude Include="src\littlefs\our_lfs.h">
<Filter>LFS</Filter>
</ClInclude>
<ClInclude Include="src\driver\drv_pt6523_font.h">
<Filter>Drv</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\platforms\bk7231t\bk7231t_os\beken378\func\include\net_param_pub.h" />

View File

@ -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();

View File

@ -0,0 +1,115 @@
/*
14 Segment Display Data for PT6523.
Created by F?rat SOYG<59>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}, //<2F> - 199
// {14, 58}, //<2F> - 214
// {10, 42}, //<2F> - 220
// {14, 58}, //<2F> - 246
// {10, 42}, //<2F> - 252
// {0, 0}, //? - 286
// {0, 0}, //? - 287
// {0, 0}, //? - 304
// {0, 0}, //<2F> - 350
// {0, 0}, //<2F> - 351