Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

hm60x/hm801: Add hold button support.

Change-Id: I05557ecfbf0bd821d8966862a38f7f22656b36ef

+55 -1
+25
firmware/target/arm/rk27xx/hm60x/button-hm60x.c
··· 23 23 #include "system.h" 24 24 #include "button.h" 25 25 #include "adc.h" 26 + #include "backlight.h" 26 27 27 28 void button_init_device(void) { 28 29 /* setup button gpio as input */ 29 30 GPIO_PCCON &= ~(POWEROFF_BUTTON); 31 + GPIO_PACON &= ~(1); 32 + 33 + /* setup button gpio as pulldown */ 34 + SCU_GPIOUPCON |= (1<<17) | 35 + 1 ; 36 + } 37 + 38 + bool button_hold() { 39 + return (GPIO_PADR & 1); 30 40 } 31 41 32 42 int button_read_device(void) { 33 43 int adc_val = adc_read(ADC_BUTTONS); 34 44 int gpio_btn = GPIO_PCDR & BUTTON_POWER; 45 + static bool hold_button = false; 46 + bool hold_button_old; 47 + 48 + hold_button_old = hold_button; 49 + hold_button = button_hold(); 50 + 51 + #ifndef BOOTLOADER 52 + if (hold_button != hold_button_old) { 53 + backlight_hold_changed(hold_button); 54 + } 55 + #endif 56 + 57 + if (hold_button) { 58 + return 0; 59 + } 35 60 36 61 if (adc_val < 380) { /* 0 - 379 */ 37 62 if (adc_val < 250) { /* 0 - 249 */
+2
firmware/target/arm/rk27xx/hm60x/button-target.h
··· 21 21 #ifndef _BUTTON_TARGET_H_ 22 22 #define _BUTTON_TARGET_H_ 23 23 24 + #define HAS_BUTTON_HOLD 25 + 24 26 #define BUTTON_UP 0x00000001 25 27 #define BUTTON_POWER 0x00000002 26 28 #define BUTTON_DOWN 0x00000004
+26 -1
firmware/target/arm/rk27xx/hm801/button-hm801.c
··· 23 23 #include "system.h" 24 24 #include "button.h" 25 25 #include "adc.h" 26 + #include "backlight.h" 26 27 27 28 enum keyboard_type_t { 28 29 KEYBOARD_V1, ··· 34 35 void button_init_device(void) { 35 36 /* setup button gpio as input */ 36 37 GPIO_PCCON &= ~(POWEROFF_BUTTON); 38 + GPIO_PACON &= ~1; 39 + 40 + 41 + /* setup button gpio as pulldown */ 42 + SCU_GPIOUPCON |= (1<<17) | 43 + 1 ; 37 44 38 45 /* identify keyboard type */ 39 46 SCU_IOMUXB_CON &= ~(1<<2); ··· 43 50 } else { 44 51 kbd_type = KEYBOARD_V2; 45 52 } 53 + } 54 + 55 + bool button_hold() { 56 + return (GPIO_PADR & 1); 46 57 } 47 58 48 59 static int button_read_device_v1(void) { ··· 125 136 } 126 137 127 138 int button_read_device(void) { 128 - if (kbd_type == KEYBOARD_V1) { 139 + static bool hold_button = false; 140 + bool hold_button_old; 141 + 142 + hold_button_old = hold_button; 143 + hold_button = button_hold(); 144 + 145 + #ifndef BOOTLOADER 146 + if (hold_button != hold_button_old) { 147 + backlight_hold_changed(hold_button); 148 + } 149 + #endif 150 + 151 + if (hold_button) { 152 + return 0; 153 + } else if (kbd_type == KEYBOARD_V1) { 129 154 return button_read_device_v1(); 130 155 } else { 131 156 return button_read_device_v2();
+2
firmware/target/arm/rk27xx/hm801/button-target.h
··· 21 21 #ifndef _BUTTON_TARGET_H_ 22 22 #define _BUTTON_TARGET_H_ 23 23 24 + #define HAS_BUTTON_HOLD 25 + 24 26 #define BUTTON_UP 0x00000001 25 27 #define BUTTON_POWER 0x00000002 26 28 #define BUTTON_DOWN 0x00000004