fixed compiler errors
This commit is contained in:
@@ -20,6 +20,7 @@ typedef struct {
|
||||
} DMA_QUEUE;
|
||||
|
||||
DMA_QUEUE RxQueue;
|
||||
uint8_t DMA_RX_BUFFER[4];
|
||||
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
TIM_HandleTypeDef htim3;
|
||||
@@ -51,8 +52,6 @@ void DMA_Queue_Init(DMA_QUEUE* q);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||
HAL_Init();
|
||||
|
||||
@@ -77,12 +76,14 @@ int main(void)
|
||||
switch(CURRENT_MODE){
|
||||
|
||||
case MODE_INACTIVE:
|
||||
//TODO: Check if connected VIA USB, If so switch to master mode
|
||||
uint8_t candidates_depth[] = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
//Poll all UART Ports
|
||||
for(uint8_t i = 0; i<4; i++){
|
||||
uint8_t rxBuffer[4] = {0};
|
||||
HAL_UART_Transmit(UART_PORTS[i], MODULE_HANDSHAKE_REQUEST, 4, HAL_MAX_DELAY);
|
||||
uint8_t msg[4] = {0x00, 0x0F, 0x00, 0x00};
|
||||
HAL_UART_Transmit(UART_PORTS[i], msg, 4, HAL_MAX_DELAY);
|
||||
if (HAL_UART_Receive(UART_PORTS[i], rxBuffer, 4, 500) == HAL_OK) {
|
||||
//Is a type of confirmation message
|
||||
if(rxBuffer[1] == 0xFF){
|
||||
@@ -108,13 +109,13 @@ int main(void)
|
||||
}
|
||||
if(best_parent != 0xFF){ // found a valid parent
|
||||
PARENT = UART_PORTS[best_parent]; // assign UART handle pointer
|
||||
DMA_Queue_Init(&RxQueue);
|
||||
CURRENT_MODE = MODE_MODULE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case MODE_MODULE:
|
||||
break;
|
||||
DMA_Queue_Init(&RxQueue);
|
||||
break;
|
||||
|
||||
case MODE_MASTER:
|
||||
|
||||
@@ -130,7 +131,7 @@ void DMA_Queue_Init(DMA_QUEUE* q){
|
||||
q->tail = 0;
|
||||
//Activate DMA to all ports
|
||||
for(uint8_t i = 0; i<4; i++){
|
||||
HAL_UART_Receive_DMA(&UART_PORTS[i], RxQueue.buffer, 4);
|
||||
HAL_UART_Receive_DMA(UART_PORTS[i], DMA_RX_BUFFER, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -35,3 +35,15 @@
|
||||
2 203 1756076952561034859 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
301 688 1756075615559274642 cmake/stm32cubemx/CMakeFiles/STM32_Drivers.dir/__/__/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c.obj 31a0df46be8b277d
|
||||
2 321 1756075615190387655 CMakeFiles/core.dir/USB_DEVICE/Target/usbd_conf.c.obj 950d6fa9d73ae6e0
|
||||
1 102 1756087985387401909 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
102 251 1756087985532933823 core.elf 65fc94ad55c43ddb
|
||||
2 97 1756088025071090437 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
97 183 1756088025153480334 core.elf 65fc94ad55c43ddb
|
||||
1 102 1756088106743426086 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
102 182 1756088106821443344 core.elf 65fc94ad55c43ddb
|
||||
1 101 1756088140959469161 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
101 181 1756088141037133118 core.elf 65fc94ad55c43ddb
|
||||
1 96 1756088174150075991 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
96 175 1756088174226138846 core.elf 65fc94ad55c43ddb
|
||||
1 94 1756088304259279866 CMakeFiles/core.dir/Core/Src/main.c.obj 612a7a44e98bda92
|
||||
94 173 1756088304335458752 core.elf 65fc94ad55c43ddb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user