19.8.4.2.2 Workflow

  1. Initiate a read buffer job.
    spi_read_buffer_job(&spi_slave_instance, buffer_rx, BUF_LENGTH, 0x00);
    
  2. Wait for the transfer to be complete.
    while(!transfer_complete_spi_slave) {
        /* Wait for transfer from master */
    }
    
  3. Compare the received data with the transmitted data from SPI master.
    for (uint8_t i = 0; i < BUF_LENGTH; i++) {
        if(buffer_rx[i] != buffer_expect[i]) {
            result++;
        }
    }
    
  4. Infinite loop. If the data is matched, LED0 will flash slowly. Otherwise, LED will flash quickly.
    while (true) {
        /* Infinite loop */
        if (result) {
            port_pin_toggle_output_level(LED_0_PIN);
            /* Add a short delay to see LED toggle */
            volatile uint32_t delay = 30000;
            while(delay--) {
            }
        } else {
            port_pin_toggle_output_level(LED_0_PIN);
            /* Add a short delay to see LED toggle */
            volatile uint32_t delay = 600000;
            while(delay--) {
            }
        }
    }