CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
uart_telelecommand_defs.c File Reference
Include dependency graph for uart_telelecommand_defs.c:

Functions

uint8_t TCMDEXEC_uart_send_hex_get_response_hex (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Send arbitrary commands to a UART peripheral, and receive the response.
 
uint8_t TCMDEXEC_uart_get_last_rx_times_json (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Get a JSON dict of how long, in ms, SINCE each UART ISR handler was last triggered.
 
uint8_t TCMDEXEC_uart_set_baud_rate (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 

Variables

static const uint16_t UART_TX_TIMEOUT_DURATION_MS = 200
 Timeout duration for transmit HAL call, in milliseconds.
 
static const uint16_t UART_RX_TIMEOUT_DURATION_MS = 300
 Timeout duration for receive in milliseconds. Same between bytes and at the start.
 
const uint16_t tx_buffer_max_size = 5120
 
const uint16_t rx_buffer_max_size = 5120
 
static uint8_t tx_buffer [5120]
 
static uint8_t rx_buffer [5120]
 

Function Documentation

◆ TCMDEXEC_uart_get_last_rx_times_json()

uint8_t TCMDEXEC_uart_get_last_rx_times_json ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Get a JSON dict of how long, in ms, SINCE each UART ISR handler was last triggered.

Note
Uses placeholder "-99" to mean "never triggered". A value of 50 means that handler was last triggered 50ms ago.
Intended for debugging and testing purposes, but safe to use in flight also.

◆ TCMDEXEC_uart_send_hex_get_response_hex()

uint8_t TCMDEXEC_uart_send_hex_get_response_hex ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Send arbitrary commands to a UART peripheral, and receive the response.

Parameters
args_str
  • Arg 0: UART port name to send data to: MPI, GNSS, CAMERA, EPS (case insensitive)
  • Arg 1: Data to be sent (bytes specified as hex - Max 5KiB buffer)
response_output_bufThe buffer to write the response to
response_output_buf_lenThe maximum length of the response_output_buf (its size)
Returns
0: Success, 1: Error parsing args, 2: Invalid uart port requested, 3: Error transmitting data, 4: Error receiving data, 5: Timeout waiting for response / No response, 6: Peripheral specific error, 7: Unhandled error
Note
This function doesn't toggle the EPS power lines for peripherals. Ensure they are powered on before using this function.
The camera UART port does not support receiving data in the function. TX only.
Here is the call graph for this function:

◆ TCMDEXEC_uart_set_baud_rate()

uint8_t TCMDEXEC_uart_set_baud_rate ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:

Variable Documentation

◆ rx_buffer

uint8_t rx_buffer[5120]
static

◆ rx_buffer_max_size

const uint16_t rx_buffer_max_size = 5120

◆ tx_buffer

uint8_t tx_buffer[5120]
static

◆ tx_buffer_max_size

const uint16_t tx_buffer_max_size = 5120

◆ UART_RX_TIMEOUT_DURATION_MS

const uint16_t UART_RX_TIMEOUT_DURATION_MS = 300
static

Timeout duration for receive in milliseconds. Same between bytes and at the start.

◆ UART_TX_TIMEOUT_DURATION_MS

const uint16_t UART_TX_TIMEOUT_DURATION_MS = 200
static

Timeout duration for transmit HAL call, in milliseconds.