Firmware SDK
|
AT command interface. More...
Data Structures | |
struct | twr_atci_param_t |
struct | twr_atci_command_t |
AT command struct. More... | |
Macros | |
#define | TWR_ATCI_UART TWR_UART_UART2 |
#define | TWR_ATCI_COMMANDS_LENGTH(COMMANDS) (sizeof(COMMANDS) / sizeof(COMMANDS[0])) |
#define | TWR_ATCI_COMMAND_CLAC {"+CLAC", twr_atci_clac_action, NULL, NULL, NULL, ""} |
#define | TWR_ATCI_COMMAND_HELP {"$HELP", twr_atci_help_action, NULL, NULL, NULL, "This help"} |
Functions | |
void | twr_atci_init (const twr_atci_command_t *commands, int length) |
Initialize. More... | |
void | twr_atci_write_ok (void) |
Write OK. | |
void | twr_atci_write_error (void) |
Write ERROR. | |
void | twr_atci_printf (const char *format,...) |
Prinf message and add CR LF. More... | |
bool | twr_atci_skip_response (void) |
Skip response, use in callback in twr_atci_command_t. | |
bool | twr_atci_clac_action (void) |
Helper for clac action. | |
bool | twr_atci_help_action (void) |
Helper for help action. | |
bool | twr_atci_get_uint (twr_atci_param_t *param, uint32_t *value) |
Parse string to uint and move parsing cursor forward. More... | |
bool | twr_atci_get_string (twr_atci_param_t *param, char *str, size_t length) |
Copy string and move parsing cursor forward. More... | |
bool | twr_atci_get_buffer_from_hex_string (twr_atci_param_t *param, void *buffer, size_t *length) |
Decode HEX string to buffer and move parsing cursor forward. More... | |
bool | twr_atci_is_comma (twr_atci_param_t *param) |
Check if the character at cursor is comma. More... | |
bool | twr_atci_is_quotation_mark (twr_atci_param_t *param) |
Check if the character at cursor is quotation mark (") More... | |
void | twr_atci_set_uart_active_callback (bool(*callback)(void), twr_tick_t scan_interval) |
Set callback function for scan if uart is active. Used for low-power when USB is disconnected (default callback: twr_system_get_vbus_sense, scan_interval: 200) More... | |
AT command interface.
bool twr_atci_get_buffer_from_hex_string | ( | twr_atci_param_t * | param, |
void * | buffer, | ||
size_t * | length | ||
) |
Decode HEX string to buffer and move parsing cursor forward.
[in] | param | ATCI instance |
[out] | destination | Pointer to destination buffer |
[in,out] | length | Number of bytes to be read, Number of bytes read |
Definition at line 332 of file twr_atci.c.
bool twr_atci_get_string | ( | twr_atci_param_t * | param, |
char * | str, | ||
size_t | length | ||
) |
Copy string and move parsing cursor forward.
[in] | param | ATCI instance |
[in] | value | pointer to str destination |
[in] | length | maximum str length |
Definition at line 295 of file twr_atci.c.
bool twr_atci_get_uint | ( | twr_atci_param_t * | param, |
uint32_t * | value | ||
) |
Parse string to uint and move parsing cursor forward.
[in] | param | ATCI instance |
[in] | value | pointer to number |
Definition at line 265 of file twr_atci.c.
void twr_atci_init | ( | const twr_atci_command_t * | commands, |
int | length | ||
) |
Initialize.
[in] | commands | |
[in] | length | Number of commands |
Definition at line 27 of file twr_atci.c.
bool twr_atci_is_comma | ( | twr_atci_param_t * | param | ) |
Check if the character at cursor is comma.
[in] | param | ATCI instance |
Definition at line 396 of file twr_atci.c.
bool twr_atci_is_quotation_mark | ( | twr_atci_param_t * | param | ) |
Check if the character at cursor is quotation mark (")
[in] | param | ATCI instance |
Definition at line 401 of file twr_atci.c.
void twr_atci_printf | ( | const char * | format, |
... | |||
) |
Prinf message and add CR LF.
[in] | format | Format string (printf style) |
[in] | ... | Optional format arguments |
Definition at line 46 of file twr_atci.c.
Referenced by twr_atci_clac_action(), and twr_atci_help_action().
void twr_atci_set_uart_active_callback | ( | bool(*)(void) | callback, |
twr_tick_t | scan_interval | ||
) |
Set callback function for scan if uart is active. Used for low-power when USB is disconnected (default callback: twr_system_get_vbus_sense, scan_interval: 200)
[in] | callback | Callback function address |
[in] | scan_interval | Desired scan interval in ticks |
Definition at line 406 of file twr_atci.c.
Referenced by twr_atci_init().