comparison 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
comparison
equal deleted inserted replaced
62:7c9fbd31cd02 63:cd298de33783
71 uint8_t SPI3_ButtonAdjust(uint8_t *arrayInput, uint8_t *arrayOutput) 71 uint8_t SPI3_ButtonAdjust(uint8_t *arrayInput, uint8_t *arrayOutput)
72 { 72 {
73 HAL_StatusTypeDef status; 73 HAL_StatusTypeDef status;
74 uint8_t answer[10]; 74 uint8_t answer[10];
75 uint8_t rework[10]; 75 uint8_t rework[10];
76 uint8_t wait = 0;
77 76
78 rework[0] = 0xFF; 77 rework[0] = 0xFF;
79 for(int i = 0; i < 3; i++) 78 for(int i = 0; i < 3; i++)
80 { 79 {
81 // limiter 80 // limiter
107 106
108 status = HAL_OK; /* = 0 */ 107 status = HAL_OK; /* = 0 */
109 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET); 108 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET);
110 for(int i=0;i<7;i++) 109 for(int i=0;i<7;i++)
111 { 110 {
112 for(int iiii = 0; iiii < 400; iiii++) 111 HAL_Delay(10);
113 wait++;
114 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_RESET); 112 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_RESET);
115 for(int iiii = 0; iiii < 400; iiii++) 113 HAL_Delay(10);
116 wait++;
117 status += HAL_SPI_TransmitReceive(&hspi3, &rework[i], &answer[i], 1,20); 114 status += HAL_SPI_TransmitReceive(&hspi3, &rework[i], &answer[i], 1,20);
118 for(int iiii = 0; iiii < 400; iiii++) 115 HAL_Delay(10);
119 wait++;
120 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET); 116 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET);
121 } 117 }
122 118
123 if(status == HAL_OK) 119 if(status == HAL_OK)
124 { 120 {