aboutsummaryrefslogtreecommitdiffstats
path: root/dogs.c
diff options
context:
space:
mode:
Diffstat (limited to 'dogs.c')
-rw-r--r--dogs.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/dogs.c b/dogs.c
index a2d3baf..65a34e7 100644
--- a/dogs.c
+++ b/dogs.c
@@ -136,7 +136,7 @@ void dogs_init_display()
CS_LOW;
dogs_reset();
CS_HIGH;
- chThdSleepMilliseconds(100);
+ chThdSleepS(TIME_MS2I(100) / 64);
CS_LOW;
dogs_set_scroll_line(0);
dogs_set_segdir(true);
@@ -146,7 +146,7 @@ void dogs_init_display()
dogs_set_bias(true);
dogs_set_power(0x07);
dogs_set_vlcd_ratio(7);
- dogs_set_contrast(0x10);
+ dogs_set_contrast(12);
dogs_set_advanced(0x83);
dogs_set_sleep(false);
CS_HIGH;
@@ -187,12 +187,22 @@ void dogs_flush()
void draw_pixel(int x, int y, bool state)
{
+ if (x < 0 || y < 0 || x >= DISP_WIDTH || y >= DISP_HEIGHT)
+ return;
if (state)
dogs_buffer[y / 8 * DISP_WIDTH + x] |= (1 << (y % 8));
else
dogs_buffer[y / 8 * DISP_WIDTH + x] &= ~(1 << (y % 8));
}
+void draw_rect(int x, int y, int w, int h)
+{
+ for (int i = 0; i < w; i++) {
+ for (int j = 0; j < h; j++)
+ draw_pixel(x + i, y + j, true);
+ }
+}
+
void draw_bitmap(int x, int y, const unsigned char *buffer)
{
// Prepare source information