summaryrefslogtreecommitdiff
path: root/stm/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm/lcd.c')
-rw-r--r--stm/lcd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/stm/lcd.c b/stm/lcd.c
index 0f645eb93..ee4f4da4e 100644
--- a/stm/lcd.c
+++ b/stm/lcd.c
@@ -198,8 +198,8 @@ void lcd_print_strn(const char *str, unsigned int len) {
chr = 127;
}
const uint8_t *chr_data = &font_petme128_8x8[(chr - 32) * 8];
- for (int i = 0; i < 8; i++) {
- lcd_out(LCD_DATA, chr_data[i]);
+ for (int j = 0; j < 8; j++) {
+ lcd_out(LCD_DATA, chr_data[j]);
}
}
@@ -207,3 +207,14 @@ void lcd_print_strn(const char *str, unsigned int len) {
sys_tick_delay_ms(200);
}
}
+
+// writes 8 vertical pixels
+// pos 0 is upper left, pos 1 is 8 pixels to right of that, pos 128 is 8 pixels below that
+void lcd_draw_pixel_8(int pos, int val) {
+ int page = pos / 128;
+ int offset = pos - (page * 128);
+ lcd_out(LCD_INSTR, 0xb0 | page); // page address set
+ lcd_out(LCD_INSTR, 0x10 | ((offset >> 4) & 0x0f)); // column address set upper
+ lcd_out(LCD_INSTR, 0x00 | (offset & 0x0f)); // column address set lower
+ lcd_out(LCD_DATA, val); // write data
+}