summaryrefslogtreecommitdiffstats
path: root/stm32/app/font8x8.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2020-06-18 16:43:57 +0100
committerfishsoupisgood <github@madingley.org>2020-06-18 16:43:57 +0100
commit1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99 (patch)
tree3bd34e32d8073ebe7d3fe9f0bcff011562832797 /stm32/app/font8x8.c
parente41764fceeabb1cdb6a7a299e00f2166a6f6ac32 (diff)
downloadrobs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.tar.gz
robs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.tar.bz2
robs_speedo-1d4ac4c0e0300cc0b4fb0ee66cbbb8aa2b18dd99.zip
fix text wrappingHEADmaster
Diffstat (limited to 'stm32/app/font8x8.c')
-rw-r--r--stm32/app/font8x8.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/stm32/app/font8x8.c b/stm32/app/font8x8.c
index c5c9d05..e9f3d4e 100644
--- a/stm32/app/font8x8.c
+++ b/stm32/app/font8x8.c
@@ -264,15 +264,25 @@ font8x8_put_ch (uint8_t *vram, unsigned ch, unsigned x, unsigned y)
{
unsigned shift = y & 7;
unsigned page = y >> 3;
+ unsigned xe;
+
+ if (x >= SSD1306_WIDTH) return;
+
+ xe = x + 8;
+
+ if (xe > SSD1306_WIDTH) xe = SSD1306_WIDTH;
+
x += page * SSD1306_WIDTH;
+ xe += page * SSD1306_WIDTH;
- oled_blit_strip (vram, x, x + 8, 0xff << shift, shift, font8x8[ch]);
+ oled_blit_strip (vram, x, xe, 0xff << shift, shift, font8x8[ch]);
if (shift) {
x += SSD1306_WIDTH;
+ xe += SSD1306_WIDTH;
shift = 8 - shift;
- oled_blit_strip (vram, x, x + 8, 0xff >> shift, -shift, font8x8[ch]);
+ oled_blit_strip (vram, x, xe, 0xff >> shift, -shift, font8x8[ch]);
}
}