Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
158
Ver.1.0.0
for
(
int
i=0; i<(
sizeof
(pin)/
sizeof
(*pin)); i++)
{
gpio_set_wakeup(pin[i],1,1);
//drive pin core(gpio) high
wakeup suspend
}
The
“gpio_set_wakeup(pin[i],1,1)” sets wakeup polarity of drive pins as high level and
enables wakeup.
Since GPIO interrupt enabling and polarity adopts the same configuration registers as
wakeup, the “gpio_set_wakeup(pin[i],1,1)” will also enable GPIO interrupt and set
interrupt polarity as high level.
High level on GPIO will set GPIO IRQ service flag bit (core_648 BIT(18)); this flag bit can
be used to check whether any button is pressed (when a button is pressed, 10/11 VCC
high level will be read on corresponding drive pin).
#define
reg_irq_mask
REG_ADDR32(0x640)
#define
reg_irq_src
REG_ADDR32(0x648)
FLD_IRQ_GPIO_EN
=
BIT(18),
As long as GPIO interrupt mask bit (core_640 BIT(18)) is not enabled, the configuration
will only
set the IRQ flag bit, but won’t trigger interrupt.
The
“KEYSCAN_IRQ_TRIGGER_MODE” definition in app_config.h serves to enable
time optimization for the keyscan flow.
#define
KEYSCAN_IRQ_TRIGGER_MODE
1
Initialization:
gpio_core_irq_enable_all(1);
reg_irq_src =
FLD_IRQ_GPIO_EN
;