summaryrefslogtreecommitdiffstats
path: root/stm32/app/font8x16.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm32/app/font8x16.c')
-rw-r--r--stm32/app/font8x16.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/stm32/app/font8x16.c b/stm32/app/font8x16.c
index 4e3b5d6..c015f50 100644
--- a/stm32/app/font8x16.c
+++ b/stm32/app/font8x16.c
@@ -1033,27 +1033,37 @@ font8x16_put_ch (uint8_t *vram, unsigned ch, unsigned x, unsigned y)
unsigned shift = y & 7;
unsigned page = y >> 3;
unsigned mask;
+ 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, font8x16[ch]);
+ oled_blit_strip (vram, x, xe, 0xff << shift, shift, font8x16[ch]);
x += SSD1306_WIDTH;
+ xe += SSD1306_WIDTH;
shift = 8 - shift;
mask = 0xff >> shift;
if (shift)
- oled_blit_strip (vram, x, x + 8, mask, -shift, font8x16[ch]);
+ oled_blit_strip (vram, x, xe, mask, -shift, font8x16[ch]);
shift = y & 7;
- oled_blit_strip (vram, x, x + 8, ~mask & (0xff << shift), shift,
+ oled_blit_strip (vram, x, xe, ~mask & (0xff << shift), shift,
&font8x16[ch][8]);
if (shift) {
x += SSD1306_WIDTH;
+ xe += SSD1306_WIDTH;
shift = 8 - shift;
- oled_blit_strip (vram, x, x + 8, 0xff >> shift, -shift,
+ oled_blit_strip (vram, x, xe, 0xff >> shift, -shift,
&font8x16[ch][8]);
}