CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
uart_handler.h File Reference
#include "stm32l4xx_hal.h"
#include <stdint.h>
#include "mpi/mpi_types.h"
Include dependency graph for uart_handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AX100_kiss_frame_struct_t
 

Macros

#define AX100_MAX_KISS_FRAMES_IN_RX_QUEUE   8
 
#define AX100_MAX_KISS_FRAME_SIZE_BYTES   500
 

Enumerations

enum  CAMERA_uart_write_state_enum_t { CAMERA_UART_WRITE_STATE_IDLE , CAMERA_UART_WRITE_STATE_HALF_FILLING , CAMERA_UART_WRITE_STATE_HALF_FILLED_WAITING_FS_WRITE , CAMERA_UART_WRITE_STATE_HALF_WRITTEN_TO_FS }
 

Functions

void UART_init_uart_handlers (void)
 
void GNSS_set_uart_interrupt_state (uint8_t new_enabled)
 Sets the UART interrupt state (enabled/disabled)
 
uint8_t CAMERA_set_expecting_data (uint8_t new_enabled)
 Sets the UART interrupt state (enabled/disabled)
 

Variables

volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_1_state
 
volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_2_state
 
UART_HandleTypeDef * UART_telecommand_port_handle
 
UART_HandleTypeDef * UART_mpi_port_handle
 
UART_HandleTypeDef * UART_ax100_port_handle
 
UART_HandleTypeDef * UART_gnss_port_handle
 
UART_HandleTypeDef * UART_camera_port_handle
 
UART_HandleTypeDef * UART_eps_port_handle
 
const uint16_t UART_telecommand_buffer_len
 
volatile uint8_t UART_telecommand_buffer []
 
volatile uint16_t UART_telecommand_buffer_write_idx
 
volatile uint32_t UART_telecommand_last_write_time_ms
 
const uint16_t UART_mpi_buffer_len
 
volatile uint8_t UART_mpi_buffer []
 
volatile uint16_t UART_mpi_buffer_write_idx
 
volatile uint32_t UART_mpi_last_write_time_ms
 
volatile uint8_t UART_mpi_last_rx_byte
 
volatile uint32_t UART_ax100_last_write_time_ms
 
const uint16_t UART_gnss_buffer_len
 
volatile uint8_t UART_gnss_buffer []
 
volatile uint16_t UART_gnss_buffer_write_idx
 
volatile uint32_t UART_gnss_last_write_time_ms
 
const uint16_t UART_camera_dma_buffer_len
 
const uint16_t UART_camera_dma_buffer_len_half
 
volatile uint8_t UART_camera_dma_buffer []
 
volatile uint8_t UART_camera_pending_fs_write_half_1_buf []
 
volatile uint8_t UART_camera_pending_fs_write_half_2_buf []
 
volatile uint32_t UART_camera_last_write_time_ms
 
const uint16_t UART_eps_buffer_len
 
volatile uint8_t UART_eps_buffer []
 
volatile uint16_t UART_eps_buffer_write_idx
 
volatile uint32_t UART_eps_last_write_time_ms
 
volatile uint8_t UART_eps_is_expecting_data
 
volatile uint8_t UART_gnss_buffer_last_rx_byte
 
volatile uint8_t UART_gnss_uart_interrupt_enabled
 
const uint8_t UART_mpi_rx_dma_buffer_len
 
volatile uint8_t UART_mpi_rx_dma_buffer []
 
const uint16_t MPI_science_buffer_len
 Length of the MPI_science_buffer_one and MPI_science_buffer_two arrays.
 
volatile uint8_t MPI_science_buffer_one []
 
volatile uint8_t MPI_science_buffer_two []
 
volatile MPI_buffer_state_enum_t MPI_buffer_one_state
 Current state of the MPI_active_data_median_buffer (pending write vs. written).
 
volatile MPI_buffer_state_enum_t MPI_buffer_two_state
 
volatile uint32_t MPI_buffer_one_last_filled_uptime_ms
 
volatile uint32_t MPI_buffer_two_last_filled_uptime_ms
 
volatile AX100_kiss_frame_struct_t UART_AX100_kiss_frame_queue [AX100_MAX_KISS_FRAMES_IN_RX_QUEUE]
 
volatile uint8_t UART_AX100_kiss_frame_queue_head
 
volatile uint8_t UART_AX100_kiss_frame_queue_tail
 

Macro Definition Documentation

◆ AX100_MAX_KISS_FRAME_SIZE_BYTES

#define AX100_MAX_KISS_FRAME_SIZE_BYTES   500

◆ AX100_MAX_KISS_FRAMES_IN_RX_QUEUE

#define AX100_MAX_KISS_FRAMES_IN_RX_QUEUE   8

Enumeration Type Documentation

◆ CAMERA_uart_write_state_enum_t

Enumerator
CAMERA_UART_WRITE_STATE_IDLE 
CAMERA_UART_WRITE_STATE_HALF_FILLING 
CAMERA_UART_WRITE_STATE_HALF_FILLED_WAITING_FS_WRITE 
CAMERA_UART_WRITE_STATE_HALF_WRITTEN_TO_FS 

Function Documentation

◆ CAMERA_set_expecting_data()

uint8_t CAMERA_set_expecting_data ( uint8_t new_enabled)

Sets the UART interrupt state (enabled/disabled)

Parameters
new_enabled1: command sent, expecting data; 0: not expecting data
Here is the caller graph for this function:

◆ GNSS_set_uart_interrupt_state()

void GNSS_set_uart_interrupt_state ( uint8_t new_enabled)

Sets the UART interrupt state (enabled/disabled)

