2022-09-29-Snippet8

do { bool TransferAccepted = SERCOM4_SPI_WriteRead(&TxBuffer[Device][0], TxSize, &RxBuffer[Device][0], RxSize); RetryCount++; if((RetryCount == RETRY_COUNT_MAX) && (TransferAccepted == false)) { Fault_Set(SPI_TRANSFER_FAILED); } }while((TransferAccepted == false) && (RetryCount < RETRY_COUNT_MAX));

2022-09-29-Snippet7

do { // Add some stuff to do RetryCount++; if(RetryCount == RETRY_COUNT_MAX) { // Set fault or warning to notify application } }while((TransferAccepted == false) && (RetryCount < RETRY_COUNT_MAX));

2022-09-29-Snippet6

do { bool TransferAccepted = SERCOM4_SPI_WriteRead(&TxBuffer[Device][0], TxSize, &RxBuffer[Device][0], RxSize); }while(TransferAccepted == false);

2022-09-29-Snippet5

bool TransferAccepted = false; while(TransferAccepted == false) { TransferAccepted = SERCOM4_SPI_WriteRead(&TxBuffer[Device][0], TxSize, &RxBuffer[Device][0], RxSize); }

2022-09-29-Snippet2

TransferAccepted = false; // Send and receive the data while(TransferAccepted != true) { TransferAccepted = SERCOM4_SPI_WriteRead(&TxBuffer[Device][0], TxSize, &RxBuffer[Device][0], RxSize); }

2022-09-29-Snippet1

static void GCLK2_Initialize(void) { GCLK_REGS->GCLK_GENCTRL[2] = GCLK_GENCTRL_DIV(48U) | GCLK_GENCTRL_SRC(6U) | GCLK_GENCTRL_GENEN_Msk; while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL_GCLK2) == GCLK_SYNCBUSY_GENCTRL_GCLK2) { /* wait for the Generator 2 synchronization */ } }

2022-09-15-Snippet6

void Task_Sensors(ULONG ThreadInput) { // SECTION 1: Initialization (void) ThreadInput; bool isRunning = true; SensorData_t SensorRawData; SensorData_t SensorData; SensorData_t pSensorDataTx = &SensorData; Sensor_Init(); // SECTION 2: Tasks main function / … Continue reading 2022-09-15-Snippet6

2022-09-15-Snippet5

void Task_Sensors(ULONG ThreadInput) { // SECTION 1: Initialization (void) ThreadInput; Task_SensorInit(); // SECTION 2: Tasks main function / behavior / purpose while(true) { Task_SensorRun(); tx_thread_sleep(TASK_SENSORS_PERIOD_MS); } // SECTION 3: TasK … Continue reading 2022-09-15-Snippet5