Hardware (hardware)#
The commands and events in this class can be used to access and configure the system hardware and peripherals.
hardware commands#
hardware_get_time#
Deprecated. Get elapsed time since last reset of RTCC
Command#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Command |
1 | 0x00 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x0b | method | Message ID |
Response#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Response |
1 | 0x06 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x0b | method | Message ID |
4-7 | uint32 | seconds | seconds since last reset |
8-9 | uint16 | ticks | Subsecond ticks of hardware clock, range 0-32767 |
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
}
hardware_set_lazy_soft_timer#
This command can be used to start a software timer with some slack. Slack parameter allows stack to optimize wake ups and save power. Timer event is triggered between time and time + slack. See also description of hardware_set_soft_timer command.
Command#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Command |
1 | 0x0a | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x0c | method | Message ID |
4-7 | 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.
8-11 | uint32 | slack | Slack time in hardware clock ticks
12 | uint8 | handle | Timer handle to use, is returned in timeout event
13 | uint8 | single_shot | Timer mode. Values:
0: false (timer is repeating)
1: true (timer runs only once)
Response#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Response |
1 | 0x02 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x0c | method | Message ID |
4-5 | uint16 | result |
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
}
Events generated#
Event | Description |
---|---|
hardware_soft_timer | Sent after specified interval |
hardware_set_soft_timer#
This command can be used to start a software timer. Multiple concurrent timers can be running simultaneously. There are 256 unique timer IDs 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.
Command#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Command |
1 | 0x06 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x00 | method | Message ID |
4-7 | 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.
8 | uint8 | handle | Timer handle to use, is returned in timeout event
9 | uint8 | single_shot | Timer mode. Values:
0: false (timer is repeating)
1: true (timer runs only once)
Response#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0x20 | hilen | Message type: Response |
1 | 0x02 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x00 | method | Message ID |
4-5 | uint16 | result |
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
}
Events generated#
Event | Description |
---|---|
hardware_soft_timer | Sent after specified interval |
hardware events#
hardware_soft_timer#
This event indicates that the soft timer has lapsed.
Event#
Byte | Type | Name | Description |
---|---|---|---|
0 | 0xa0 | hilen | Message type: Event |
1 | 0x01 | lolen | Minimum payload length |
2 | 0x0c | class | Message class:Hardware |
3 | 0x00 | method | Message ID |
4 | uint8 | handle | Timer Handle |
API#
/* event id*/
gecko_evt_hardware_soft_timer_id
/* event structure*/
struct gecko_msg_hardware_soft_timer_evt_t
{
uint8 handle
}