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, "List all available AT commands"} |
#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. | |
size_t | twr_atci_print (const char *message) |
Print message. More... | |
size_t | twr_atci_println (const char *message) |
Print message and add CR LF. More... | |
size_t | twr_atci_printf (const char *format,...) |
Prinf message. More... | |
size_t | twr_atci_printfln (const char *format,...) |
Prinf message and add CR LF. More... | |
size_t | twr_atci_print_buffer_as_hex (const void *buffer, size_t length) |
Print buffer as HEX string. 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 390 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 353 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 323 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 454 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 459 of file twr_atci.c.
size_t twr_atci_print | ( | const char * | message | ) |
Print message.
[in] | message | Message |
Definition at line 46 of file twr_atci.c.
size_t twr_atci_print_buffer_as_hex | ( | const void * | buffer, |
size_t | length | ||
) |
Print buffer as HEX string.
[in] | buffer | Pointer to source buffer |
[in] | length | Number of bytes to be written |
Definition at line 103 of file twr_atci.c.
size_t twr_atci_printf | ( | const char * | format, |
... | |||
) |
Prinf message.
[in] | format | Format string (printf style) |
[in] | ... | Optional format arguments |
Definition at line 68 of file twr_atci.c.
size_t twr_atci_printfln | ( | const char * | format, |
... | |||
) |
Prinf message and add CR LF.
[in] | format | Format string (printf style) |
[in] | ... | Optional format arguments |
Definition at line 84 of file twr_atci.c.
Referenced by twr_atci_clac_action(), and twr_atci_help_action().
size_t twr_atci_println | ( | const char * | message | ) |
Print message and add CR LF.
[in] | message | Message |
Definition at line 51 of file twr_atci.c.
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 464 of file twr_atci.c.
Referenced by twr_atci_init().