Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pa-pa/AskSinPP.git
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-pa committed Nov 8, 2019
2 parents dc1a81a + a09d264 commit 19ecad7
Showing 1 changed file with 100 additions and 2 deletions.
102 changes: 100 additions & 2 deletions displays/Lcd6749.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,71 @@ namespace as {
uint16_t s;
} seg16font[65] PROGMEM = {
/* ABCDEFGHIJKLMNOP */
#ifdef LCDREVERSED
{ '1', 0b0000011000000100 },
{ '2', 0b1101110000111000 },
{ '3', 0b1001111000111000 },
{ '4', 0b0010011000111000 },
{ '5', 0b1011101000111000 },
{ '6', 0b1111101000111000 },
{ '7', 0b0001100001111100 },
{ '8', 0b1111111000111000 },
{ '9', 0b1011111000111000 },
{ '0', 0b1111111001010100 },
{ '+', 0b0000000010111010 },
{ '-', 0b0000000000111000 },
{ '*', 0b0000000111111111 },
{ '/', 0b0000000001010100 },
{ '.', 0b0000100000000000 }, // no
{ ')', 0b0000000001000001 },
{ '$', 0b1011101010111010 },
{ '(', 0b0000000100000100 },
{ 'A', 0b0111111000111000 },
{ 'B', 0b1111100100011100 },
{ 'C', 0b1111100000000000 },
{ 'D', 0b1111111000000000 }, // bad = O
{ 'E', 0b1111100000011000 },
{ 'F', 0b0111100000011000 },
{ 'G', 0b1111101000100000 },
{ 'H', 0b0110011000111000 },
{ 'I', 0b1001100010010010 },
{ 'J', 0b1000111000000000 },
{ 'K', 0b0110000100011100 },
{ 'L', 0b1110000000000000 },
{ 'M', 0b0110011000010101 },
{ 'N', 0b0110011100010001 },
{ 'O', 0b1111111000000000 },
{ 'P', 0b0111110000111000 },
{ 'Q', 0b1111111100000000 },
{ 'R', 0b0111000100001100 },
{ 'S', 0b1011101000111000 },
{ 'T', 0b0001100010010010 },
{ 'U', 0b1110011000000000 },
{ 'V', 0b0110100001010100 },
{ 'W', 0b0110011101010000 },
{ 'X', 0b0000000101010101 },
{ 'Y', 0b0000000010010101 },
{ 'Z', 0b1001100001010100 },
{ '}', 0b0000000001011001 },
{ '_', 0b1000000000000000 },
{ '{', 0b0000000100110100 },
{ 'b', 0b1110001000111000 },
{ 'c', 0b1100000000111000 },
{ 'd', 0b1100011000111000 },
{ 'h', 0b0110001000111000 },
{ 'l', 0b0110000000000000 },
{ 'm', 0b0100001010111000 },
{ 'n', 0b0100001000111000 },
{ 'o', 0b1100001000111000 },
{ 'r', 0b0100000000011000 },
{ 't', 0b1110000000011000 },
{ 'u', 0b1100001000000000 },
{ 'v', 0b0100000001000000 },
{ 'w', 0b1100001010000000 },
{ '[', 0b1111100000000000 },
{ '|', 0b0000000010010010 },
{ ']', 0b1001111000000000 },
#else
{ '1', 0b0110000001000000 },
{ '2', 0b1101110000111000 },
{ '3', 0b1111100000111000 },
Expand Down Expand Up @@ -83,17 +148,27 @@ namespace as {
{ '[', 0b1001111000000000 },
{ '|', 0b0000000010010010 },
{ ']', 0b1111100000000000 },
#endif
{ ' ', 0b0000000000000000 },
{ 0, 0xFFFF }
};

const uint8_t segmap[3][16] PROGMEM= {
#ifdef LCDREVERSED
{ 0x60, 0x62, 0x63, 0x53, 0x47, 0x46, 0x44, 0x50,
0x54, 0x61, 0x45, 0x51, 0x55, 0x52, 0x56, 0x57 },
{ 0x40, 0x42, 0x43, 0x33, 0x27, 0x26, 0x24, 0x30,
0x34, 0x41, 0x25, 0x31, 0x35, 0x32, 0x36, 0x37 },
{ 0x14, 0x16, 0x17, 0x07, 0x03, 0x02, 0x00, 0x04,
0x10, 0x15, 0x01, 0x05, 0x11, 0x06, 0x12, 0x13 }
#else
{ 0x14, 0x16, 0x17, 0x07, 0x03, 0x02, 0x00, 0x04,
0x10, 0x15, 0x01, 0x05, 0x11, 0x06, 0x12, 0x13 },
{ 0x40, 0x42, 0x43, 0x33, 0x27, 0x26, 0x24, 0x30,
0x34, 0x41, 0x25, 0x31, 0x35, 0x32, 0x36, 0x37 },
{ 0x60, 0x62, 0x63, 0x53, 0x47, 0x46, 0x44, 0x50,
0x54, 0x61, 0x45, 0x51, 0x55, 0x52, 0x56, 0x57 }
#endif
};

template<uint8_t CS, uint8_t WR, uint8_t DT>
Expand Down Expand Up @@ -129,7 +204,11 @@ class LCD6749 {

for (uint8_t i = 0; i < 6; i++) { DATA(0); WR_pulse(); }

#ifdef LCDREVERSED
if (dot & 0x01) _lcdbuffer[2]|=0b00000010;
#else
if (dot & 0x01) _lcdbuffer[2]|=0b00001000;
#endif
if (dot & 0x02) _lcdbuffer[2]|=0b00000110;
for (uint8_t i=0; i<LCD6749_BUFSIZE; i++) {
uint8_t mask= 0x01;
Expand Down Expand Up @@ -215,23 +294,42 @@ class LCD6749 {
void printText(const char * t, uint8_t dot=NO_DOT) {
clearBuffer();

#ifdef LCDREVERSED
if (strlen(t) > 2) {
if ( t[2]=='.' ) dot = SINGLE_DOT;
if ( t[2]==':' ) dot = DOUBLE_DOT;
}
#else
if (strlen(t) > 1) {
if ( t[1]=='.' ) dot = SINGLE_DOT;
if ( t[1]==':' ) dot = DOUBLE_DOT;
}
#endif

uint8_t j = 0;
for (uint8_t i = 0; i < min(strlen(t), dot > NO_DOT ? 4 : 3); i++) {
#ifdef LCDREVERSED
if (dot > NO_DOT && i == 2) i++;
#else
if (dot > NO_DOT && i == 1) i++;
#endif
updateBuffer(j, t[i]);
j++;
}

updateDisplay(dot);
}

void printNumberAsFloat(uint16_t number) {
printNumber(number, true, SINGLE_DOT);
void printNumberAsFloat(int16_t number) {
if (number > 999) {
number = (number + 5) / 10;
printNumber(number, false, NO_DOT);
} else if (number < -99) {
number = (number - 5) / 10;
printNumber(number ,false, NO_DOT);
} else {
printNumber(number, false, SINGLE_DOT);
}
}

void printNumber(int16_t number, bool leadingZero) {
Expand Down

0 comments on commit 19ecad7

Please sign in to comment.