Fix copyright date, add comment clarifying FIFO behaviour

This commit is contained in:
Luke Wren 2021-02-08 13:41:02 +00:00 committed by Graham Sanderson
parent e81e0a022a
commit 6724968c8d

View File

@ -1,5 +1,5 @@
/** /**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -61,7 +61,11 @@ int main() {
// return until the full transmission is finished. // return until the full transmission is finished.
spi_write_blocking(spi0, (const uint8_t*)txbuf, BUF_SIZE); spi_write_blocking(spi0, (const uint8_t*)txbuf, BUF_SIZE);
// The data we just sent should now be present in the state machine's FIFO. // The data we just sent should now be present in the state machine's
// FIFO. We only sent 8 bytes, so all the data received by the state
// machine will fit into the FIFO. Generally you want to be continuously
// reading data out as it appears in the FIFO -- either with polling, FIFO
// interrupts, or DMA.
puts("Reading back from RX FIFO:"); puts("Reading back from RX FIFO:");
for (int i = 0; i < BUF_SIZE; ++i) { for (int i = 0; i < BUF_SIZE; ++i) {
uint8_t rxdata = pio_sm_get_blocking(pio, sm); uint8_t rxdata = pio_sm_get_blocking(pio, sm);