comparison Discovery/Src/data_exchange_main.c @ 82:a6f0881074a4 kittz

+i2c analog noise filtering spi more stable
author Dmitry Romanov <kitt@bk.ru>
date Tue, 20 Nov 2018 12:08:19 +0300
parents 8f8ea3a32e82
children e746bf846638
comparison
equal deleted inserted replaced
80:cc2bb7bb8456 82:a6f0881074a4
325 systick_last = HAL_GetTick(); 325 systick_last = HAL_GetTick();
326 326
327 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */ 327 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */
328 328
329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1); 329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1);
330 HAL_Delay(3);
330 if(SPI_DMA_answer != HAL_OK) 331 if(SPI_DMA_answer != HAL_OK)
331 DataEX_Error_Handler(SPI_DMA_answer); 332 DataEX_Error_Handler(SPI_DMA_answer);
332 //HAL_Delay(3); 333 //HAL_Delay(3);
333 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */ 334 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */
334 335
335 return 1; 336 return 1;
336 } 337 }
338
339
340 uint32_t SPI_CALLBACKS;
341 uint32_t get_num_SPI_CALLBACKS(void){
342 return SPI_CALLBACKS;
343 }
344
345 SDataExchangeSlaveToMaster* get_dataInPointer(void){
346 return &dataIn;
347 }
348
349
350 void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
351 {
352
353
354 if(hspi == &cpu2DmaSpi)
355 {
356 SPI_CALLBACKS+=1;
357 }
358 }
359
360
361
362
337 363
338 void DateEx_copy_to_dataOut(void) 364 void DateEx_copy_to_dataOut(void)
339 { 365 {
340 const SDiveState * pStateReal = stateRealGetPointer(); 366 const SDiveState * pStateReal = stateRealGetPointer();
341 SSettings *settings = settingsGetPointer(); 367 SSettings *settings = settingsGetPointer();