# HG changeset patch # User Ideenmodellierer # Date 1534180274 -7200 # Node ID cd298de33783249067c5702c271cffa1d7fb91cf # Parent 7c9fbd31cd023995849edea377c4ddcbbcb5323e Replaced wait loop with delay fct diff -r 7c9fbd31cd02 -r cd298de33783 Small_CPU/Src/spi.c --- a/Small_CPU/Src/spi.c Sun Aug 12 23:02:13 2018 +0200 +++ b/Small_CPU/Src/spi.c Mon Aug 13 19:11:14 2018 +0200 @@ -73,7 +73,6 @@ HAL_StatusTypeDef status; uint8_t answer[10]; uint8_t rework[10]; - uint8_t wait = 0; rework[0] = 0xFF; for(int i = 0; i < 3; i++) @@ -109,14 +108,11 @@ HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET); for(int i=0;i<7;i++) { - for(int iiii = 0; iiii < 400; iiii++) - wait++; + HAL_Delay(10); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_RESET); - for(int iiii = 0; iiii < 400; iiii++) - wait++; + HAL_Delay(10); status += HAL_SPI_TransmitReceive(&hspi3, &rework[i], &answer[i], 1,20); - for(int iiii = 0; iiii < 400; iiii++) - wait++; + HAL_Delay(10); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET); }