Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
117
Ver.1.0.0
Examples:
gpio_set_wakeup(GPIO_PC2, 1, 1); // Enable GPIO_PC2 CORE high level
wakeup
gpio_set_wakeup(GPIO_PC2, 1, 0); // Disable GPIO_PC2 CORE wakeup
gpio_set_wakeup(GPIO_PB5, 0, 1); // Enable GPIO_PB5 CORE low level
wakeup
gpio_set_wakeup(GPIO_PB5, 0, 0); // Disable GPIO_PB5 CORE wakeup
2) Configure GPIO PAD as wakeup source for deepsleep:
void cpu_set_gpio_wakeup (int pin, int pol, int en);
“pin” indicates GPIO pin; “pol” indicates wakeup trigger polarity, 1-high level wakeup,
0-low level wakeup; en: 1-enable, 0-disable.
Examples:
cpu_set_gpio_wakeup (GPIO_PC2, 1, 1); // Enable GPIO_PC2 PAD high level
wakeup
cpu_set_gpio_wakeup (GPIO_PC2, 1, 0); // Disable GPIO_PC2 PAD wakeup
cpu_set_gpio_wakeup (GPIO_PB5, 0, 1); // Enable GPIO_PB5 PAD low level
wakeup
cpu_set_gpio_wakeup (GPIO_PB5, 0, 0); // Disable GPIO_PB5 PAD wakeup
4.1.3 Low Power Mode Entry and Wakeup
The API “cpu_sleep_wakeup” can be called to configure MCU to enter low power mode
and set wakeup source(s).
int
cpu_sleep_wakeup (
SleepMode_TypeDef
,
SleepWakeupSrc_TypeDef
,
unsigned
int
wakeup_tick
);
1) Parameter
“deepsleep”: 0-enter suspend, 1-enter deepsleep.
2) Parameter
“wakeup_src”: It’s used to configure wakeup source(s) for current
suspend/deepsleep, and PM_WAKEUP_PAD, PM_WAKEUP_CORE and
PM_WAKEUP_TIMER can be selected. Note that PM_WAKEUP_TIMER and
PM_WAKEUP_CORE can be used as wakeup source for suspend, while
PM_WAKEUP_TIMER and PM_WAKEUP_PAD can be used as wakeup source for
deepsleep. If wakeup_src is s
et as 0, MCU can’t be woke up after it enters low
power mode.
3) Parameter
“wakeup_tick”: If the PM_WAKEUP_TIMER is not configured, this
parameter is invalid. Only when the PM_WAKEUP_TIMER is configured in the
wakeup_src, the wakeup_tick (absolute value) needs to be configured as current
system timer tick plus sleep time tick, and it determines when MCU will be woke up
by 32k timer. When system timer tick value matches the configured wakeup_tick,
MCU is woken up from low power mode. If the wakeup_tick is directly configured
without considering system timer tick
, wakeup time can’t be effectively controlled.