This commit is contained in:
2022-01-30 20:53:49 +03:00
parent ec4cfbaa05
commit c92b94dc52

View File

@@ -145,7 +145,7 @@ int main(void)
mutex = xSemaphoreCreateMutex();
vSemaphoreCreateBinary(semaphoreBin);
/* Start scheduler */
osKernelStart();
//osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
@@ -156,24 +156,24 @@ int main(void)
{
flag_cs = 1;
CS1_ON();
HAL_SPI_Transmit_DMA(&hspi1, data_in, sizeof(data_in));
while(!flag_receive) {
int res = HAL_SPI_TransmitReceive_DMA(&hspi1, (uint8_t*) (data_in), (uint8_t *) (data_out), sizeof(data_in) / sizeof(data_in[0]));
while(!flag_receive && res == 0) {
HAL_Delay(1);
}
CS1_OFF();
flag_receive = 0;
flag_cs = 2;
CS2_ON();
HAL_SPI_Transmit_DMA(&hspi1, data_in, sizeof(data_in));
while(!flag_receive) {
res = HAL_SPI_TransmitReceive_DMA(&hspi1, (uint8_t*) (data_in), (uint8_t *) (data_out), sizeof(data_in) / sizeof(data_in[0]));
while(!flag_receive && res == 0) {
HAL_Delay(1);
}
CS2_OFF();
flag_receive = 0;
flag_cs = 3;
CS3_ON();
HAL_SPI_Transmit_DMA(&hspi1, data_in, sizeof(data_in));
while(!flag_receive) {
res = HAL_SPI_TransmitReceive_DMA(&hspi1, (uint8_t*) (data_in), (uint8_t *) (data_out), sizeof(data_in) / sizeof(data_in[0]));
while(!flag_receive && res == 0) {
HAL_Delay(1);
}
flag_receive = 0;
@@ -363,7 +363,7 @@ void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{
if(hspi == &hspi1)
{
HAL_SPI_Receive_DMA(&hspi1, data_out, sizeof(data_out));
//HAL_SPI_Receive_DMA(&hspi1, data_out, sizeof(data_out));
flag_receive = 1;
static portBASE_TYPE xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;