diff options
author | joeycastillo <joeycastillo@utexas.edu> | 2021-10-18 15:37:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 15:37:41 -0400 |
commit | 6210e1c233a3ee66274389e85889b0681102378d (patch) | |
tree | ec94a012f533e8f7017223648321c46c3c9796f4 /watch-library/watch/watch_slcd.c | |
parent | 84c0fbfa2a68dc3c29b989947567d111e70a037b (diff) | |
parent | 32710098577c982123d9391132165c0b02a57482 (diff) | |
download | Sensor-Watch-6210e1c233a3ee66274389e85889b0681102378d.tar.gz Sensor-Watch-6210e1c233a3ee66274389e85889b0681102378d.tar.bz2 Sensor-Watch-6210e1c233a3ee66274389e85889b0681102378d.zip |
Merge pull request #17 from joeycastillo/wip-launcher
Resolves #13
Diffstat (limited to 'watch-library/watch/watch_slcd.c')
-rw-r--r-- | watch-library/watch/watch_slcd.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/watch-library/watch/watch_slcd.c b/watch-library/watch/watch_slcd.c index 58e1da7f..08f8c0e3 100644 --- a/watch-library/watch/watch_slcd.c +++ b/watch-library/watch/watch_slcd.c @@ -115,8 +115,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 @@ -167,9 +167,23 @@ inline void watch_clear_pixel(uint8_t com, uint8_t seg) { slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(com, seg)); } +void watch_clear_display() { + SLCD->SDATAL0.reg = 0; + SLCD->SDATAL1.reg = 0; + SLCD->SDATAL2.reg = 0; +} + 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]; @@ -188,7 +202,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) { |