Mercurial > public > ostc4
changeset 63:cd298de33783
Replaced wait loop with delay fct
author | Ideenmodellierer |
---|---|
date | Mon, 13 Aug 2018 19:11:14 +0200 |
parents | 7c9fbd31cd02 |
children | 98b479d0618f |
files | Small_CPU/Src/spi.c |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
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); }