CTS-SAT-1-OBC-Firmware
|
Go to the source code of this file.
Macros | |
#define | ADCS_i2c_HANDLE &hi2c1 |
Functions | |
uint8_t | ADCS_convert_uint16_to_reversed_uint8_array_members (uint8_t *array, uint16_t value, uint16_t index) |
Swap low and high bytes of a uint16 to turn into uint8 and put into specified index of an array. | |
uint8_t | ADCS_convert_uint32_to_reversed_uint8_array_members (uint8_t *array, uint32_t value, uint16_t index) |
Reverse the order of the four bytes of a uint32 to turn into uint8 and put into specified index of an array. | |
uint8_t | ADCS_convert_double_to_string (double input, uint8_t precision, char *output_string, uint16_t str_len) |
Convert a double into a string with a given decimal precision. | |
uint8_t | ADCS_combine_sd_log_bitmasks (const uint8_t **array_in, const uint8_t array_in_len, uint8_t *array_out) |
Take an arbitrary number (up to 63) of 10-byte uint8 arrays and return a single array which is the bitwise OR of all of them. | |
uint8_t | ADCS_i2c_send_command_and_check (uint8_t id, uint8_t *data, uint32_t data_length, uint8_t include_checksum) |
Sends a telecommand over I2C to the ADCS, checks that it's been acknowledged, and returns the ACK error flag. | |
uint8_t | ADCS_i2c_request_telemetry_and_check (uint8_t id, uint8_t *data, uint32_t data_length, uint8_t include_checksum) |
Sends a telemetry request over I2C to the ADCS, and resends repeatedly if the checksums don't match. | |
uint8_t | ADCS_send_i2c_telecommand (uint8_t id, uint8_t *data, uint32_t data_length, uint8_t include_checksum) |
Sends a telecommand over I2C to the ADCS. | |
uint8_t | ADCS_send_i2c_telemetry_request (uint8_t id, uint8_t *data, uint32_t data_length, uint8_t include_checksum) |
Sends a telemetry request over I2C to the ADCS. | |
uint8_t | ADCS_initialize_crc8_checksum () |
Initialize the lookup table for 8-bit CRC calculation. Code provided by ADCS Firmware Reference Manual (p.18-19). | |
uint8_t | ADCS_calculate_crc8_checksum (uint8_t *buffer, uint16_t len) |
Calculates an 8-bit CRC value. Code provided by ADCS Firmware Reference Manual (p.19). | |
Variables | |
static const uint8_t | ADCS_INCLUDE_CHECKSUM = 1 |
static const uint8_t | ADCS_NO_CHECKSUM = 0 |
static const uint8_t | ADCS_CHECKSUM_TIMEOUT_TRIES = 100 |
static const uint16_t | ADCS_PROCESSED_TIMEOUT_TRIES = 1000 |
static const uint16_t | ADCS_FILE_POINTER_TIMEOUT_MS = 60000 |
static const uint32_t | ADCS_FILE_DOWNLOAD_TIMEOUT_MS = 290000 |
#define ADCS_i2c_HANDLE &hi2c1 |
uint8_t ADCS_calculate_crc8_checksum | ( | uint8_t * | buffer, |
uint16_t | len ) |
Calculates an 8-bit CRC value. Code provided by ADCS Firmware Reference Manual (p.19).
[in] | buffer | the buffer containing data for which to calculate the crc value |
[in] | len | the number of bytes of valid data in the buffer |
uint8_t ADCS_combine_sd_log_bitmasks | ( | const uint8_t ** | array_in, |
const uint8_t | array_in_len, | ||
uint8_t * | array_out ) |
Take an arbitrary number (up to 63) of 10-byte uint8 arrays and return a single array which is the bitwise OR of all of them.
[in] | array_in | Array of pointers to 10-byte uint8 data arrays |
[in] | array_in_len | Size of the array_in array |
[out] | array_out | 10-byte uint8 data array to send the result to |
uint8_t ADCS_convert_double_to_string | ( | double | input, |
uint8_t | precision, | ||
char * | output_string, | ||
uint16_t | str_len ) |
Convert a double into a string with a given decimal precision.
[in] | input | Value to convert. |
[in] | precision | Number of decimal places to use. |
[out] | output_string | Character array to write the string number to. |
[in] | str_len | Length of the output string. |
uint8_t ADCS_convert_uint16_to_reversed_uint8_array_members | ( | uint8_t * | array, |
uint16_t | value, | ||
uint16_t | index ) |
Swap low and high bytes of a uint16 to turn into uint8 and put into specified index of an array.
[in] | value | Value to split and swap the order of. |
[in] | index | Index in array to write the result. (Array must contain at least two bytes, with index pointing to the first) |
[out] | array | Data array to write the two bytes to at the specified index and index + 1. |
uint8_t ADCS_convert_uint32_to_reversed_uint8_array_members | ( | uint8_t * | array, |
uint32_t | value, | ||
uint16_t | index ) |
Reverse the order of the four bytes of a uint32 to turn into uint8 and put into specified index of an array.
[in] | value | Value to split and swap the order of. |
[in] | index | Index in array to write the result. (Array must contain at least four bytes, with index pointing to the first) |
[out] | array | Data array to write the four bytes to at the specified index and the three subsequent indices. |
uint8_t ADCS_i2c_request_telemetry_and_check | ( | uint8_t | id, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
uint8_t | include_checksum ) |
Sends a telemetry request over I2C to the ADCS, and resends repeatedly if the checksums don't match.
[in] | id | Valid ADCS telemetry request ID (see Firmware Reference Manual) |
[in] | include_checksum | Tells the ADCS whether to use a CRC8 checksum; should be either ADCS_INCLUDE_CHECKSUM or ADCS_NO_CHECKSUM |
[in] | data_length | Length of the data array. |
[out] | data | Data array to write the raw telemetry bytes to; length must be at least data_length (should contain the correct number of bytes for the given telemetry request ID) |
uint8_t ADCS_i2c_send_command_and_check | ( | uint8_t | id, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
uint8_t | include_checksum ) |
Sends a telecommand over I2C to the ADCS, checks that it's been acknowledged, and returns the ACK error flag.
[in] | id | Valid ADCS telecommand ID (see Firmware Reference Manual) |
[in] | data | Data array to send the raw data bytes; length must be at least data_length (should contain the correct number of bytes for the given telecommand ID) |
[in] | data_length | Length of the data array. |
[in] | include_checksum | Tells the ADCS whether to use a CRC8 checksum; should be either ADCS_INCLUDE_CHECKSUM or ADCS_NO_CHECKSUM |
uint8_t ADCS_initialize_crc8_checksum | ( | ) |
Initialize the lookup table for 8-bit CRC calculation. Code provided by ADCS Firmware Reference Manual (p.18-19).
uint8_t ADCS_send_i2c_telecommand | ( | uint8_t | id, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
uint8_t | include_checksum ) |
Sends a telecommand over I2C to the ADCS.
[in] | id | Valid ADCS telecommand ID (see Firmware Reference Manual) |
[in] | data | Data array to send the raw data bytes; length must be at least data_length (should contain the correct number of bytes for the given telecommand ID) |
[in] | data_length | Length of the data array. |
[in] | include_checksum | Tells the ADCS whether to use a CRC8 checksum; should be either ADCS_INCLUDE_CHECKSUM or ADCS_NO_CHECKSUM |
uint8_t ADCS_send_i2c_telemetry_request | ( | uint8_t | id, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
uint8_t | include_checksum ) |
Sends a telemetry request over I2C to the ADCS.
[in] | id | Valid ADCS telemetry request ID (see Firmware Reference Manual) |
[in] | include_checksum | Tells the ADCS whether to use a CRC8 checksum; should be either ADCS_INCLUDE_CHECKSUM or ADCS_NO_CHECKSUM |
[in] | data_length | Length of the data array. |
[out] | data | Data array to write the raw telemetry bytes to; length must be at least data_length (should contain the correct number of bytes for the given telemetry request ID) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |