19.8.3.3.2 Workflow

  1. Select slave.
    spi_select_slave(&spi_master_instance, &slave, true);
    
  2. Write buffer to SPI slave.
    spi_transceive_buffer_job(&spi_master_instance, wr_buffer,rd_buffer,BUF_LENGTH);
    
  3. Wait for the transfer to be complete.
    while (!transrev_complete_spi_master) {
    }
    transrev_complete_spi_master = false;
    
  4. Deselect slave.
    spi_select_slave(&spi_master_instance, &slave, false);
    
  5. Infinite loop.
    while (true) {
        /* Infinite loop */
        if (!port_pin_get_input_level(BUTTON_0_PIN)) {
            spi_select_slave(&spi_master_instance, &slave, true);
            spi_transceive_buffer_job(&spi_master_instance, wr_buffer,rd_buffer,BUF_LENGTH);
            while (!transrev_complete_spi_master) {
            }
            transrev_complete_spi_master = false;
            spi_select_slave(&spi_master_instance, &slave, false);
        }
    }