SerialAPI#
Modules#
Enumerations#
Typedefs#
Variables#
Functions#
Invoke command handler.
Invokes callback for each registered command.
Macros#
Non-payload overhead sizes for Send Data like commands.
Each frame can contains up to 173 bytes of payload (RECEIVE_BUFFER_SIZE - 8) | SOF | LEN | TYPE | CMD ID | TOTAL_FRAME_COUNT | FRAME_INDEX | LIST_LENGTH | ... | CHECKSUM | each node need 2 bytes for node_id and 2 bytes for keep_alive_min so each frame can contains up to (RECEIVE_BUFFER_SIZE - 8) / 4 nodes so the max frame count is ZW_MAX_IMPORTANT_DEVICES / ((RECEIVE_BUFFER_SIZE - 8) / 4)
Max entries per response frame: 3 bytes overhead (subcommand + length + more_to_follow), each entry is 4 bytes (NodeID MSB, NodeID LSB, S2 Message Count, Last Sequence Number).
Enumeration Documentation#
transport_type_t#
transport_type_t
| Enumerator | |
|---|---|
| TRANSPORT_TYPE_UART | |
| TRANSPORT_TYPE_SPI | |
| TRANSPORT_TYPE_ETHERNET | |
| TRANSPORT_TYPE_UART | |
| TRANSPORT_TYPE_SPI | |
| TRANSPORT_TYPE_ETHERNET | |
comm_interface_parse_result_t#
comm_interface_parse_result_t
| Enumerator | |
|---|---|
| PARSE_IDLE | |
| PARSE_FRAME_RECEIVED | |
| PARSE_FRAME_SENT | |
| PARSE_FRAME_ERROR | |
| PARSE_RX_TIMEOUT | |
| PARSE_TX_TIMEOUT | |
| PARSE_IDLE | |
| PARSE_FRAME_RECEIVED | |
| PARSE_FRAME_SENT | |
| PARSE_FRAME_ERROR | |
| PARSE_RX_TIMEOUT | |
| PARSE_TX_TIMEOUT | |
important_devices_list_error_t#
important_devices_list_error_t
| Enumerator | |
|---|---|
| IMPORTANT_DEVICES_LIST_SUCCESS | |
| IMPORTANT_DEVICES_LIST_UNKNOWN_NODE_ID | |
| IMPORTANT_DEVICES_LIST_NODE_ID_ALREADY_EXISTS | |
| IMPORTANT_DEVICES_LIST_NOT_ENOUGH_DEVICES | |
| IMPORTANT_DEVICES_LIST_WRONG_FRAME_INDEX | |
| IMPORTANT_DEVICES_LIST_WRONG_TOTAL_FRAME_COUNT | |
| IMPORTANT_DEVICES_LIST_TOO_MANY_DEVICES | |
Typedef Documentation#
cmd_handler_t#
typedef void(* cmd_handler_t) (const comm_interface_frame_ptr) )(const comm_interface_frame_ptr)
cmd_foreach_callback_t#
typedef bool(* cmd_foreach_callback_t) (cmd_handler_map_t const *const p_cmd_entry, uint8_t *supported_cmds_mask) )(cmd_handler_map_t const *const p_cmd_entry, uint8_t *supported_cmds_mask)
transmit_done_cb_t#
typedef void(* transmit_done_cb_t) (transport_handle_t transport) )(transport_handle_t transport)
Function Documentation#
invoke_cmd_handler#
bool invoke_cmd_handler (const comm_interface_frame_ptr frame)
Invoke command handler.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| const comm_interface_frame_ptr | [in] | frame | Frame |
Returns
true if handler for given
framewas invoked, false if no handler was found
cmd_foreach#
void cmd_foreach (cmd_foreach_callback_t callback, uint8_t * supported_cmds_mask)
Invokes callback for each registered command.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| cmd_foreach_callback_t | N/A | callback | Callback function to invoke. |
| uint8_t * | N/A | supported_cmds_mask | Bitmask of supported commands to pass to the callback function. |
Will stop if the callback returns true.
frame_payload_len#
static uint8_t frame_payload_len (const comm_interface_frame_ptr frame)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| const comm_interface_frame_ptr | N/A | frame |
comm_interface_transmit_frame#
void comm_interface_transmit_frame (uint8_t cmd, uint8_t type, const uint8_t * payload, uint8_t len, transmit_done_cb_t cb)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint8_t | N/A | cmd | |
| uint8_t | N/A | type | |
| const uint8_t * | N/A | payload | |
| uint8_t | N/A | len | |
| transmit_done_cb_t | N/A | cb |
comm_interface_wait_transmit_done#
void comm_interface_wait_transmit_done (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
comm_interface_init#
void comm_interface_init (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
comm_interface_get_ack_timeout_ms#
uint32_t comm_interface_get_ack_timeout_ms (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
comm_interface_set_ack_timeout_ms#
void comm_interface_set_ack_timeout_ms (uint32_t t)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | t |
comm_interface_get_byte_timeout_ms#
uint32_t comm_interface_get_byte_timeout_ms (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
comm_interface_set_byte_timeout_ms#
void comm_interface_set_byte_timeout_ms (uint32_t t)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | t |
comm_interface_parse_data#
comm_interface_parse_result_t comm_interface_parse_data (bool ack)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| bool | N/A | ack |
Macro Definition Documentation#
ZW_ADD_CMD#
#define ZW_ADD_CMDValue:
SEND_DATA_FRAME_OVERHEAD#
#define SEND_DATA_FRAME_OVERHEADValue:
4
Non-payload overhead sizes for Send Data like commands.
Used to check that inside dataLength field is consistent with actual frame length.
The minimum required payload length for each command is: variable_offset + OVERHEAD + dataLength
ZW_MAX_IMPORTANT_DEVICES#
#define ZW_MAX_IMPORTANT_DEVICESValue:
SL_HOST_HIBERNATION_DEVICE_TABLE_SIZE
MAX_DEVICE_COUNT_PER_FRAME#
#define MAX_DEVICE_COUNT_PER_FRAMEValue:
((RECEIVE_BUFFER_SIZE - 8) / 4)
Each frame can contains up to 173 bytes of payload (RECEIVE_BUFFER_SIZE - 8) | SOF | LEN | TYPE | CMD ID | TOTAL_FRAME_COUNT | FRAME_INDEX | LIST_LENGTH | ... | CHECKSUM | each node need 2 bytes for node_id and 2 bytes for keep_alive_min so each frame can contains up to (RECEIVE_BUFFER_SIZE - 8) / 4 nodes so the max frame count is ZW_MAX_IMPORTANT_DEVICES / ((RECEIVE_BUFFER_SIZE - 8) / 4)
S2_MSG_COUNT_ENTRIES_PER_FRAME#
#define S2_MSG_COUNT_ENTRIES_PER_FRAMEValue:
((BUF_SIZE_TX - 3) / 4)
Max entries per response frame: 3 bytes overhead (subcommand + length + more_to_follow), each entry is 4 bytes (NodeID MSB, NodeID LSB, S2 Message Count, Last Sequence Number).
HOST_SLEEP_SUBCOMMAND_LIST_IMPORTANT_DEVICES#
#define HOST_SLEEP_SUBCOMMAND_LIST_IMPORTANT_DEVICESValue:
0x00
HOST_SLEEP_SUBCOMMAND_CLEAR_IMPORTANT_DEVICES_LIST#
#define HOST_SLEEP_SUBCOMMAND_CLEAR_IMPORTANT_DEVICES_LISTValue:
0x01
HOST_SLEEP_SUBCOMMAND_ZW_MODULE_CAPABILITIES_REPORT#
#define HOST_SLEEP_SUBCOMMAND_ZW_MODULE_CAPABILITIES_REPORTValue:
0x03
HOST_SLEEP_SUBCOMMAND_REQUEST_WAKEUP_REPORT#
#define HOST_SLEEP_SUBCOMMAND_REQUEST_WAKEUP_REPORTValue:
0x04
HOST_SLEEP_SUBCOMMAND_REQUEST_S2_MESSAGE_COUNT#
#define HOST_SLEEP_SUBCOMMAND_REQUEST_S2_MESSAGE_COUNTValue:
0x06