Hardware (hardware)#

The commands and events in this class access and configure the system hardware and peripherals.

hardware commands#

hardware_get_time#

Deprecated. Use Sleep Timer component (sl_sleeptimer.h) for the same functionality. Call sl_sleeptimer_get_tick_count64 to get current tick count. Sleep Timer provides APIs for conversions between ticks and milliseconds.

Get elapsed time since last reset.

C API#

/* Function */  
struct gecko_msg_hardware_get_time_rsp_t *gecko_cmd_hardware_get_time();  
  
/* Response id */  
gecko_rsp_hardware_get_time_id  
  
/* Response structure */  
struct gecko_msg_hardware_get_time_rsp_t  
{  
  uint32 seconds;  
  uint16 ticks;  
}  

Command does not have parameters (for BGAPI headers refer to#

link)

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint32

seconds

Seconds since last reset

uint16

ticks

Subsecond ticks of hardware clock, range 0-32767

hardware_set_lazy_soft_timer#

Start a software timer with slack. The slack parameter allows the stack to optimize wakeups and save power. The timer event is triggered between time and time + slack. See also description of hardware_set_soft_timer command.

C API#

/* Function */  
struct gecko_msg_hardware_set_lazy_soft_timer_rsp_t *gecko_cmd_hardware_set_lazy_soft_timer(uint32 time, uint32 slack, uint8 handle, uint8 single_shot);  
  
/* Response id */  
gecko_rsp_hardware_set_lazy_soft_timer_id  
  
/* Response structure */  
struct gecko_msg_hardware_set_lazy_soft_timer_rsp_t  
{  
  uint16 result;  
}  

Command Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint32

time

Interval between how often to send events in hardware clock

ticks (1 second is equal to 32768 ticks).

The smallest interval value supported is 328, which is around 10 milliseconds. Any parameters between 0 and 328 will be rounded up to 328. The maximum value is 2147483647, which corresponds to about 18.2 hours.

If time is 0, removes the scheduled timer with the same handle.
uint32 | slack | Slack time in hardware clock ticks
uint8 | handle | Timer handle to use, which is returned in timeout event
uint8 | single_shot | Timer mode. Values:

  • 0: false (timer is repeating)

  • 1: true (timer runs only once)

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Events generated#

Event

Description

hardware_soft_timer

Sent after this timer has lapsed.

hardware_set_soft_timer#

Start a software timer. Multiple concurrent timers can be running simultaneously. 256 unique timer handles (IDs) are available. The maximum number of concurrent timers is configurable at device initialization. Up to 16 concurrent timers can be configured. The default configuration is 4. As the RAM for storing timer data is pre-allocated at initialization, an application should not configure the amount more than it needs for minimizing RAM usage.

C API#

/* Function */  
struct gecko_msg_hardware_set_soft_timer_rsp_t *gecko_cmd_hardware_set_soft_timer(uint32 time, uint8 handle, uint8 single_shot);  
  
/* Response id */  
gecko_rsp_hardware_set_soft_timer_id  
  
/* Response structure */  
struct gecko_msg_hardware_set_soft_timer_rsp_t  
{  
  uint16 result;  
}  

Command Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint32

time

Frequency interval of events, which indicates how often to

send events in hardware clock ticks (1 second is equal to 32768 ticks).

The smallest interval value supported is 328, which is around 10 milliseconds. Any parameters between 0 and 328 will be rounded up to 328. The maximum value is 2147483647, which corresponds to about 18.2 hours.

If time is 0, removes the scheduled timer with the same handle.
uint8 | handle | Timer handle to use, which is returned in timeout event
uint8 | single_shot | Timer mode. Values:

  • 0: false (timer is repeating)

  • 1: true (timer runs only once)

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Events generated#

Event

Description

hardware_soft_timer

Sent after this timer has lapsed.

hardware events#

hardware_soft_timer#

Indicates that a soft timer has lapsed.

C API#

/* event id*/  
gecko_evt_hardware_soft_timer_id  
  
/* event structure*/  
struct gecko_msg_hardware_soft_timer_evt_t  
{  
  uint8 handle;  
}  

Event Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint8

handle

Timer Handle