Implementations of functions that communicate directly with the SIM808 module and control it. More...
Functions | |
void | send_debug (const char *debug_msg) |
sends a debug message through the debug UART More... | |
void | send_raw_debug (uint8_t *debug_dump, uint8_t length) |
void | HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart) |
is called when the receive buffer of any UART has received 1 byte. it copies the received byte into the receive buffer which is a global variable: sim_rx_buffer. it also increases by one the counter of received bytes: rx_index. Which points to the next free index in the receive buffer. usart1 is always used to communicate with SIM module therefore AT_uart is defined as usart1. More... | |
uint8_t | sim_init (SIM808_typedef *sim) |
it initialises the SIM808_typedef struct members and powers on the module. initializes the UARTs and the GPIOs used to power on, reset and check the status of the module. Which UART peripheral is used for what is specified in the parameter SIM808_typedef members: AT_uart and debug_uart. More... | |
uint8_t | sim_power_off (SIM808_typedef *sim) |
power_off the module. More... | |
void | system_reset (SIM808_typedef *sim) |
power_off the module and reset the MCU More... | |
uint8_t | send_AT_cmd (const char *cmd, const char *expected_reply, uint8_t save_reply, char *cmd_reply, uint32_t rx_timeout) |
sends a cmd to the module, if the parameter save_reply == 1 then it copies the reply into the parameter cmd_reply. More... | |
uint8_t | is_subarray_present (const uint8_t *array, size_t array_len, const uint8_t *subarray, size_t subarray_len) |
uint8_t | send_serial_data (uint8_t *data, uint8_t length, char *cmd_reply, uint32_t rx_timeout) |
sends raw serial data to the SIM808 module through the AT_uart peripheral. Then it deletes the receive buffer. More... | |
Variables | |
UART_HandleTypeDef | huart1 |
UART_HandleTypeDef | huart2 |
Implementations of functions that communicate directly with the SIM808 module and control it.
void HAL_UART_RxCpltCallback | ( | UART_HandleTypeDef * | huart | ) |
is called when the receive buffer of any UART has received 1 byte. it copies the received byte into the receive buffer which is a global variable: sim_rx_buffer. it also increases by one the counter of received bytes: rx_index. Which points to the next free index in the receive buffer. usart1 is always used to communicate with SIM module therefore AT_uart is defined as usart1.
uint8_t is_subarray_present | ( | const uint8_t * | array, |
size_t | array_len, | ||
const uint8_t * | subarray, | ||
size_t | subarray_len | ||
) |
uint8_t send_AT_cmd | ( | const char * | cmd, |
const char * | expected_reply, | ||
uint8_t | save_reply, | ||
char * | cmd_reply, | ||
uint32_t | rx_timeout | ||
) |
sends a cmd to the module, if the parameter save_reply == 1 then it copies the reply into the parameter cmd_reply.
cmd | is the AT command to be sent |
expected_reply | is used to determine if the outcome of the function is SUCCESS or FAIL. |
save_reply | if set to 1, then the reply from the module gets copied into cmd_reply. |
cmd_reply | is an array where to modules reply is copied. |
rx_timeout | the maximum amount of time the function will wait for the module to receive a reply. |
void send_debug | ( | const char * | debug_msg | ) |
sends a debug message through the debug UART
debug_message | is the debug message. |
void send_raw_debug | ( | uint8_t * | debug_dump, |
uint8_t | length | ||
) |
uint8_t send_serial_data | ( | uint8_t * | data, |
uint8_t | length, | ||
char * | cmd_reply, | ||
uint32_t | rx_wait | ||
) |
sends raw serial data to the SIM808 module through the AT_uart peripheral. Then it deletes the receive buffer.
cmd | contains the command |
rx_wait | waiting time before exit. To make sure the reply is received. |
uint8_t sim_init | ( | SIM808_typedef * | sim | ) |
it initialises the SIM808_typedef struct members and powers on the module. initializes the UARTs and the GPIOs used to power on, reset and check the status of the module. Which UART peripheral is used for what is specified in the parameter SIM808_typedef members: AT_uart and debug_uart.
sim | is the definition of the sim808 hardware |
uint8_t sim_power_off | ( | SIM808_typedef * | sim | ) |
power_off the module.
sim | is the definition of the sim808 hardware |
void system_reset | ( | SIM808_typedef * | sim | ) |
power_off the module and reset the MCU
sim | is the definition of the sim808 hardware |
UART_HandleTypeDef huart1 |
UART_HandleTypeDef huart2 |