Appiko
Data Structures | Macros | Enumerations | Functions

Driver for the device tick generator. This module is responsible for generating the next interval events at configurable fast or slow intervals. More...

Data Structures

struct  device_tick_cfg
 Stucture for passing the configuration for initializing the Device Tick module. More...
 

Macros

#define DEVICE_TICK_MSTIMER_DIV_FACTOR   (1)
 The number of MS timer ticks elapsed for one device tick.
 

Enumerations

enum  device_tick_mode { DEVICE_TICK_SLOW, DEVICE_TICK_FAST, DEVICE_TICK_SAME }
 The two different modes at which the device ticks, fast & slow. More...
 

Functions

void device_tick_init (device_tick_cfg *cfg)
 Initializes and starts the Device tick module. Provides a next interval event immediately. This function can also be used to reinitialize the fast and slow mode intervals. More...
 
void device_tick_switch_mode (device_tick_mode mode)
 Switches from the fast to slow mode or vice versa. More...
 
void device_tick_process (void)
 The function to be called whenever the SoC wakes up to see if more than half the time of the current interval has elapsed to call the next interval handler.
 

Detailed Description

Warning
This module needs the LFCLK and Millisecond timer to be on and running to be able to work. Also the irq_msg_util module needs to be initialized.

Enumeration Type Documentation

◆ device_tick_mode

Enumerator
DEVICE_TICK_SLOW 

Slow mode.

DEVICE_TICK_FAST 

Fast mode.

DEVICE_TICK_SAME 

Same as previous mode.

Definition at line 53 of file device_tick.h.

Function Documentation

◆ device_tick_init()

void device_tick_init ( device_tick_cfg cfg)
Parameters
cfgThe initial mode as well as the fast and slow interval in number of LFCLK ticks.

Definition at line 52 of file device_tick.c.

References ASSERT, DEVICE_TICK_SAME, DEVICE_TICK_SLOW, device_tick_cfg::mode, MS_REPEATED_CALL, ms_timer_start(), and device_tick_cfg::slow_mode_ticks.

Referenced by button_handler(), and state_change_handler().

◆ device_tick_switch_mode()

void device_tick_switch_mode ( device_tick_mode  mode)
Parameters
modeThe mode to switch to.

Definition at line 73 of file device_tick.c.

References ASSERT, DEVICE_TICK_SAME, DEVICE_TICK_SLOW, MS_REPEATED_CALL, and ms_timer_start().

Referenced by button_handler().