20 extern osThreadId PCUARTHandle;
29 static HAL_StatusTypeDef status;
30 static uint32_t notification;
31 static uint32_t dataReadyFlags = 0;
33 static uint32_t NOTIFICATION_MASK = 0x80000000;
60 for (uint8_t i = 1; i <= 12; i++) {
61 NOTIFICATION_MASK |= (1 << i);
73 while ((dataReadyFlags & NOTIFICATION_MASK) != NOTIFICATION_MASK) {
74 while (xQueueReceive(
TXQueueHandle, &receivedData, portMAX_DELAY) != pdTRUE);
80 if (motorPtr == NULL) {
91 dataReadyFlags |= (1 << motorPtr->
_ID);
97 if(imuPtr == NULL){
break; }
103 dataReadyFlags |= 0x80000000;
125 xSemaphoreTake(PCUARTHandle, 1);
126 status = HAL_UART_Transmit_DMA(&huart5, (uint8_t*) &
robotState,
128 xSemaphoreGive(PCUARTHandle);
129 }
while (status != HAL_OK);
This file defines resources used throughout various parts of the system that engage in non-blocking I...
#define ROBOT_STATE_MPU_DATA_OFFSET
Organizes all the information relevant to a motor.
This is the data structure copied into the sensor queue, and read by the thread that sends data to th...
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.
osMessageQId TXQueueHandle
Header for the helper file used to aid StartTxTask() in freertos.cpp.
The data structure which represents the data of the IMU, which is sent in queues between tasks...
void shiftNotificationMask(void)
Shifts bits of NOTIFICATION_MASK.
void transmitStatusFromPC(void)
Makes calls to the UART module responsible for PC communication atomic.
#define NUM_MOTORS
Used to determine buffer sizes. Also used in application-level code.
Data structure sent from the MCU to the PC. Contains sensor data.
#define NOTIFIED_FROM_TX_ISR
Header for top-level communication module.
void copySensorDataToSend(void)
Validates and copies sensor data to transmit.
Header file for the UART event processor, which is called whenever there are commands that need to be...
Header code for the MPU6050 class.
void waitForNotificationTX(void)
Waits until notified from ISR.
Common header code for the AX12A library and MX28 library. It is generic in that any Dynamixel actuat...