Mercurial > public > ostc4
comparison Discovery/Src/data_exchange_main.c @ 149:e1d66bc78f9a FlipDisplay
Eliminate warnings
author | Ideenmodellierer |
---|---|
date | Sat, 02 Mar 2019 17:42:06 +0100 |
parents | 30d855ea60d8 |
children | 1ac5033f7c7a |
comparison
equal
deleted
inserted
replaced
148:ee744c7160ce | 149:e1d66bc78f9a |
---|---|
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); | 302 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); |
303 delayMicros(10); //~exchange time(+20% reserve) | 303 delayMicros(10); //~exchange time(+20% reserve) |
304 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); | 304 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); |
305 /* one cycle with NotChipSelect true to clear slave spi buffer */ | |
306 | |
307 | 305 |
308 if(data_old__lost_connection_to_slave_counter_temp >= 3) | 306 if(data_old__lost_connection_to_slave_counter_temp >= 3) |
309 { | 307 { |
310 data_old__lost_connection_to_slave_counter_temp = 0; | 308 data_old__lost_connection_to_slave_counter_temp = 0; |
311 if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry == 0)) | 309 if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry == 0)) |
312 { | 310 { |
313 HAL_SPI_Abort_IT(&cpu2DmaSpi); | 311 HAL_SPI_Abort_IT(&cpu2DmaSpi); |
314 } | 312 } |
315 | |
316 /* reset of own DMA does not work ==> request reset of slave dma */ | 313 /* reset of own DMA does not work ==> request reset of slave dma */ |
317 if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry >= 2)) | 314 if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry == 2)) |
318 { | 315 { |
319 dataOut.header.checkCode[SPI_HEADER_INDEX_SLAVE] = 0xA5; | 316 dataOut.header.checkCode[SPI_HEADER_INDEX_SLAVE] = 0xA5; |
320 } | 317 } |
321 data_old__lost_connection_to_slave_counter_retry++; | 318 data_old__lost_connection_to_slave_counter_retry++; |
322 } | 319 } |
320 #if USE_OLD_SYNC_METHOD | |
321 /* one cycle with NotChipSelect true to clear slave spi buffer */ | |
322 else | |
323 { | |
324 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); | |
325 } | |
326 #endif | |
323 | 327 |
324 DataEx_call_helper_requests(); | 328 DataEx_call_helper_requests(); |
325 | 329 |
326 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */ | 330 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */ |
327 | 331 |
328 | 332 |
329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE); | 333 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE); |
330 // HAL_Delay(3); | |
331 if(SPI_DMA_answer != HAL_OK) | 334 if(SPI_DMA_answer != HAL_OK) |
335 { | |
332 DataEX_Error_Handler(SPI_DMA_answer); | 336 DataEX_Error_Handler(SPI_DMA_answer); |
333 | 337 } |
334 // HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); | 338 // HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); |
335 //HAL_Delay(3); | 339 //HAL_Delay(3); |
336 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */ | 340 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */ |
337 | 341 |
338 return 1; | 342 return 1; |
849 requestNecessary.uw = 0; // clear all | 853 requestNecessary.uw = 0; // clear all |
850 | 854 |
851 float ambient, surface, density, meter; | 855 float ambient, surface, density, meter; |
852 SSettings *pSettings; | 856 SSettings *pSettings; |
853 | 857 |
858 ambient = 0; | |
859 surface = 0; | |
860 meter = 0; | |
861 | |
854 /* uint8_t IAmStolenPleaseKillMe; | 862 /* uint8_t IAmStolenPleaseKillMe; |
855 */ | 863 */ |
856 pSettings = settingsGetPointer(); | 864 pSettings = settingsGetPointer(); |
857 | 865 |
858 if(pSettings->IAmStolenPleaseKillMe > 3) | 866 if(pSettings->IAmStolenPleaseKillMe > 3) |