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

Functions

void COMMS_set_rf_switch_state (uint8_t antenna_num)
 Sets the state of the dipole switch on the OBC to either Antenna 1 or Antenna 2.
 
uint8_t COMMS_find_optimal_antenna_using_adcs ()
 Determines the optimal antenna to use based on the satellite's attitude angles.
 
void COMMS_toggle_rf_switch_state ()
 Toggles the active antenna (selected by RF switch), from 1 to 2 or from 2 to 1.
 
COMMS_rf_switch_control_mode_enum_t COMMS_rf_switch_control_mode_enum_from_string (const char *str)
 
const char * COMMS_rf_switch_control_mode_enum_to_string (COMMS_rf_switch_control_mode_enum_t mode)
 

Variables

uint8_t COMMS_active_rf_switch_antenna = 1
 
COMMS_rf_switch_control_mode_enum_t COMMS_rf_switch_control_mode = COMMS_RF_SWITCH_CONTROL_MODE_TOGGLE_BEFORE_EVERY_BEACON
 
uint32_t COMMS_max_duration_without_uplink_before_setting_default_rf_switch_mode_sec = 15 * 60
 If the satellite goes this long without receiving an uplink, the COMMS_rf_switch_control_mode will be set back to TOGGLE_BEFORE_EVERY_BEACON.
 

Function Documentation

◆ COMMS_find_optimal_antenna_using_adcs()

uint8_t COMMS_find_optimal_antenna_using_adcs ( )

Determines the optimal antenna to use based on the satellite's attitude angles.

Returns
1 if Antenna 1 is optimal, 2 if Antenna 2 is optimal, 0 if an error occurs in retrieving attitude data.
Note
Utilizes estimated roll and pitch angles from the ADCS to make a decision on antenna orientation.
Angles were based of of the following logic -> https://docs.google.com/document/d/1kpgU5hM9LwyNtvdzwdpbq_XNiqCRhPLB0nauKUpm5I4/edit?tab=t.0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ COMMS_rf_switch_control_mode_enum_from_string()

COMMS_rf_switch_control_mode_enum_t COMMS_rf_switch_control_mode_enum_from_string ( const char * str)
Here is the caller graph for this function:

◆ COMMS_rf_switch_control_mode_enum_to_string()

const char * COMMS_rf_switch_control_mode_enum_to_string ( COMMS_rf_switch_control_mode_enum_t mode)
Here is the caller graph for this function:

◆ COMMS_set_rf_switch_state()

void COMMS_set_rf_switch_state ( uint8_t antenna_num)

Sets the state of the dipole switch on the OBC to either Antenna 1 or Antenna 2.

Parameters
antenna_numEither 1 or 2. If not 1 or 2, then remains unchanged.
Note
Specification in https://github.com/CalgaryToSpace/CTS-SAT-1-OBC-Firmware/issues/417.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ COMMS_toggle_rf_switch_state()

void COMMS_toggle_rf_switch_state ( )

Toggles the active antenna (selected by RF switch), from 1 to 2 or from 2 to 1.

Note
This function can be used to manually toggle the active antenna, regardless of the result of COMMS_find_optimal_antenna.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ COMMS_active_rf_switch_antenna

uint8_t COMMS_active_rf_switch_antenna = 1

◆ COMMS_max_duration_without_uplink_before_setting_default_rf_switch_mode_sec

uint32_t COMMS_max_duration_without_uplink_before_setting_default_rf_switch_mode_sec = 15 * 60

If the satellite goes this long without receiving an uplink, the COMMS_rf_switch_control_mode will be set back to TOGGLE_BEFORE_EVERY_BEACON.

◆ COMMS_rf_switch_control_mode