mirror of
https://github.com/FunKey-Project/FunKey-GPIO-Mapping.git
synced 2025-12-12 09:48:51 +01:00
poweroff on pek long press
This commit is contained in:
parent
1e0a92caa4
commit
32a6c31d2f
@ -60,7 +60,13 @@ bool axp209_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Set N_OE Shutdown delay to 3S*/
|
||||
/* Set PEK Long press delay to 2.5s*/
|
||||
err = i2c_smbus_write_byte_data(fd_axp209 , AXP209_REG_PEK_PARAMS, 0x9F);
|
||||
if(err < 0){
|
||||
printf("ERROR Setting AXP209 PEK Long press delay to 2.5s\n");
|
||||
}
|
||||
|
||||
/* Set N_OE Shutdown delay to 3s*/
|
||||
err = i2c_smbus_write_byte_data(fd_axp209 , AXP209_REG_32H, 0x47);
|
||||
if(err < 0){
|
||||
printf("ERROR Setting AXP209 N_OE Shutdown delay to 3S\n");
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
// Chip registers adresses
|
||||
#define AXP209_REG_32H 0x32
|
||||
#define AXP209_REG_PEK_PARAMS 0x36
|
||||
#define AXP209_INTERRUPT_BANK_1_ENABLE 0x40
|
||||
#define AXP209_INTERRUPT_BANK_1_STATUS 0x48
|
||||
#define AXP209_INTERRUPT_BANK_2_ENABLE 0x41
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
|
||||
#define KEY_IDX_MAPPED_FOR_SHORT_PEK_PRESS 16 //KEY_Q
|
||||
#define KEY_IDX_MAPPED_FOR_LONG_PEK_PRESS 28 //KEY_ENTER
|
||||
#define SHELL_CMD_LONG_PEK_PRESS "poweroff"
|
||||
|
||||
|
||||
/****************************************************************
|
||||
@ -410,7 +411,9 @@ int listen_gpios_interrupts(void)
|
||||
}
|
||||
if(val_int_bank_3 & AXP209_INTERRUPT_PEK_LONG_PRESS){
|
||||
GPIO_PRINTF(" AXP209 long PEK key press detected\n");
|
||||
sendKeyAndStopKey(KEY_IDX_MAPPED_FOR_LONG_PEK_PRESS);
|
||||
//sendKeyAndStopKey(KEY_IDX_MAPPED_FOR_LONG_PEK_PRESS); SHELL_CMD_LONG_PEK_PRESS
|
||||
GPIO_PRINTF("Apply mapping activation fct: shell command \"%s\"\n", SHELL_CMD_LONG_PEK_PRESS);
|
||||
system(SHELL_CMD_LONG_PEK_PRESS);
|
||||
}
|
||||
}
|
||||
#endif //ENABLE_AXP209_INTERRUPTS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user