comparison Small_CPU/Src/spi.c @ 278:cc30d1aa03a7

Merged in Ideenmodellierer/ostc4/IPC_Sync_Improvment_3 (pull request #21) IPC Sync Improvment 3
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Sun, 28 Apr 2019 15:54:46 +0000
parents 580822b5d3d1
children 2fc08a0d1ec3
comparison
equal deleted inserted replaced
274:2f0eb65df557 278:cc30d1aa03a7
356 if(global.dataSendToSlave.header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_SHIFTED) 356 if(global.dataSendToSlave.header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_SHIFTED)
357 { 357 {
358 HAL_SPI_Abort_IT(&hspi1); 358 HAL_SPI_Abort_IT(&hspi1);
359 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); 359 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD);
360 } 360 }
361 else 361 else
362 { 362 {
363 } 363 }
364 SPI_Start_single_TxRx_with_Master();
364 } 365 }
365 else 366 else
366 { 367 {
367 // GPIO_new_DEBUG_LOW(); //For debug. 368 // GPIO_new_DEBUG_LOW(); //For debug.
368 global.dataSendToSlaveIsValid = 0; 369 global.dataSendToSlaveIsValid = 0;
384 else /* handle received data as if no data would have been received */ 385 else /* handle received data as if no data would have been received */
385 { 386 {
386 global.dataSendToMaster.header.checkCode[SPI_HEADER_INDEX_RX_STATE] = SPI_RX_STATE_OFFLINE; 387 global.dataSendToMaster.header.checkCode[SPI_HEADER_INDEX_RX_STATE] = SPI_RX_STATE_OFFLINE;
387 resettimeout = 0; 388 resettimeout = 0;
388 } 389 }
390 HAL_SPI_TransmitReceive_DMA(&hspi1,(uint8_t*) &(global.dataSendToMaster),(uint8_t*) &(global.dataSendToSlave), EXCHANGE_BUFFERSIZE);
389 } 391 }
390 392
391 global.dataSendToMaster.power_on_reset = 0; 393 global.dataSendToMaster.power_on_reset = 0;
392 global.deviceDataSendToMaster.power_on_reset = 0; 394 global.deviceDataSendToMaster.power_on_reset = 0;
393 395
394 scheduleSpecial_Evaluate_DataSendToSlave(); 396 scheduleSpecial_Evaluate_DataSendToSlave();
395
396 SPI_Start_single_TxRx_with_Master();
397 397
398 if(resettimeout) 398 if(resettimeout)
399 { 399 {
400 global.check_sync_not_running = 0; 400 global.check_sync_not_running = 0;
401 } 401 }