19.8.3.3.2 Workflow
- Select slave.
spi_select_slave(&spi_master_instance, &slave,
true
);
- Write buffer to SPI slave.
spi_transceive_buffer_job(&spi_master_instance, wr_buffer,rd_buffer,BUF_LENGTH);
- Wait for the transfer to be complete.
while
(!transrev_complete_spi_master) {
}
transrev_complete_spi_master =
false
;
- Deselect slave.
spi_select_slave(&spi_master_instance, &slave,
false
);
- 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
);
}
}