mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-07 00:53:41 +08:00
removed the first generation crc error handling
This commit is contained in:
@@ -4,14 +4,6 @@
|
||||
#include <stm32/spi.h>
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
/*
|
||||
*
|
||||
* This is the version that got less tested
|
||||
*
|
||||
*/
|
||||
|
||||
#define OveroLinkEvent(_data_received_handler, _crc_failed_handler) { \
|
||||
if (overo_link.status == DATA_AVAILABLE) { /* set by DMA interrupt */ \
|
||||
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)==RESET); \
|
||||
@@ -47,45 +39,6 @@
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
*
|
||||
* This is the version that works
|
||||
*
|
||||
*/
|
||||
|
||||
#define OveroLinkEvent(_data_received_handler, _crc_failed_handler) { \
|
||||
if (overo_link.status == DATA_AVAILABLE) { \
|
||||
overo_link.timeout = 0; \
|
||||
/* FIXME : we should probably add a limit here and do something */ \
|
||||
/* radical in case we exceed it */ \
|
||||
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)==RESET); \
|
||||
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY)==SET); \
|
||||
uint8_t foo __attribute__ ((unused)) = SPI_I2S_ReceiveData(SPI1); \
|
||||
if((SPI_I2S_GetFlagStatus(SPI1, SPI_FLAG_CRCERR)) == RESET) { \
|
||||
LED_TOGGLE(OVERO_LINK_LED_OK); \
|
||||
LED_OFF(OVERO_LINK_LED_KO); \
|
||||
_data_received_handler(); \
|
||||
} \
|
||||
else { \
|
||||
LED_OFF(OVERO_LINK_LED_OK); \
|
||||
LED_ON(OVERO_LINK_LED_KO); \
|
||||
overo_link.crc_err_cnt++; \
|
||||
_crc_failed_handler(); \
|
||||
/* wait until we're not selected - same thing, we would */ \
|
||||
/* probably want a limit here */ \
|
||||
while (!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_4)); \
|
||||
uint8_t foo2 __attribute__ ((unused)) = SPI_I2S_ReceiveData(SPI1); \
|
||||
violently_reset_spi(); \
|
||||
} \
|
||||
overo_link.msg_cnt++; \
|
||||
overo_link_arch_prepare_next_transfert(); \
|
||||
overo_link.status = IDLE; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define violently_reset_spi() { \
|
||||
SPI_Cmd(SPI1, DISABLE); \
|
||||
|
||||
Reference in New Issue
Block a user