19.8.1.3.2 Workflow
- Select slave.
spi_select_slave(&spi_master_instance, &slave,
true
);
- Write buffer to SPI slave.
spi_write_buffer_wait(&spi_master_instance, buffer, BUF_LENGTH);
- Deselect slave.
spi_select_slave(&spi_master_instance, &slave,
false
);
- Light up.
port_pin_set_output_level(LED_0_PIN, LED0_ACTIVE);
- Infinite loop.
while
(
true
) {
/* Infinite loop */
if
(!port_pin_get_input_level(BUTTON_0_PIN)) {
spi_select_slave(&spi_master_instance, &slave,
true
);
spi_write_buffer_wait(&spi_master_instance, buffer, BUF_LENGTH);
spi_select_slave(&spi_master_instance, &slave,
false
);
port_pin_set_output_level(LED_0_PIN, LED0_ACTIVE);
}
}