|
CTS-SAT-1-OBC-Firmware
|
#include "uart_handler/uart_handler.h"#include "debug_tools/debug_uart.h"#include "mpi/mpi_command_handling.h"#include "uart_handler/uart_error_tracking.h"#include "camera/camera_capture.h"#include "log/log.h"#include "mpi/mpi_transceiver.h"#include "main.h"#include <string.h>
Macros | |
| #define | KISS_FEND 0xC0 |
| #define | KISS_FESC 0xDB |
| #define | KISS_TFEND 0xDC |
| #define | KISS_TFESC 0xDD |
Functions | |
| static uint8_t | kiss_queue_is_full (void) |
| static void | kiss_enqueue_frame (const volatile uint8_t *data, uint16_t len) |
| void | HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart) |
| void | HAL_UART_RxHalfCpltCallback (UART_HandleTypeDef *huart) |
| 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) | |
| void | HAL_UART_ErrorCallback (UART_HandleTypeDef *huart) |
| void | UART_init_uart_handlers (void) |
| #define KISS_FEND 0xC0 |
| #define KISS_FESC 0xDB |
| #define KISS_TFEND 0xDC |
| #define KISS_TFESC 0xDD |
| uint8_t CAMERA_set_expecting_data | ( | uint8_t | new_enabled | ) |
Sets the UART interrupt state (enabled/disabled)
| new_enabled | 1: command sent, expecting data; 0: not expecting data |

| void GNSS_set_uart_interrupt_state | ( | uint8_t | new_enabled | ) |
Sets the UART interrupt state (enabled/disabled)
| new_enabled | 1: enable interrupt; 0: disable interrupt |

| void HAL_UART_ErrorCallback | ( | UART_HandleTypeDef * | huart | ) |

| void HAL_UART_RxCpltCallback | ( | UART_HandleTypeDef * | huart | ) |

| void HAL_UART_RxHalfCpltCallback | ( | UART_HandleTypeDef * | huart | ) |

|
inlinestatic |


|
inlinestatic |

| void UART_init_uart_handlers | ( | void | ) |

| volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_1_state = CAMERA_UART_WRITE_STATE_IDLE |
| volatile CAMERA_uart_write_state_enum_t CAMERA_uart_half_2_state = CAMERA_UART_WRITE_STATE_IDLE |
|
static |
Temporary buffer to hold the decoded contents of the current KISS frame. Reset when a frame is completed or an error occurs (e.g. overflow or bad escape).
|
static |
Current write index into kiss_decode_buf, tracking how many decoded bytes have been accumulated in the current frame.
|
static |
Indicates whether the previous byte was KISS_FESC, meaning the next byte should be interpreted as an escaped control character (TFEND or TFESC).
|
static |
Indicates whether we are currently inside a KISS frame. Set to 1 after receiving KISS_FEND, and reset on frame completion or error.
| volatile uint32_t MPI_buffer_one_last_filled_uptime_ms = 0 |
| volatile MPI_buffer_state_enum_t MPI_buffer_one_state = MPI_MEMORY_WRITE_STATUS_READY_TO_FILL |
Current state of the MPI_active_data_median_buffer (pending write vs. written).
| volatile uint32_t MPI_buffer_two_last_filled_uptime_ms = 0 |
| volatile MPI_buffer_state_enum_t MPI_buffer_two_state = MPI_MEMORY_WRITE_STATUS_READY_TO_FILL |
| const uint16_t MPI_science_buffer_len = 20480 |
Length of the MPI_science_buffer_one and MPI_science_buffer_two arrays.
| volatile uint8_t MPI_science_buffer_one[20480] |
| volatile uint8_t MPI_science_buffer_two[20480] |
| volatile uint8_t UART_ax100_buffer_last_rx_byte = 0 |
| volatile uint16_t UART_ax100_buffer_write_idx = 0 |
| 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 = 0 |
| volatile uint8_t UART_AX100_kiss_frame_queue_tail = 0 |
| volatile uint32_t UART_ax100_last_write_time_ms = 0 |
| UART_HandleTypeDef* UART_ax100_port_handle = &huart2 |
| volatile uint8_t UART_camera_dma_buffer[CAM_BYTES_TO_RECEIVE_PER_HALF_CALLBACK *2] |
| const uint16_t UART_camera_dma_buffer_len = CAM_BYTES_TO_RECEIVE_PER_HALF_CALLBACK*2 |
| const uint16_t UART_camera_dma_buffer_len_half = CAM_BYTES_TO_RECEIVE_PER_HALF_CALLBACK |
| volatile uint32_t UART_camera_last_write_time_ms = 0 |
| volatile uint8_t UART_camera_pending_fs_write_half_1_buf[CAM_BYTES_TO_RECEIVE_PER_HALF_CALLBACK] |
| volatile uint8_t UART_camera_pending_fs_write_half_2_buf[CAM_BYTES_TO_RECEIVE_PER_HALF_CALLBACK] |
| UART_HandleTypeDef* UART_camera_port_handle = &huart4 |
| volatile uint8_t UART_eps_buffer[310] |
| volatile uint8_t UART_eps_buffer_last_rx_byte = 0 |
| const uint16_t UART_eps_buffer_len = 310 |
| volatile uint16_t UART_eps_buffer_write_idx = 0 |
| volatile uint8_t UART_eps_is_expecting_data = 0 |
| volatile uint32_t UART_eps_last_write_time_ms = 0 |
| UART_HandleTypeDef* UART_eps_port_handle = &huart5 |
| volatile uint8_t UART_gnss_buffer[512] |
| volatile uint8_t UART_gnss_buffer_last_rx_byte = 0 |
| const uint16_t UART_gnss_buffer_len = 512 |
| volatile uint16_t UART_gnss_buffer_write_idx = 0 |
| volatile uint32_t UART_gnss_last_write_time_ms = 0 |
| UART_HandleTypeDef* UART_gnss_port_handle = &huart3 |
| volatile uint8_t UART_gnss_uart_interrupt_enabled = 0 |
| volatile uint8_t UART_mpi_buffer[256] |
| const uint16_t UART_mpi_buffer_len = 256 |
| volatile uint16_t UART_mpi_buffer_write_idx = 0 |
| volatile uint8_t UART_mpi_last_rx_byte = 0 |
| volatile uint32_t UART_mpi_last_write_time_ms = 0 |
| UART_HandleTypeDef* UART_mpi_port_handle = &huart1 |
| volatile uint8_t UART_mpi_rx_buffer[50] |
| const uint16_t UART_mpi_rx_buffer_len = 50 |
| volatile uint16_t UART_mpi_rx_buffer_write_idx = 0 |
| volatile uint8_t UART_mpi_rx_dma_buffer[160] |
| const uint8_t UART_mpi_rx_dma_buffer_len = 160 |
| volatile uint8_t UART_mpi_rx_last_byte = 0 |
| volatile uint32_t UART_mpi_rx_last_byte_write_time_ms = 0 |
| volatile uint16_t UART_MPI_science_buffer_index = 0 |
Index into a virtual array that is MPI_science_buffer_one and MPI_science_buffer_two concatenated.
| volatile uint8_t UART_telecommand_buffer[256] |
| volatile uint8_t UART_telecommand_buffer_last_rx_byte = 0 |
| const uint16_t UART_telecommand_buffer_len = 256 |
| volatile uint16_t UART_telecommand_buffer_write_idx = 0 |
| volatile uint32_t UART_telecommand_last_write_time_ms = 0 |
| UART_HandleTypeDef* UART_telecommand_port_handle = &hlpuart1 |