CTS-SAT-1-OBC-Firmware
|
#include "mpi/mpi_command_handling.h"
#include "mpi/mpi_types.h"
#include "mpi/mpi_transceiver.h"
#include "eps_drivers/eps_channel_control.h"
#include "uart_handler/uart_handler.h"
#include "log/log.h"
#include "debug_tools/debug_uart.h"
#include "littlefs/littlefs_helper.h"
#include "timekeeping/timekeeping.h"
#include "transforms/arrays.h"
#include "main.h"
#include "stm32l4xx_hal.h"
#include <string.h>
#include <stdio.h>
Functions | |
uint8_t | MPI_send_command_get_response (const uint8_t *bytes_to_send, const size_t bytes_to_send_len, uint8_t *rx_buffer, const size_t rx_buffer_max_size, uint16_t *rx_buffer_len) |
Sends commandcode+params to the MPI as bytes. | |
uint8_t | MPI_validate_command_response (const uint8_t command_code, uint8_t *rx_buffer, const uint16_t rx_buffer_len) |
The MPI responds to each telecommand with a response code consisting of an echo of the telecommand code byte and a status byte (either 254 or OxFE) for success or error code otherwise. | |
static void | MPI_power_on () |
Turns on MPI by setting the corresponding EPS channel. | |
static int8_t | MPI_write_file_header () |
static int8_t | MPI_prepare_receive_data (const char output_file_path[]) |
Turns on MPI and prepares a LFS file to store MPI data in. | |
uint8_t | MPI_enable_active_mode (const char output_file_path[]) |
Turns on MPI science mode and Enables DMA interrupt for MPI channel. | |
static void | MPI_power_off () |
Turns off MPI by resetting the corresponding EPS channel. | |
uint8_t | MPI_disable_active_mode () |
Variables | |
static const uint16_t | MPI_TX_TIMEOUT_DURATION_MS = 100 |
Timeout duration for transmit HAL call, in milliseconds. | |
static const uint16_t | MPI_RX_TIMEOUT_DURATION_MS = 2000 |
Timeout duration for receive in milliseconds. Same between bytes and at the start. | |
volatile MPI_rx_mode_t | MPI_current_uart_rx_mode = MPI_RX_MODE_NOT_LISTENING_TO_MPI |
Current mode under which the MPI is being operated. | |
uint8_t | MPI_science_data_file_is_open = 0 |
uint32_t | MPI_science_data_bytes_lost = 0 |
lfs_file_t | MPI_science_data_file_pointer |
uint32_t | MPI_recording_start_uptime_ms |
uint8_t MPI_disable_active_mode | ( | ) |
uint8_t MPI_enable_active_mode | ( | const char | output_file_path[] | ) |
Turns on MPI science mode and Enables DMA interrupt for MPI channel.
|
static |
Turns off MPI by resetting the corresponding EPS channel.
|
static |
Turns on MPI by setting the corresponding EPS channel.
|
static |
Turns on MPI and prepares a LFS file to store MPI data in.
uint8_t MPI_send_command_get_response | ( | const uint8_t * | bytes_to_send, |
const size_t | bytes_to_send_len, | ||
uint8_t * | rx_buffer, | ||
const size_t | rx_buffer_max_size, | ||
uint16_t * | rx_buffer_len ) |
Sends commandcode+params to the MPI as bytes.
bytes_to_send | Buffer containing the telecommand + params (IF ANY) as hex bytes |
bytes_to_send_len | Size of telecommand buffer |
rx_buffer | Buffer to store incoming response from the MPI |
rx_buffer_max_size | The maximum size of the MPI response buffer |
rx_buffer_len | Pointer to variable that will contain the length of the populated MPI response buffer |
uint8_t MPI_validate_command_response | ( | const uint8_t | command_code, |
uint8_t * | rx_buffer, | ||
const uint16_t | rx_buffer_len ) |
The MPI responds to each telecommand with a response code consisting of an echo of the telecommand code byte and a status byte (either 254 or OxFE) for success or error code otherwise.
tx_buffer | MPI telecommand buffer containing bytes sent |
rx_buffer | MPI response buffer containing bytes received |
tx_buffer_size | Size of the MPI response buffer |
|
static |
volatile MPI_rx_mode_t MPI_current_uart_rx_mode = MPI_RX_MODE_NOT_LISTENING_TO_MPI |
Current mode under which the MPI is being operated.
uint32_t MPI_recording_start_uptime_ms |
|
static |
Timeout duration for receive in milliseconds. Same between bytes and at the start.
uint32_t MPI_science_data_bytes_lost = 0 |
uint8_t MPI_science_data_file_is_open = 0 |
lfs_file_t MPI_science_data_file_pointer |
|
static |
Timeout duration for transmit HAL call, in milliseconds.