diff --git a/firmware/target/arm/as3525/button-e200v2-fuze.c b/firmware/target/arm/as3525/button-e200v2-fuze.c index 6a9f02959c..5518f981e8 100644 --- a/firmware/target/arm/as3525/button-e200v2-fuze.c +++ b/firmware/target/arm/as3525/button-e200v2-fuze.c @@ -32,7 +32,7 @@ #define WHEEL_COUNTER_DIV 4 #define ACCEL_INCREMENT 2 #define ACCEL_SHIFT 2 -#define BUTTON_DELAY 45 +#define BUTTON_DELAY 30 #endif #ifdef SANSA_E200V2 @@ -246,6 +246,11 @@ static int button_gpio(void) int btn = BUTTON_NONE; if(hold_button) return btn; + + /* disable DBOP output while changing GPIO pins that share lines with it */ + DBOP_CTRL &= ~(1<<16); + button_delay(); + /* set afsel, so that we can read our buttons */ GPIOC_AFSEL &= ~(1<<2|1<<3|1<<4|1<<5|1<<6); /* set dir so we can read our buttons (but reset the C pins first) */ @@ -276,7 +281,8 @@ static int button_gpio(void) /* return to settings needed for lcd */ GPIOC_DIR |= (1<<2|1<<3|1<<4|1<<5|1<<6); GPIOC_AFSEL |= (1<<2|1<<3|1<<4|1<<5|1<<6); - + + DBOP_CTRL |= (1<<16); /* enable output again */ return btn; } diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c index e25494dddd..b19f8ea65b 100644 --- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c @@ -170,16 +170,16 @@ void lcd_write_data(const fb_data* p_bytes, int count) DBOP_DOUT32 = *data++; count -= 2; - /* TODO: We should normally fill the fifo until it's full - * instead of waiting after each word, - * but that causes blue lines on the display */ - while ((DBOP_STAT & (1<<10)) == 0); + /* Wait if push fifo is full */ + while ((DBOP_STAT & (1<<6)) != 0); } - /* due to the 32bit alignment requirement, we possibly need to do a * 16bit transfer at the end also */ if (count > 0) lcd_write_single_data16(*(fb_data*)data); + + /* While push fifo is not empty */ + while ((DBOP_STAT & (1<<10)) == 0); } static void lcd_write_reg(int reg, int value) diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c index fc0fdaae10..2b7ce4888d 100644 --- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c @@ -116,16 +116,16 @@ void lcd_write_data(const fb_data* p_bytes, int count) DBOP_DOUT32 = *data++; count -= 2; - /* Wait for fifo to empty */ - /* TODO: We should normally fill the fifo until it's full - * instead of waiting after each word, - * but that causes blue lines on the display */ - while ((DBOP_STAT & (1<<10)) == 0); + /* Wait if push fifo is full */ + while ((DBOP_STAT & (1<<6)) != 0); } /* due to the 32bit alignment requirement, we possibly need to do a - * 16bit transfer at the end also */ + * 16bit transfer at the end also */ if (count > 0) lcd_write_single_data16(*(fb_data*)data); + + /* While push fifo is not empty */ + while ((DBOP_STAT & (1<<10)) == 0); } static void lcd_write_reg(int reg, int value)