CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
ant_commands.c File Reference
#include "main.h"
#include "antenna_deploy_drivers/ant_internal_drivers.h"
#include "antenna_deploy_drivers/ant_commands.h"
#include "stm32l4xx_hal_i2c.h"
#include "log/log.h"
#include <stdint.h>
#include <stdio.h>
Include dependency graph for ant_commands.c:

Functions

uint8_t ANT_CMD_reset (enum ANT_i2c_bus_mcu i2c_bus_mcu)
 Performs a reset of the antenna deployment systems microcontroller which is specified.
 
uint8_t ANT_CMD_arm_antenna_system (enum ANT_i2c_bus_mcu i2c_bus_mcu)
 Arm the antenna deploy system.
 
uint8_t ANT_CMD_disarm_antenna_system (enum ANT_i2c_bus_mcu i2c_bus_mcu)
 Disarms the antenna deploy system.
 
uint8_t ANT_CMD_deploy_antenna (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint8_t antenna, uint8_t activation_time_seconds)
 activates the deployment system for the selected antenna for the specified amount of time
 
uint8_t ANT_CMD_start_automated_sequential_deployment (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint8_t activation_time_seconds)
 deploys all antennas one by one sequentially.
 
uint8_t ANT_CMD_deploy_antenna_with_override (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint8_t antenna, uint8_t activation_time_seconds)
 initiates deployment of the selected antenna, ignoring whether the current status of that antenna is deployed
 
uint8_t ANT_CMD_cancel_deployment_system_activation (enum ANT_i2c_bus_mcu i2c_bus_mcu)
 cancels any active attempts to deploy an antenna
 
uint8_t ANT_CMD_measure_temp (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint16_t *result)
 Measures the temperature at the antenna controller system.
 
int16_t ANT_convert_raw_temp_to_cCelsius (uint16_t measurement)
 Converts temperature measurement to centi-degrees celsius.
 
static uint8_t extract_bit (uint8_t byte, uint8_t position)
 
uint8_t ANT_CMD_report_deployment_status (enum ANT_i2c_bus_mcu i2c_bus_mcu, ANT_deployment_status_struct_t *response)
 Writes 2 bytes of information representing the deployment status of the antennas to the passed buffer, information on interpreting the response may be found in the ISIS Antenna System user manual. Doc ID: ISIS.ANTS.UM.001 pg. 42.
 
uint8_t ANT_CMD_report_antenna_deployment_activation_count (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint8_t antenna, uint8_t *response)
 writes the number of times deployment has been attempted (for a specified antenna and mcu) in a response buffer.
 
uint8_t ANT_CMD_get_antenna_deployment_activation_time (enum ANT_i2c_bus_mcu i2c_bus_mcu, uint8_t antenna, uint32_t *result_ms)
 writes the cumulative time (in ms increments) that the deployment system has been active (for a specified antenna and mcu) in a response buffer.
 

Variables

static const uint8_t ANT_CMD_RESET = 0xAA
 
static const uint8_t ANT_CMD_ARM_ANTENNA_SYSTEM = 0xAD
 
static const uint8_t ANT_CMD_DISARM_ANTENNA_SYSTEM = 0xAC
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA1 = 0xA1
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA2 = 0xA2
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA3 = 0xA3
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA4 = 0xA4
 
static const uint8_t ANT_CMD_DEPLOY_ALL_ANTENNAS_SEQ = 0xA5
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA1_OVERRIDE = 0xBA
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA2_OVERRIDE = 0xBB
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA3_OVERRIDE = 0xBC
 
static const uint8_t ANT_CMD_DEPLOY_ANTENNA4_OVERRIDE = 0xBD
 
static const uint8_t ANT_CMD_CANCEL_DEPLOYMENT = 0xA9
 
static const uint8_t ANT_CMD_MEASURE_TEMP = 0xC0
 
static const uint8_t ANT_CMD_REPORT_DEPLOYMENT_STATUS = 0xC3
 
static const uint8_t ANT_CMD_REPORT_ANT1_DEPLOYMENT_COUNT = 0xB0
 
static const uint8_t ANT_CMD_REPORT_ANT2_DEPLOYMENT_COUNT = 0xB1
 
static const uint8_t ANT_CMD_REPORT_ANT3_DEPLOYMENT_COUNT = 0xB2
 
static const uint8_t ANT_CMD_REPORT_ANT4_DEPLOYMENT_COUNT = 0xB3
 
static const uint8_t ANT_CMD_REPORT_ANT1_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB4
 
static const uint8_t ANT_CMD_REPORT_ANT2_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB5
 
static const uint8_t ANT_CMD_REPORT_ANT3_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB6
 
static const uint8_t ANT_CMD_REPORT_ANT4_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB7
 

