|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
46 #if dg_configUSE_HW_WKUP
53 #define HW_WKUP_POL_P0_BASE_REG (volatile uint32_t *)(&WAKEUP->WKUP_POL_P0_REG)
54 #define HW_WKUP_SELECT_KEY_P0_BASE_REG (volatile uint32_t *)(&WAKEUP->WKUP_SELECT_P0_REG)
55 #define HW_WKUP_SELECT_GPIO_P0_BASE_REG (volatile uint32_t *)(&WAKEUP->WKUP_SEL_GPIO_P0_REG)
56 #define HW_WKUP_SELECT1_GPIO_P0_BASE_REG (volatile uint32_t *)(&WAKEUP->WKUP_SEL1_GPIO_P0_REG)
65 #define HW_WKUP_REG_FIELD_MASK(reg, field) \
66 (WAKEUP_WKUP_##reg##_REG_##field##_Msk)
75 #define HW_WKUP_REG_FIELD_POS(reg, field) \
76 (WAKEUP_WKUP_##reg##_REG_##field##_Pos)
87 #define HW_WKUP_REG_GETF(reg, field) \
88 ((WAKEUP->WKUP_##reg##_REG & (WAKEUP_WKUP_##reg##_REG_##field##_Msk)) >> (WAKEUP_WKUP_##reg##_REG_##field##_Pos))
98 #define HW_WKUP_REG_SETF(reg, field, new_val) \
99 WAKEUP->WKUP_##reg##_REG = ((WAKEUP->WKUP_##reg##_REG & ~(WAKEUP_WKUP_##reg##_REG_##field##_Msk)) | \
100 ((WAKEUP_WKUP_##reg##_REG_##field##_Msk) & ((new_val) << (WAKEUP_WKUP_##reg##_REG_##field##_Pos))))
160 typedef void (*hw_wkup_interrupt_cb)(void);
245 WAKEUP->WKUP_RESET_IRQ_REG = 1;
264 ASSERT_WARNING(time_ms <= 63);
299 uint32_t polarity = (*(HW_WKUP_POL_P0_BASE_REG + port) & (0x1 << pin)) >> pin;
300 uint32_t key_enabled = (*(HW_WKUP_SELECT_KEY_P0_BASE_REG + port) & (0x1 << pin)) >> pin;
301 uint32_t gpio_enabled = (*(HW_WKUP_SELECT_GPIO_P0_BASE_REG + port) & (0x1 << pin)) >> pin;
306 else if (gpio_enabled) {
307 if ((*(HW_WKUP_SELECT1_GPIO_P0_BASE_REG + port) & (0x1 << pin)) >> pin) {
__STATIC_INLINE void hw_wkup_emulate_key_hit(void)
Emulate key hit.
Definition: hw_wkup_v2.h:323
__STATIC_INLINE void hw_wkup_enable_key_irq(void)
Enable WKUP Key interrupts.
Definition: hw_wkup_v2.h:335
void hw_wkup_configure(const wkup_config *cfg)
Configure peripheral.
Definition: hw_wkup_v2.h:109
Definition: hw_wkup_v2.h:107
void hw_wkup_set_trigger(HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_WKUP_TRIGGER trigger)
Configure a gpio or key trigger event.
HW_WKUP_HIBERN_PIN
Wake up from hibernation controller pin settings.
Definition: hw_wkup_v2.h:133
HW_WKUP_HIBERN_POLARITY
Wake up from hibernation pin polarity settings.
Definition: hw_wkup_v2.h:144
Central include header file with platform definitions.
void hw_wkup_register_key_interrupt(hw_wkup_interrupt_cb cb, uint32_t prio)
Register KEY interrupt handler.
__STATIC_INLINE void hw_wkup_clear_gpio_status(HW_GPIO_PORT port, uint32_t status)
Clear latch status.
Definition: hw_wkup_v2.h:400
#define GPREG_SET_FREEZE_REG_FRZ_WKUPTIM_Msk
Definition: DA1459x-00.h:3298
HW_GPIO_PIN
GPIO pin number.
Definition: hw_gpio.h:106
uint8_t debounce
Definition: hw_wkup_v2.h:122
Definition: hw_wkup_v2.h:135
HW_GPIO_PORT
GPIO port number.
Definition: hw_gpio.h:96
__STATIC_INLINE uint8_t hw_wkup_get_key_debounce_time(void)
Get current debounce time.
Definition: hw_wkup_v2.h:274
__STATIC_INLINE HW_WKUP_TRIGGER hw_wkup_get_trigger(HW_GPIO_PORT port, HW_GPIO_PIN pin)
Get gpio or key trigger configuration.
Definition: hw_wkup_v2.h:297
void hw_wkup_handler(void)
Interrupt handler.
void hw_wkup_register_gpio_p0_interrupt(hw_wkup_interrupt_cb cb, uint32_t prio)
Register GPIO P0 interrupt handler.
Definition: hw_wkup_v2.h:113
Definition: hw_wkup_v2.h:146
#define HW_WKUP_REG_SETF(reg, field, new_val)
Set the value of a field of an WKUP register.
Definition: hw_wkup_v2.h:98
__STATIC_INLINE uint32_t hw_wkup_get_gpio_status(HW_GPIO_PORT port)
Get port status on last wake up.
Definition: hw_wkup_v2.h:377
#define HW_WKUP_REG_GETF(reg, field)
Get the value of a field of an WKUP register.
Definition: hw_wkup_v2.h:87
Definition: hw_wkup_v2.h:112
void hw_wkup_register_gpio_p1_interrupt(hw_wkup_interrupt_cb cb, uint32_t prio)
Register GPIO P1 interrupt handler.
__STATIC_INLINE void hw_wkup_set_key_debounce_time(uint8_t time_ms)
Set debounce time.
Definition: hw_wkup_v2.h:262
Definition: hw_wkup_v2.h:145
HW_WKUP_TRIGGER
Key and gpio trigger types.
Definition: hw_wkup_v2.h:106
void hw_wkup_init(const wkup_config *cfg)
Initialize peripheral.
__STATIC_INLINE void hw_wkup_reset_key_interrupt(void)
Reset key interrupt.
Definition: hw_wkup_v2.h:243
Definition of API for the GPIO Low Level Driver.
Definition: hw_wkup_v2.h:110
Definition: hw_wkup_v2.h:137
Definition: hw_wkup_v2.h:148
Definition: hw_wkup_v2.h:147
Definition: hw_wkup_v2.h:108
__STATIC_INLINE void hw_wkup_disable_key_irq(void)
Disable WKUP interrupts.
Definition: hw_wkup_v2.h:344
Definition: hw_wkup_v2.h:111
__STATIC_INLINE void hw_wkup_unfreeze_key_timer(void)
Unfreeze wakeup controller timer.
Definition: hw_wkup_v2.h:362
__STATIC_INLINE void hw_wkup_freeze_key_timer(void)
Freeze wakeup timer.
Definition: hw_wkup_v2.h:353
Definition: hw_wkup_v2.h:136
void hw_wkup_unregister_interrupts(void)
Unregister interrupt handlers.
Wakeup Controller configuration.
Definition: hw_wkup_v2.h:121
#define GPREG_RESET_FREEZE_REG_FRZ_WKUPTIM_Msk
Definition: DA1459x-00.h:3274
Definition: hw_wkup_v2.h:134
void hw_wkup_configure_hibernation(HW_WKUP_HIBERN_PIN pin, HW_WKUP_HIBERN_POLARITY pol)
Configure wake up from hibernation block.