CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
eps_channel_control.c File Reference
#include "eps_drivers/eps_types.h"
#include "eps_drivers/eps_channel_control.h"
#include "eps_drivers/eps_commands.h"
#include <string.h>
#include <stdio.h>
Include dependency graph for eps_channel_control.c:

Functions

EPS_CHANNEL_enum_t EPS_channel_from_str (const char channel_name[])
 Converts an EPS channel name to a channel enum.
 
char * EPS_channel_to_str (EPS_CHANNEL_enum_t channel)
 Converts channel enum into an ASCII-printable name string.
 
uint8_t EPS_set_channel_enabled (EPS_CHANNEL_enum_t channel, uint8_t enabled)
 Sets the enabled state of an EPS channel (on or off).
 
uint8_t EPS_check_status_bit_of_channel (uint16_t status_bitfield_1, uint16_t status_bitfield_2, uint8_t channel_number)
 Takes in the status bitfields of the eps and outputs the status of the given channel number.
 
uint8_t EPS_convert_ch_num_to_string_and_append (char *response_output_buf, uint16_t response_output_buf_len, uint8_t ch_number)
 Convert EPS ch_number to ch_name, then append as a JSON list element to response_output_buf.
 
void EPS_get_enabled_channels_json (uint16_t status_bitfield_1, uint16_t status_bitfield_2, char *response_output_buf, uint16_t response_output_buf_len)
 

Function Documentation

◆ EPS_channel_from_str()

EPS_CHANNEL_enum_t EPS_channel_from_str ( const char channel_name[])

Converts an EPS channel name to a channel enum.

Parameters
channel_nameA case-insensitive c-string of the channel name (e.g., "mpi"), or a number representing the channel number (e.g., "1" or "16"). Valid string values: "vbatt_stack", "stack_5v", "stack_3v3", "camera", "uhf_antenna_deploy", "gnss", "mpi_5v", "mpi_12v", "boom".
Returns
The corresponding enum value. Returns EPS_CHANNEL_UNKNOWN if no match is found.
Here is the caller graph for this function:

◆ EPS_channel_to_str()

char * EPS_channel_to_str ( EPS_CHANNEL_enum_t channel)

Converts channel enum into an ASCII-printable name string.

Parameters
channelAn enum of typedef EPS_CHANNEL_enum_t representing the different channel names of the EPS Ex. EPS_CHANNEL_VBATT_STACK , EPS_CHANNEL_5V_CH2_UNUSED or EPS_CHANNEL_3V3_UHF_ANTENNA_DEPLOY
Returns
Returns a string of the channel name corresponding to the inputted channel enum
Here is the caller graph for this function:

◆ EPS_check_status_bit_of_channel()

uint8_t EPS_check_status_bit_of_channel ( uint16_t status_bitfield_1,
uint16_t status_bitfield_2,
uint8_t channel_number )

Takes in the status bitfields of the eps and outputs the status of the given channel number.

Parameters
status_bitfield_1The status bitfield of channels 0-15.
status_bitfield_2The status bitfield of channels 16-31.
Returns
0 if the channel is disabled, 1 if the channel is enabled, and 2 if channel number is invalid
Note
If all channels are enabled, the output buffer would be require about 300 bytes.
Here is the caller graph for this function:

◆ EPS_convert_ch_num_to_string_and_append()

uint8_t EPS_convert_ch_num_to_string_and_append ( char * response_output_buf,
uint16_t response_output_buf_len,
uint8_t ch_number )

Convert EPS ch_number to ch_name, then append as a JSON list element to response_output_buf.

Parameters
response_output_bufThe output buffer that will store the string
response_output_buf_lenThe total length of the output buffer
ch_numberThe channel number of the EPS that will be converted to channel name
Returns
0 when string was properly outputted into the buffer, 1 if the channel number is invalid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EPS_get_enabled_channels_json()

void EPS_get_enabled_channels_json ( uint16_t status_bitfield_1,
uint16_t status_bitfield_2,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EPS_set_channel_enabled()

uint8_t EPS_set_channel_enabled ( EPS_CHANNEL_enum_t channel,
uint8_t enabled )

Sets the enabled state of an EPS channel (on or off).

Parameters
channelThe channel to enable or disable.
enabled0 to disable, >0 to enable.
Returns
0 on success, >0 on failure. Returns 99 if channel is unknown. Propagates the return value from EPS_CMD_output_bus_channel_on/off().
Here is the call graph for this function:
Here is the caller graph for this function: