 
 // Static descriptions of the waveforms for each channel
 struct WaveformBank {
-  // Pointer to the start of the waveform table, for each channel (channels may
-  // share the same table)
+  // Pointer to the start of the waveform table, for each channel. (Channels
+  // may share the same table.)
   uint16_t *channel_waveform[NUM_CHANNELS];
 
-  // Starting offset (phase) into the table, for each channel
-  // (The actual array is stored outside of this struct, since in many cases it
-  // will be shared between many (if not all) banks.)
+  // Starting offset (phase) into the table, for each channel. (The actual
+  // array is stored outside of this struct, since it may be shared between
+  // multiple banks.)
   size_t *channel_offset;
 };
 

const IRQn_Type SPI_DAC_IRQn = SPI0_IRQn;
#define SPI_DAC_Handler SPI0_Handler

// SPI peripheral chip select (slave select) line
const uint32_t SPI_DAC_NPCS = 0; // This is PA28, which is Arduino board pin 10

// Number of daisy-chained DACs

//   than a handful of waveforms are required. If that becomes an issue, it
//   might make sense to read waveforms from an SD card via SPI. The SPI
//   interface of an SD (MMC) card can be clocked at 25 MHz, so it is probably
//   fast enough for many applications.


//
// Hardware requirements
//

// The two AD660s are assumed to be configured in serial data mode, with the
// DAC for channel 0 connected to the MCU and the channel 1 DAC daisy-chained
// from the serial output of the channel 0 DAC.
//
// The following connections between the MCU board (Arduino Due) and the DACs
// are assumed:
// - SPI header MOSI (PA26) -> SIN (DAC 0)
// - SPI header SCK (PA27) -> nCS (all DACs)
// - Digital pin 10 (PA28 (and PA29)) -> LDAC (all DACs)
// - Digital pin 2 (PB25) -> nCLR (all DACs)


//
// Serial communication protocol
//

// Commands are terminated with LF. Extra spaces are not allowed.
//
// ID - identify the device
// ID\n
