slcd: add more special cases

This commit is contained in:
Joey Castillo 2021-10-04 10:48:04 -04:00
parent c1ec7734c9
commit 7f8973a8cc

View file

@ -114,8 +114,8 @@ static const uint8_t Character_Set[] =
0b01010000, // r
0b01101101, // s
0b01111000, // t
0b01100010, // u (appears as superscript to work in more positions)
0b01100010, // v (appears as superscript to work in more positions)
0b01100010, // u (appears in (u)pper half to work in more positions)
0b00011100, // v (looks like u but in the lower half)
0b10111110, // w (only works in position 0)
0b01111110, // x
0b01101110, // y
@ -169,8 +169,16 @@ void watch_clear_display() {
}
void watch_display_character(uint8_t character, uint8_t position) {
// handle lowercase 7 if needed
if (character == '7' && (position == 4 || position == 6)) character = '&';
// special cases for positions 4 and 6
if (position == 4 || position == 6) {
if (character == '7') character = '&'; // "lowercase" 7
if (character == 'v') character = 'u'; // bottom segment duplicated, so show in top half
if (character == 'J') character = 'j'; // same
} else if (position != 4 && position != 6) {
if (character == 'u') character = 'v'; // we can use the bottom segment; move to lower half
if (character == 'j') character = 'J'; // same but just display a normal J
}
if (position == 0) slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(0, 15)); // clear funky ninth segment
uint64_t segmap = Segment_Map[position];
uint64_t segdata = Character_Set[character - 0x20];
@ -189,7 +197,8 @@ void watch_display_character(uint8_t character, uint8_t position) {
segmap = segmap >> 8;
segdata = segdata >> 1;
}
if (character == 'T' && position == 1) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(1, 12));
if (character == 'T' && position == 1) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(1, 12)); // add descender
else if (position == 0 && (character == 'B' || character == 'D')) slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(0, 15)); // add funky ninth segment
}
void watch_display_string(char *string, uint8_t position) {