diff options
author | root <root@lamia.panaceas.james.local> | 2015-07-16 09:13:41 +0100 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-07-16 09:13:41 +0100 |
commit | 204682be1b744a385a12753aa150e4ac3763438f (patch) | |
tree | f10069a53214e0a06134c0b6b185a6fbe54d4455 | |
parent | 809b705559a51cac8cd301dbbe7e133e8607fbf6 (diff) | |
download | stm32_ade-204682be1b744a385a12753aa150e4ac3763438f.tar.gz stm32_ade-204682be1b744a385a12753aa150e4ac3763438f.tar.bz2 stm32_ade-204682be1b744a385a12753aa150e4ac3763438f.zip |
switch from 20x4 lcd to 16x2
-rw-r--r-- | app/lcd.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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; } |