CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
ax100_tx.c File Reference
#include "main.h"
#include "comms_drivers/ax100_tx.h"
#include "comms_drivers/ax100_hw.h"
#include "log/log.h"
#include "debug_tools/debug_uart.h"
#include "rtos_tasks/rtos_bootup_operation_fsm_task.h"
#include "comms_drivers/rf_antenna_switch.h"
#include <string.h>
#include <stdint.h>
Include dependency graph for ax100_tx.c:

Functions

static void prepend_csp_header (uint8_t *destination, uint8_t *data, uint32_t data_len)
 Write the csp header (4 bytes) to the beginning of the packet, then copy the rest of data into destination.
 
static uint8_t send_bytes_to_ax100 (uint8_t *packet, uint16_t packet_size)
 Send a csp packet over i2c to the AX100 for downlink.
 
uint8_t AX100_downlink_bytes (uint8_t *data, uint16_t data_len)
 Send data to the ax100 for downlink.
 

Variables

uint32_t AX100_enable_downlink_uart_logs = 0
 When enabled, the radio packets will be sent to the Debug UART for debugging purposes.
 
uint32_t AX100_enable_downlink_inhibited_uart_logs = 1
 When enabled, log messages like "Downlink inhibited: ..." will be sent to the Debug UART.
 
static const uint32_t csp_priority = 3u << 30
 
static const uint32_t own_csp_addr = 1u << 25
 
static const uint32_t ground_station_csp_addr = 10u << 20
 
static const uint32_t ground_station_csp_port = 10u << 14
 
static const uint32_t own_csp_port = 10u << 8
 
static const uint32_t use_hmac = 0 << 3
 
static const uint32_t use_xtea = 0 << 2
 
static const uint32_t use_rdp = 0 << 1
 
static const uint32_t use_crc = 0
 
static const uint32_t AX100_i2c_tx_timeout_ms = 100
 
static uint8_t packet_buffer_including_csp_header [AX100_DOWNLINK_MAX_BYTES+AX100_CSP_HEADER_LENGTH_BYTES]
 

Function Documentation

◆ AX100_downlink_bytes()

uint8_t AX100_downlink_bytes ( uint8_t * data,
uint16_t data_len )

Send data to the ax100 for downlink.

Parameters
datapointer to the data to downlink
data_lenlength of the data
Returns
0 on success, >0 on error/failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepend_csp_header()

static void prepend_csp_header ( uint8_t * destination,
uint8_t * data,
uint32_t data_len )
static

Write the csp header (4 bytes) to the beginning of the packet, then copy the rest of data into destination.

Parameters
destinationwhere the assembled packet will be stored
datadata to place in the packet
data_lenlength of data
Here is the caller graph for this function:

◆ send_bytes_to_ax100()

static uint8_t send_bytes_to_ax100 ( uint8_t * packet,
uint16_t packet_size )
static

Send a csp packet over i2c to the AX100 for downlink.

Note
Only use in this file.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AX100_enable_downlink_inhibited_uart_logs

uint32_t AX100_enable_downlink_inhibited_uart_logs = 1

When enabled, log messages like "Downlink inhibited: ..." will be sent to the Debug UART.

Note
Logs are important to ensure that radio downlinks aren't sent before the antenna is deployed. These logs get very annoying though, so they can be turned off with this variable.
Only useful for configuration in ground testing.

◆ AX100_enable_downlink_uart_logs

uint32_t AX100_enable_downlink_uart_logs = 0

When enabled, the radio packets will be sent to the Debug UART for debugging purposes.

Note
Only useful for configuration in ground testing.

◆ AX100_i2c_tx_timeout_ms

const uint32_t AX100_i2c_tx_timeout_ms = 100
static

◆ csp_priority

const uint32_t csp_priority = 3u << 30
static

◆ ground_station_csp_addr

const uint32_t ground_station_csp_addr = 10u << 20
static

◆ ground_station_csp_port

const uint32_t ground_station_csp_port = 10u << 14
static

◆ own_csp_addr

const uint32_t own_csp_addr = 1u << 25
static

◆ own_csp_port

const uint32_t own_csp_port = 10u << 8
static

◆ packet_buffer_including_csp_header

uint8_t packet_buffer_including_csp_header[AX100_DOWNLINK_MAX_BYTES+AX100_CSP_HEADER_LENGTH_BYTES]
static

◆ use_crc

const uint32_t use_crc = 0
static

◆ use_hmac

const uint32_t use_hmac = 0 << 3
static

◆ use_rdp

const uint32_t use_rdp = 0 << 1
static

◆ use_xtea

const uint32_t use_xtea = 0 << 2
static