Function Documentation

◆ ANT_CMD_arm_antenna_system()

uint8_t ANT_CMD_arm_antenna_system ( enum ANT_i2c_bus_mcu i2c_bus_mcu)

Arm the antenna deploy system.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to arm, and which i2c bus to use
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Note
arming one mcu does not arm the other. Each mcu must be armed before it can be used to deploy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_cancel_deployment_system_activation()

uint8_t ANT_CMD_cancel_deployment_system_activation ( enum ANT_i2c_bus_mcu i2c_bus_mcu)

cancels any active attempts to deploy an antenna

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to transmit to, and which i2c bus to use
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_deploy_antenna()

uint8_t ANT_CMD_deploy_antenna ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint8_t antenna,
uint8_t activation_time_seconds )

activates the deployment system for the selected antenna for the specified amount of time

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to use, and which i2c bus to use
antennaThe antenna number of the antenna to deploy, this is a number between 1-4.
activation_time_secondsthe amount of time the deployment system should be active for in seconds.
Returns
0 when the antenna deployment system has received the command, >0 otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_deploy_antenna_with_override()

uint8_t ANT_CMD_deploy_antenna_with_override ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint8_t antenna,
uint8_t activation_time_seconds )

initiates deployment of the selected antenna, ignoring whether the current status of that antenna is deployed

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to use, and which i2c bus to use
antennathe antenna to deploy
activation_time_secondsthe amount of time the deployment system should be active for in seconds.
Returns
0 when the antenna deployment system has received the command, >0 otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_disarm_antenna_system()

uint8_t ANT_CMD_disarm_antenna_system ( enum ANT_i2c_bus_mcu i2c_bus_mcu)

Disarms the antenna deploy system.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to disarm, and which i2c bus to use
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_get_antenna_deployment_activation_time()

uint8_t ANT_CMD_get_antenna_deployment_activation_time ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint8_t antenna,
uint32_t * result_ms )

writes the cumulative time (in ms increments) that the deployment system has been active (for a specified antenna and mcu) in a response buffer.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to transmit to, and which i2c bus to use
antennathe antenna to check. A number between 1-4
result_msa 2 byte buffer where the cumulative deployment time (in ms increments) will be written. divide the response by 20 to get seconds.
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Note
data written to the result buffer is only valid if 0 was returned. One should check this before using the result.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_measure_temp()

uint8_t ANT_CMD_measure_temp ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint16_t * result )

Measures the temperature at the antenna controller system.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to transmit to, and which i2c bus to use
resulta pointer to a 16 bit unsigned integer where the temperature measurement is written. Refer to the "ISIS.ANTS.UM.001" datasheet by ISISpace for information on interpreting this measurement
Returns
0 when the antenna deployment system has received the command, > 0 otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_report_antenna_deployment_activation_count()

uint8_t ANT_CMD_report_antenna_deployment_activation_count ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint8_t antenna,
uint8_t * response )

writes the number of times deployment has been attempted (for a specified antenna and mcu) in a response buffer.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to check, and which i2c bus to use
antennathe antenna to check
responsea 1 byte buffer where the count of attempted deployments will be written
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Note
data written to the response buffer is only valid if 0 was returned. One should check this before using the response.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_report_deployment_status()

uint8_t ANT_CMD_report_deployment_status ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
ANT_deployment_status_struct_t * response )

Writes 2 bytes of information representing the deployment status of the antennas to the passed buffer, information on interpreting the response may be found in the ISIS Antenna System user manual. Doc ID: ISIS.ANTS.UM.001 pg. 42.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to transmit to, and which i2c bus to use
responsea two byte buffer where the status information is written to.
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Note
- Data written to the response struct is only valid if 0 was returned. One should check this before using the response.
- This command probes the micro controller specified. data from each mcu may differ.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_reset()

uint8_t ANT_CMD_reset ( enum ANT_i2c_bus_mcu i2c_bus_mcu)

Performs a reset of the antenna deployment systems microcontroller which is specified.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to reset, and which i2c bus to use
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_CMD_start_automated_sequential_deployment()

uint8_t ANT_CMD_start_automated_sequential_deployment ( enum ANT_i2c_bus_mcu i2c_bus_mcu,
uint8_t activation_time_seconds )

deploys all antennas one by one sequentially.

Parameters
i2c_bus_mcuspecifies which mcu on the antenna deployment system to use, and which i2c bus to use
activation_time_secondsthe amount of time the deployment system for each antenna should be active for in seconds
Returns
0 when the antenna deployment system has received the command, >0 otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ANT_convert_raw_temp_to_cCelsius()

int16_t ANT_convert_raw_temp_to_cCelsius ( uint16_t measurement)