Parameters
new_enabled1: enable interrupt; 0: disable interrupt
Note
This function must be called very carefully. This type of GNSS is known to, in the wrong mode, spam null bytes, which can lock up the entire system. Thus, the interrupt is disabled by default, and must be enabled explicitly by the GNSS telecommands.
Here is the caller graph for this function:

◆ UART_init_uart_handlers()

void UART_init_uart_handlers ( void )
Here is the caller graph for this function:

Variable Documentation

◆ CAMERA_uart_half_1_state

volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_1_state
extern

◆ CAMERA_uart_half_2_state

volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_2_state
extern

◆ MPI_buffer_one_last_filled_uptime_ms

volatile uint32_t MPI_buffer_one_last_filled_uptime_ms
extern

◆ MPI_buffer_one_state

volatile MPI_buffer_state_enum_t MPI_buffer_one_state
extern

Current state of the MPI_active_data_median_buffer (pending write vs. written).

◆ MPI_buffer_two_last_filled_uptime_ms

volatile uint32_t MPI_buffer_two_last_filled_uptime_ms
extern

◆ MPI_buffer_two_state

volatile MPI_buffer_state_enum_t MPI_buffer_two_state
extern

◆ MPI_science_buffer_len

const uint16_t MPI_science_buffer_len
extern

Length of the MPI_science_buffer_one and MPI_science_buffer_two arrays.

◆ MPI_science_buffer_one

volatile uint8_t MPI_science_buffer_one[]
extern

◆ MPI_science_buffer_two

volatile uint8_t MPI_science_buffer_two[]
extern

◆ UART_AX100_kiss_frame_queue

volatile AX100_kiss_frame_struct_t UART_AX100_kiss_frame_queue[AX100_MAX_KISS_FRAMES_IN_RX_QUEUE]
extern

◆ UART_AX100_kiss_frame_queue_head

volatile uint8_t UART_AX100_kiss_frame_queue_head
extern

◆ UART_AX100_kiss_frame_queue_tail

volatile uint8_t UART_AX100_kiss_frame_queue_tail
extern

◆ UART_ax100_last_write_time_ms

volatile uint32_t UART_ax100_last_write_time_ms
extern

◆ UART_ax100_port_handle

UART_HandleTypeDef* UART_ax100_port_handle
extern

◆ UART_camera_dma_buffer

volatile uint8_t UART_camera_dma_buffer[]
extern

◆ UART_camera_dma_buffer_len

const uint16_t UART_camera_dma_buffer_len
extern

◆ UART_camera_dma_buffer_len_half

const uint16_t UART_camera_dma_buffer_len_half
extern

◆ UART_camera_last_write_time_ms

volatile uint32_t UART_camera_last_write_time_ms
extern

◆ UART_camera_pending_fs_write_half_1_buf

volatile uint8_t UART_camera_pending_fs_write_half_1_buf[]
extern

◆ UART_camera_pending_fs_write_half_2_buf

volatile uint8_t UART_camera_pending_fs_write_half_2_buf[]
extern

◆ UART_camera_port_handle

UART_HandleTypeDef* UART_camera_port_handle
extern

◆ UART_eps_buffer

volatile uint8_t UART_eps_buffer[]
extern

◆ UART_eps_buffer_len

const uint16_t UART_eps_buffer_len
extern

◆ UART_eps_buffer_write_idx

volatile uint16_t UART_eps_buffer_write_idx
extern

◆ UART_eps_is_expecting_data

volatile uint8_t UART_eps_is_expecting_data
extern

◆ UART_eps_last_write_time_ms

volatile uint32_t UART_eps_last_write_time_ms
extern

◆ UART_eps_port_handle

UART_HandleTypeDef* UART_eps_port_handle
extern

◆ UART_gnss_buffer

volatile uint8_t UART_gnss_buffer
extern

◆ UART_gnss_buffer_last_rx_byte

volatile uint8_t UART_gnss_buffer_last_rx_byte
extern

◆ UART_gnss_buffer_len

const uint16_t UART_gnss_buffer_len
extern

◆ UART_gnss_buffer_write_idx

volatile uint16_t UART_gnss_buffer_write_idx
extern

◆ UART_gnss_last_write_time_ms

volatile uint32_t UART_gnss_last_write_time_ms
extern

◆ UART_gnss_port_handle

UART_HandleTypeDef* UART_gnss_port_handle
extern

◆ UART_gnss_uart_interrupt_enabled

volatile uint8_t UART_gnss_uart_interrupt_enabled
extern

◆ UART_mpi_buffer

volatile uint8_t UART_mpi_buffer[]
extern

◆ UART_mpi_buffer_len

const uint16_t UART_mpi_buffer_len
extern

◆ UART_mpi_buffer_write_idx

volatile uint16_t UART_mpi_buffer_write_idx
extern

◆ UART_mpi_last_rx_byte

volatile uint8_t UART_mpi_last_rx_byte
extern

◆ UART_mpi_last_write_time_ms

volatile uint32_t UART_mpi_last_write_time_ms
extern

◆ UART_mpi_port_handle

UART_HandleTypeDef* UART_mpi_port_handle
extern

◆ UART_mpi_rx_dma_buffer

volatile uint8_t UART_mpi_rx_dma_buffer[]
extern

◆ UART_mpi_rx_dma_buffer_len

const uint8_t UART_mpi_rx_dma_buffer_len
extern

◆ UART_telecommand_buffer

volatile uint8_t UART_telecommand_buffer[]
extern

◆ UART_telecommand_buffer_len

const uint16_t UART_telecommand_buffer_len
extern

◆ UART_telecommand_buffer_write_idx

volatile uint16_t UART_telecommand_buffer_write_idx
extern

◆ UART_telecommand_last_write_time_ms

volatile uint32_t UART_telecommand_last_write_time_ms
extern

◆ UART_telecommand_port_handle

UART_HandleTypeDef* UART_telecommand_port_handle
extern