|
|
@ -64,16 +64,18 @@ void configureSPI() {
|
|
|
|
|
|
|
|
|
|
|
|
digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave
|
|
|
|
digitalWrite(PIN_SLAVE_SELECT, HIGH); // Disable slave
|
|
|
|
|
|
|
|
|
|
|
|
// Configure SPI Control Register (SPCR) (All values initially 0)
|
|
|
|
/*
|
|
|
|
// Bit Description
|
|
|
|
Configure SPI Control Register (SPCR) (All values initially 0)
|
|
|
|
// 7 SPI Interrupt Enable -- disable (SPIE --> 0)
|
|
|
|
Bit Description
|
|
|
|
// 6 SPI Enable -- enable (SPE --> 1)
|
|
|
|
7 SPI Interrupt Enable -- disable (SPIE --> 0)
|
|
|
|
// 5 Data Order -- MSB 1st (DORD --> 0) (Slave specific)
|
|
|
|
6 SPI Enable -- enable (SPE --> 1)
|
|
|
|
// 4 Master/Slave Select -- master (MSTR --> 1)
|
|
|
|
5 Data Order -- MSB 1st (DORD --> 0) (Slave specific)
|
|
|
|
// 3 Clock Polarity -- (CPOL --> 0) (Slave specific) ("Mode")
|
|
|
|
4 Master/Slave Select -- master (MSTR --> 1)
|
|
|
|
// 2 Clock Phase -- (CPHA --> 0) (Slave specific)
|
|
|
|
3 Clock Polarity -- (CPOL --> 0) (Slave specific) ("Mode")
|
|
|
|
// 1 SPI Clock Rate Select 1 -- } (SPR1 --> 0)
|
|
|
|
2 Clock Phase -- (CPHA --> 0) (Slave specific)
|
|
|
|
// 0 SPI Clock Rate Select 0 -- } fOSC/4 (SPR0 --> 0) ("Fastest" but see SPI2X in SPSR)
|
|
|
|
1 SPI Clock Rate Select 1 -- } (SPR1 --> 0)
|
|
|
|
|
|
|
|
0 SPI Clock Rate Select 0 -- } fOSC/4 (SPR0 --> 0) ("Fastest" but see SPI2X in SPSR)
|
|
|
|
|
|
|
|
*/
|
|
|
|
SPCR = (1<<SPE)| (1<<MSTR);
|
|
|
|
SPCR = (1<<SPE)| (1<<MSTR);
|
|
|
|
|
|
|
|
|
|
|
|
// Clear previous data and status (TODO: Determine if necessary/better way.)
|
|
|
|
// Clear previous data and status (TODO: Determine if necessary/better way.)
|
|
|
|