summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-07-16 09:13:41 +0100
committerroot <root@lamia.panaceas.james.local>2015-07-16 09:13:41 +0100
commit204682be1b744a385a12753aa150e4ac3763438f (patch)
treef10069a53214e0a06134c0b6b185a6fbe54d4455
parent809b705559a51cac8cd301dbbe7e133e8607fbf6 (diff)
downloadstm32_ade-204682be1b744a385a12753aa150e4ac3763438f.tar.gz
stm32_ade-204682be1b744a385a12753aa150e4ac3763438f.tar.bz2
stm32_ade-204682be1b744a385a12753aa150e4ac3763438f.zip
switch from 20x4 lcd to 16x2
-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;
}