Mercurial > public > ostc4
diff Small_CPU/Src/spi.c @ 63:cd298de33783
Replaced wait loop with delay fct
author | Ideenmodellierer |
---|---|
date | Mon, 13 Aug 2018 19:11:14 +0200 |
parents | 5f11787b4f42 |
children | a6f0881074a4 |
line wrap: on
line diff
--- 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); }