summaryrefslogtreecommitdiffstats
path: root/app/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/lcd.c')
-rw-r--r--app/lcd.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/app/lcd.c b/app/lcd.c
index e4a91ab..8c3a644 100644
--- a/app/lcd.c
+++ b/app/lcd.c
@@ -29,9 +29,9 @@
#define LCD_H_SHIFT 5
#define LCD_RS (1 << LCD_H_SHIFT)
-#define LCD_W 20
+#define LCD_W 16
#define LCD_W_MASK (LCD_RS -1 )
-#define LCD_H 4
+#define LCD_H 2
#define LCD_SZ (LCD_H << LCD_H_SHIFT)
#define LCD_POS(c,r) (((r) << LCD_H_SHIFT ) +(c))
@@ -41,7 +41,7 @@
static uint8_t dma_buf[DMA_BUF_SZ];
static uint8_t update_buf[DMA_BUF_SZ];
-static int dma_in_progress = 0;
+static volatile int dma_in_progress = 0;
static int refresh_enabled = 0;
static int backlight;
@@ -181,6 +181,8 @@ lcd_refresh_wdt (void)
refresh_wdt = 0;
+ if (!refresh_enabled) return;
+
/*No refresh for 1s, restart everything */
i2cp_stop_dma ();
@@ -419,18 +421,23 @@ lcd_backlight (int i)
void
-lcd_enable_refresh (void)
+lcd_enable_refresh ()
{
refresh_enabled = 1;
start_dma ();
}
-void
+int
lcd_disable_refresh (void)
{
+ int ret;
+ if (!refresh_enabled) return 0;
+ ret=refresh_enabled;
refresh_enabled = 0;
while (dma_in_progress);
+
+ return ret;
}