Converts temperature measurement to centi-degrees celsius.

Parameters
measurementmeasurement result from ANT_CMD_measure_temp()
Returns
returns the temperature in centi-degrees celsius
Note
The formula used is based on the formula found in the data sheet for the LM94022. Derivation can be found on github issue#146.
Here is the caller graph for this function:

◆ extract_bit()

static uint8_t extract_bit ( uint8_t byte,
uint8_t position )
static
Here is the caller graph for this function:

Variable Documentation

◆ ANT_CMD_ARM_ANTENNA_SYSTEM

const uint8_t ANT_CMD_ARM_ANTENNA_SYSTEM = 0xAD
static

◆ ANT_CMD_CANCEL_DEPLOYMENT

const uint8_t ANT_CMD_CANCEL_DEPLOYMENT = 0xA9
static

◆ ANT_CMD_DEPLOY_ALL_ANTENNAS_SEQ

const uint8_t ANT_CMD_DEPLOY_ALL_ANTENNAS_SEQ = 0xA5
static

◆ ANT_CMD_DEPLOY_ANTENNA1

const uint8_t ANT_CMD_DEPLOY_ANTENNA1 = 0xA1
static

◆ ANT_CMD_DEPLOY_ANTENNA1_OVERRIDE

const uint8_t ANT_CMD_DEPLOY_ANTENNA1_OVERRIDE = 0xBA
static

◆ ANT_CMD_DEPLOY_ANTENNA2

const uint8_t ANT_CMD_DEPLOY_ANTENNA2 = 0xA2
static

◆ ANT_CMD_DEPLOY_ANTENNA2_OVERRIDE

const uint8_t ANT_CMD_DEPLOY_ANTENNA2_OVERRIDE = 0xBB
static

◆ ANT_CMD_DEPLOY_ANTENNA3

const uint8_t ANT_CMD_DEPLOY_ANTENNA3 = 0xA3
static

◆ ANT_CMD_DEPLOY_ANTENNA3_OVERRIDE

const uint8_t ANT_CMD_DEPLOY_ANTENNA3_OVERRIDE = 0xBC
static

◆ ANT_CMD_DEPLOY_ANTENNA4

const uint8_t ANT_CMD_DEPLOY_ANTENNA4 = 0xA4
static

◆ ANT_CMD_DEPLOY_ANTENNA4_OVERRIDE

const uint8_t ANT_CMD_DEPLOY_ANTENNA4_OVERRIDE = 0xBD
static

◆ ANT_CMD_DISARM_ANTENNA_SYSTEM

const uint8_t ANT_CMD_DISARM_ANTENNA_SYSTEM = 0xAC
static

◆ ANT_CMD_MEASURE_TEMP

const uint8_t ANT_CMD_MEASURE_TEMP = 0xC0
static

◆ ANT_CMD_REPORT_ANT1_DEPLOYMENT_COUNT

const uint8_t ANT_CMD_REPORT_ANT1_DEPLOYMENT_COUNT = 0xB0
static

◆ ANT_CMD_REPORT_ANT1_DEPLOYMENT_SYS_ACTIVATION_TIME

const uint8_t ANT_CMD_REPORT_ANT1_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB4
static

◆ ANT_CMD_REPORT_ANT2_DEPLOYMENT_COUNT

const uint8_t ANT_CMD_REPORT_ANT2_DEPLOYMENT_COUNT = 0xB1
static

◆ ANT_CMD_REPORT_ANT2_DEPLOYMENT_SYS_ACTIVATION_TIME

const uint8_t ANT_CMD_REPORT_ANT2_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB5
static

◆ ANT_CMD_REPORT_ANT3_DEPLOYMENT_COUNT

const uint8_t ANT_CMD_REPORT_ANT3_DEPLOYMENT_COUNT = 0xB2
static

◆ ANT_CMD_REPORT_ANT3_DEPLOYMENT_SYS_ACTIVATION_TIME

const uint8_t ANT_CMD_REPORT_ANT3_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB6
static

◆ ANT_CMD_REPORT_ANT4_DEPLOYMENT_COUNT

const uint8_t ANT_CMD_REPORT_ANT4_DEPLOYMENT_COUNT = 0xB3
static

◆ ANT_CMD_REPORT_ANT4_DEPLOYMENT_SYS_ACTIVATION_TIME

const uint8_t ANT_CMD_REPORT_ANT4_DEPLOYMENT_SYS_ACTIVATION_TIME = 0xB7
static

◆ ANT_CMD_REPORT_DEPLOYMENT_STATUS

const uint8_t ANT_CMD_REPORT_DEPLOYMENT_STATUS = 0xC3
static

◆ ANT_CMD_RESET

const uint8_t ANT_CMD_RESET = 0xAA
static