Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: rockbox-c240v2/firmware/target/arm/lcd-c200_c200v2.c
- ===================================================================
- --- rockbox-c240v2/firmware/target/arm/lcd-c200_c200v2.c (revision 27113)
- +++ rockbox-c240v2/firmware/target/arm/lcd-c200_c200v2.c (working copy)
- @@ -27,6 +27,7 @@
- #include "system.h"
- #ifdef SANSA_C200V2
- #include "dbop-as3525.h"
- +#include "button-target.h"
- #endif
- /* Display status */
- @@ -129,6 +130,7 @@
- /* send LCD data */
- void lcd_write_data(const fb_data *data, int width)
- {
- + button_prohibit_updates(1);
- do {
- DBOP_DOUT = *data << 8 | *data >> 8;
- data++;
- @@ -139,11 +141,13 @@
- /* While push fifo is not empty */
- while ((DBOP_STAT & (1<<10)) == 0);
- + button_prohibit_updates(0);
- }
- /* send LCD command */
- static void lcd_send_command(unsigned char cmd, unsigned char val)
- {
- + button_prohibit_updates(1);
- DBOP_TIMPOL_23 = 0xa167006e;
- DBOP_DOUT = cmd | val << 8;
- @@ -151,6 +155,7 @@
- while ((DBOP_STAT & (1<<10)) == 0);
- DBOP_TIMPOL_23 = 0xa167e06f;
- + button_prohibit_updates(0);
- }
- static inline void as3525_dbop_init(void)
- Index: rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-target.h
- ===================================================================
- --- rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-target.h (revision 27113)
- +++ rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-target.h (working copy)
- @@ -30,6 +30,7 @@
- bool button_hold(void);
- void button_init_device(void);
- int button_read_device(void);
- +void button_prohibit_updates(int prohibit);
- /* Sandisk Sansa c200 button codes */
- Index: rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c
- ===================================================================
- --- rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c (revision 27113)
- +++ rockbox-c240v2/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c (working copy)
- @@ -27,6 +27,9 @@
- #include "dbop-as3525.h"
- static unsigned short _dbop_din;
- +static unsigned int button_state = BUTTON_NONE;
- +static unsigned int button_prohibit = 0;
- +static unsigned int button_last_update;
- static bool hold_button = false;
- #ifndef BOOTLOADER
- @@ -43,10 +46,7 @@
- return hold_button;
- }
- -/*
- - * Get button pressed from hardware
- - */
- -int button_read_device(void)
- +static void button_update_state(void)
- {
- int btn = BUTTON_NONE;
- @@ -63,7 +63,8 @@
- }
- #endif /* BOOTLOADER */
- if (hold_button) {
- - return 0;
- + button_state = 0;
- + return;
- }
- /* direct GPIO connections */
- @@ -88,5 +89,32 @@
- if(!(_dbop_din & (1<<15)))
- btn |= BUTTON_REC;
- - return btn;
- + button_last_update = current_tick;
- + button_state = btn;
- }
- +
- +void button_prohibit_updates(int prohibit)
- +{
- + if (prohibit)
- + button_prohibit++;
- + else
- + button_prohibit--;
- +
- + if (prohibit != 0)
- + return;
- +
- + if (button_last_update != current_tick)
- + button_update_state();
- +}
- +
- +
- +/*
- + * Get button pressed from hardware
- + */
- +int button_read_device(void)
- +{
- + if (!button_prohibit)
- + button_update_state();
- +
- + return button_state;
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement