24 extern osThreadId CommandTaskHandle;
25 extern osThreadId IMUTaskHandle;
26 extern osThreadId PCUARTHandle;
29 static uint8_t robotGoalData[
sizeof(
RobotGoal)];
30 static uint8_t *robotGoalDataPtr;
31 static uint8_t buffRx[92];
32 static uint8_t startSeqCount;
33 static uint8_t totalBytesRead;
35 static HAL_StatusTypeDef status;
36 static uint32_t notification;
68 robotGoalDataPtr = robotGoalData;
83 HAL_UART_Receive_DMA(&huart5, (uint8_t*) buffRx,
sizeof(buffRx));
114 xSemaphoreTake(PCUARTHandle, 1);
115 status = HAL_UART_Receive_DMA(&huart5, (uint8_t*) buffRx,
117 xSemaphoreGive(PCUARTHandle);
118 }
while (status != HAL_OK);
130 for (uint8_t i = 0; i <
sizeof(buffRx); i++) {
131 if (startSeqCount == 4) {
136 *robotGoalDataPtr = buffRx[i];
140 if (totalBytesRead ==
sizeof(
RobotGoal)) {
149 robotGoalDataPtr = robotGoalData;
159 if (buffRx[i] == 0xFF) {
This file defines resources used throughout various parts of the system that engage in non-blocking I...
void waitForNotificationRX(void)
Waits until notified from ISR.
void initializeVars(void)
Initializes the private variables for StartRxTask.
Defines the RobotState data structure used in communication with the high-level software. RobotState is the data structure sent from the MCU to the PC; it contains sensor data.
void initiateDMATransfer(void)
Initiates DMA receive transfer using DMA.
Data structure sent from the PC to the MCU. Contains "goal" motor positions.
void updateStatusToPC(void)
Makes calls to the UART module responsible for PC communication atomic.
Defines the RobotGoal data structure used in communication with the high-level software. RobotGoal is the data structure sent from the PC to the MCU; it contains motor trajectories.
#define NOTIFIED_FROM_RX_ISR
Header for top-level communication module.
void receiveDataBuffer(void)
Reads the received data buffer.
struct robot_goal RobotGoal
Data structure sent from the PC to the MCU. Contains "goal" motor positions.
#define NOTIFIED_FROM_TASK
Header for the helper file used to aid StartRXTask() in freertos.cpp.