diff options
author | fishsoupisgood <github@madingley.org> | 2020-06-18 16:43:57 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-06-18 16:43:57 +0100 |
commit | 1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99 (patch) | |
tree | 3bd34e32d8073ebe7d3fe9f0bcff011562832797 /stm32/app/font21x32.c | |
parent | e41764fceeabb1cdb6a7a299e00f2166a6f6ac32 (diff) | |
download | robs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.tar.gz robs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.tar.bz2 robs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.zip |
Diffstat (limited to 'stm32/app/font21x32.c')
-rw-r--r-- | stm32/app/font21x32.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/stm32/app/font21x32.c b/stm32/app/font21x32.c index 476af5e..5ac0f53 100644 --- a/stm32/app/font21x32.c +++ b/stm32/app/font21x32.c @@ -109,19 +109,30 @@ static const uint8_t font21x32[][84] = { void font21x32_put_ch (uint8_t *vram, unsigned ch, unsigned x) { + unsigned xe; + if ((ch >= '0') && (ch <= '9')) ch -= '0' - 1; else ch = 0; + if (x >= SSD1306_WIDTH) return; + + xe = x + 21; + + if (xe > SSD1306_WIDTH) xe = SSD1306_WIDTH; + - oled_blit_strip (vram, x, x + 21, 0xff, 0, font21x32[ch]); + oled_blit_strip (vram, x, xe, 0xff, 0, font21x32[ch]); x += SSD1306_WIDTH; - oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][21]); + xe += SSD1306_WIDTH; + oled_blit_strip (vram, x, xe, 0xff, 0, &font21x32[ch][21]); x += SSD1306_WIDTH; - oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][42]); + xe += SSD1306_WIDTH; + oled_blit_strip (vram, x, xe, 0xff, 0, &font21x32[ch][42]); x += SSD1306_WIDTH; - oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][63]); + xe += SSD1306_WIDTH; + oled_blit_strip (vram, x, xe, 0xff, 0, &font21x32[ch][63]); } |