comparison Discovery/Src/data_exchange_main.c @ 154:1ac5033f7c7a FlipDisplay

Keep NSS low during SPI transfer only
author Ideenmodellierer
date Sun, 03 Mar 2019 17:45:39 +0100
parents e1d66bc78f9a
children 1fbdb45db701
comparison
equal deleted inserted replaced
153:791cdfad0c8e 154:1ac5033f7c7a
297 297
298 uint8_t DataEX_call(void) 298 uint8_t DataEX_call(void)
299 { 299 {
300 uint8_t SPI_DMA_answer = 0; 300 uint8_t SPI_DMA_answer = 0;
301 301
302 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
303 delayMicros(10); //~exchange time(+20% reserve)
304 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); 302 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
305 303
306 if(data_old__lost_connection_to_slave_counter_temp >= 3) 304 if(data_old__lost_connection_to_slave_counter_temp >= 3)
307 { 305 {
308 data_old__lost_connection_to_slave_counter_temp = 0; 306 data_old__lost_connection_to_slave_counter_temp = 0;
353 } 351 }
354 352
355 353
356 void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) 354 void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
357 { 355 {
358
359
360 if(hspi == &cpu2DmaSpi) 356 if(hspi == &cpu2DmaSpi)
361 { 357 {
358 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
362 SPI_CALLBACKS+=1; 359 SPI_CALLBACKS+=1;
363 } 360 }
364 } 361 }
365 362
366 363