|
SmartSnippets DA1459x SDK
|
Wakeup Controller LLD API. More...
Files | |
| file | hw_wkup_v2.h |
| Definition of API for the Wakeup Controller Low Level Driver. | |
Data Structures | |
| struct | wkup_config |
| Wakeup Controller configuration. More... | |
Macros | |
| #define | HW_WKUP_REG_FIELD_MASK(reg, field) (WAKEUP_WKUP_##reg##_REG_##field##_Msk) |
| Get the mask of a field of an WKUP register. More... | |
| #define | HW_WKUP_REG_FIELD_POS(reg, field) (WAKEUP_WKUP_##reg##_REG_##field##_Pos) |
| Get the bit position of a field of an WKUP register. More... | |
| #define | HW_WKUP_REG_GETF(reg, field) ((WAKEUP->WKUP_##reg##_REG & (WAKEUP_WKUP_##reg##_REG_##field##_Msk)) >> (WAKEUP_WKUP_##reg##_REG_##field##_Pos)) |
| Get the value of a field of an WKUP register. More... | |
| #define | HW_WKUP_REG_SETF(reg, field, new_val) |
| Set the value of a field of an WKUP register. More... | |
Enumerations | |
| enum | HW_WKUP_TRIGGER { HW_WKUP_TRIG_DISABLED, HW_WKUP_TRIG_LEVEL_HI_DEB, HW_WKUP_TRIG_LEVEL_LO_DEB, HW_WKUP_TRIG_LEVEL_HI, HW_WKUP_TRIG_LEVEL_LO, HW_WKUP_TRIG_EDGE_HI, HW_WKUP_TRIG_EDGE_LO } |
| Key and gpio trigger types. More... | |
| enum | HW_WKUP_HIBERN_PIN { HW_WKUP_HIBERN_PIN_NONE = 0, HW_WKUP_HIBERN_P0_14_ONLY, HW_WKUP_HIBERN_P1_04_ONLY, HW_WKUP_HIBERN_BOTH_PINS } |
| Wake up from hibernation controller pin settings. More... | |
| enum | HW_WKUP_HIBERN_POLARITY { HW_WKUP_HIBERN_BOTH_PINS_ACTIVE_HIGH = 0, HW_WKUP_HIBERN_P0_14_ACTIVE_LOW_ONLY, HW_WKUP_HIBERN_P1_04_ACTIVE_LOW_ONLY, HW_WKUP_HIBERN_BOTH_PINS_ACTIVE_LOW } |
| Wake up from hibernation pin polarity settings. More... | |
Functions | |
| void | hw_wkup_configure_hibernation (HW_WKUP_HIBERN_PIN pin, HW_WKUP_HIBERN_POLARITY pol) |
| Configure wake up from hibernation block. More... | |
| void | hw_wkup_init (const wkup_config *cfg) |
| Initialize peripheral. More... | |
| void | hw_wkup_configure (const wkup_config *cfg) |
| Configure peripheral. More... | |
| void | hw_wkup_register_key_interrupt (hw_wkup_interrupt_cb cb, uint32_t prio) |
| Register KEY interrupt handler. More... | |
| void | hw_wkup_register_gpio_p0_interrupt (hw_wkup_interrupt_cb cb, uint32_t prio) |
| Register GPIO P0 interrupt handler. More... | |
| void | hw_wkup_register_gpio_p1_interrupt (hw_wkup_interrupt_cb cb, uint32_t prio) |
| Register GPIO P1 interrupt handler. More... | |
| void | hw_wkup_unregister_interrupts (void) |
| Unregister interrupt handlers. More... | |
| __STATIC_INLINE void | hw_wkup_reset_key_interrupt (void) |
| Reset key interrupt. More... | |
| void | hw_wkup_handler (void) |
| Interrupt handler. More... | |
| __STATIC_INLINE void | hw_wkup_set_key_debounce_time (uint8_t time_ms) |
| Set debounce time. More... | |
| __STATIC_INLINE uint8_t | hw_wkup_get_key_debounce_time (void) |
| Get current debounce time. More... | |
| void | hw_wkup_set_trigger (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_WKUP_TRIGGER trigger) |
| Configure a gpio or key trigger event. More... | |
| __STATIC_INLINE HW_WKUP_TRIGGER | hw_wkup_get_trigger (HW_GPIO_PORT port, HW_GPIO_PIN pin) |
| Get gpio or key trigger configuration. More... | |
| __STATIC_INLINE void | hw_wkup_emulate_key_hit (void) |
| Emulate key hit. More... | |
| __STATIC_INLINE void | hw_wkup_enable_key_irq (void) |
| Enable WKUP Key interrupts. More... | |
| __STATIC_INLINE void | hw_wkup_disable_key_irq (void) |
| Disable WKUP interrupts. More... | |
| __STATIC_INLINE void | hw_wkup_freeze_key_timer (void) |
| Freeze wakeup timer. More... | |
| __STATIC_INLINE void | hw_wkup_unfreeze_key_timer (void) |
| Unfreeze wakeup controller timer. More... | |
| __STATIC_INLINE uint32_t | hw_wkup_get_gpio_status (HW_GPIO_PORT port) |
| Get port status on last wake up. More... | |
| __STATIC_INLINE void | hw_wkup_clear_gpio_status (HW_GPIO_PORT port, uint32_t status) |
| Clear latch status. More... | |
Wakeup Controller LLD API.
| #define HW_WKUP_REG_FIELD_MASK | ( | reg, | |
| field | |||
| ) | (WAKEUP_WKUP_##reg##_REG_##field##_Msk) |
Get the mask of a field of an WKUP register.
| [in] | reg | is the register to access |
| [in] | field | is the register field to access |
| #define HW_WKUP_REG_FIELD_POS | ( | reg, | |
| field | |||
| ) | (WAKEUP_WKUP_##reg##_REG_##field##_Pos) |
Get the bit position of a field of an WKUP register.
| [in] | reg | is the register to access |
| [in] | field | is the register field to access |
| #define HW_WKUP_REG_GETF | ( | reg, | |
| field | |||
| ) | ((WAKEUP->WKUP_##reg##_REG & (WAKEUP_WKUP_##reg##_REG_##field##_Msk)) >> (WAKEUP_WKUP_##reg##_REG_##field##_Pos)) |
Get the value of a field of an WKUP register.
| [in] | reg | is the register to access |
| [in] | field | is the register field to write |
| #define HW_WKUP_REG_SETF | ( | reg, | |
| field, | |||
| new_val | |||
| ) |
Set the value of a field of an WKUP register.
| [in] | reg | is the register to access |
| [in] | field | is the register field to write |
| [in] | new_val | is the value to write |
| enum HW_WKUP_HIBERN_PIN |
Wake up from hibernation controller pin settings.
Wake up from hibernation pin polarity settings.
| enum HW_WKUP_TRIGGER |
Key and gpio trigger types.
| __STATIC_INLINE void hw_wkup_clear_gpio_status | ( | HW_GPIO_PORT | port, |
| uint32_t | status | ||
| ) |
Clear latch status.
| [in] | port | port number |
| [in] | status | pin status bitmask |
| void hw_wkup_configure | ( | const wkup_config * | cfg | ) |
Configure peripheral.
Shortcut to call appropriate configuration function. If cfg is NULL, this function does nothing.
| [in] | cfg | configuration |
| void hw_wkup_configure_hibernation | ( | HW_WKUP_HIBERN_PIN | pin, |
| HW_WKUP_HIBERN_POLARITY | pol | ||
| ) |
Configure wake up from hibernation block.
| [in] | pin | the GPIO that triggers wake up from hibernation |
| [in] | pol | the GPIO polarity |
| __STATIC_INLINE void hw_wkup_disable_key_irq | ( | void | ) |
Disable WKUP interrupts.
| __STATIC_INLINE void hw_wkup_emulate_key_hit | ( | void | ) |
Emulate key hit.
Simulate Key event wake up trigger in case debounce time is set to 0
| __STATIC_INLINE void hw_wkup_enable_key_irq | ( | void | ) |
Enable WKUP Key interrupts.
| __STATIC_INLINE void hw_wkup_freeze_key_timer | ( | void | ) |
Freeze wakeup timer.
| __STATIC_INLINE uint32_t hw_wkup_get_gpio_status | ( | HW_GPIO_PORT | port | ) |
Get port status on last wake up.
Meaning of bits in returned bitmask is the same as in hw_wkup_set_trigger().
| __STATIC_INLINE uint8_t hw_wkup_get_key_debounce_time | ( | void | ) |
Get current debounce time.
| __STATIC_INLINE HW_WKUP_TRIGGER hw_wkup_get_trigger | ( | HW_GPIO_PORT | port, |
| HW_GPIO_PIN | pin | ||
| ) |
Get gpio or key trigger configuration.
| [in] | port | port number |
| [in] | pin | pin number |
| void hw_wkup_handler | ( | void | ) |
Interrupt handler.
| void hw_wkup_init | ( | const wkup_config * | cfg | ) |
Initialize peripheral.
Resets Wakeup Controller to initial state, i.e. interrupt is disabled and all pin triggers are disabled.
cfg can be NULL - no configuration is performed in such case.
| [in] | cfg | configuration |
| void hw_wkup_register_gpio_p0_interrupt | ( | hw_wkup_interrupt_cb | cb, |
| uint32_t | prio | ||
| ) |
Register GPIO P0 interrupt handler.
A callback function is registered to be called when an interrupt is generated. Interrupt is automatically enabled after calling this function. Application should reset interrupt in callback function using hw_wkup_clear_gpio_status(). If no callback is specified, interrupt will be automatically cleared by the driver.
| [in] | cb | callback function |
| [in] | prio | the priority of the interrupt |
| void hw_wkup_register_gpio_p1_interrupt | ( | hw_wkup_interrupt_cb | cb, |
| uint32_t | prio | ||
| ) |
Register GPIO P1 interrupt handler.
A callback function is registered to be called when an interrupt is generated. Interrupt is automatically enabled after calling this function. Application should reset interrupt in callback function using hw_wkup_clear_gpio_status(). If no callback is specified, interrupt will be automatically cleared by the driver.
| [in] | cb | callback function |
| [in] | prio | the priority of the interrupt |
| void hw_wkup_register_key_interrupt | ( | hw_wkup_interrupt_cb | cb, |
| uint32_t | prio | ||
| ) |
Register KEY interrupt handler.
A callback function is registered to be called when an interrupt is generated. Interrupt is automatically enabled after calling this function. Application should reset interrupt in callback function using hw_wkup_reset_key_interrupt(). If no callback is specified, interrupt will be automatically cleared by the driver.
| [in] | cb | callback function |
| [in] | prio | the priority of the interrupt |
| __STATIC_INLINE void hw_wkup_reset_key_interrupt | ( | void | ) |
Reset key interrupt.
| __STATIC_INLINE void hw_wkup_set_key_debounce_time | ( | uint8_t | time_ms | ) |
Set debounce time.
Setting debounce time to 0 will disable hardware debouncing. Maximum debounce time is 63ms.
| [in] | time_ms | debounce time in milliseconds |
| void hw_wkup_set_trigger | ( | HW_GPIO_PORT | port, |
| HW_GPIO_PIN | pin, | ||
| HW_WKUP_TRIGGER | trigger | ||
| ) |
Configure a gpio or key trigger event.
| [in] | port | port number |
| [in] | pin | pin number |
| [in] | trigger | gpio or key trigger setting |
| __STATIC_INLINE void hw_wkup_unfreeze_key_timer | ( | void | ) |
Unfreeze wakeup controller timer.
| void hw_wkup_unregister_interrupts | ( | void | ) |
Unregister interrupt handlers.
Interrupts are automatically disabled in NVIC after calling this function.
1.8.16