142     volatile uint32_t i = 0;
   143     for (i = 0; i < delayTime; ++i)
   174     for(i = 7; i >= 0; i--)
   185     for(i = 7; i >= 1; i-= 2)
   191         bit_tx = (transmittedByte >> i) & 1;
   199         bit_tx = (transmittedByte >> (i-1)) & 1;
   216     for(i = 7; i >= 3; i-= 4)
   222         bit_tx = (transmittedByte >> i) & 1;
   228         bit_tx = (transmittedByte >> (i-1)) & 1;
   234         bit_tx = (transmittedByte >> (i-2)) & 1;
   240         bit_tx = (transmittedByte >> (i-3)) & 1;
   257     for(i = 7; i >= 0; i--)
   274     for(i = 7; i >= 1; i-=2)
   283             input |= (1 << (i-1));
   285             input &= ~(1 << (i-1));
   298     for(i = 7; i >= 3; i-=4)
   307             input |= (1 << (i-1));
   309             input &= ~(1 << (i-1));
   312             input |= (1 << (i-2));
   314             input &= ~(1 << (i-2));
   317             input |= (1 << (i-3));
   319             input &= ~(1 << (i-3));
   329                   uint32_t dummyNumBytes)
   339     for(i = 0; i < txNumBytes; i = i+1)
   342     for(i = 0; i < dummyNumBytes; i = i+1)
   345     for(i = 0; i < rxNumBytes; i = i+1)
   360                       uint32_t dummyNumBytes)
   370     for(i = 0; i < standardSPINumBytes; i = i+1)
   373     for(i = 0; i < dummyNumBytes; i = i+1)
   377     if(standardSPINumBytes <= txNumBytes)
   380         for(i = standardSPINumBytes; i < txNumBytes; i = i+1)
   391         for(i = 0; i < rxNumBytes; i = i+1)
   411                       uint32_t dummyNumBytes)
   415     uint8_t dummyBytesSSPI = 1;
   426     for(i = 0; i < standardSPINumBytes; i = i+1)
   430     if(standardSPINumBytes < txNumBytes)
   434         for(i = standardSPINumBytes; i < txNumBytes; i = i+1)
   440     if(dummyNumBytes > 0)
   447         if(dummyBytesSSPI == 1)
   450             for(i = 0; i < dummyNumBytes; i = i+1)
   458             for(i = 0; i < dummyNumBytes; i = i+1)
   470         for(i = 0; i < rxNumBytes; i = i+1)
 void SPI_ClockTick()
Toggles the clock: current_state->high->low. 
 
void SPI_JEDECReset()
Performs a JEDEC reset on the SPI device. 
 
#define SPI_SCK_PIN
Pin number for SCK. 
 
#define SPI_MOSI_PIN
Pin number for MOSI. 
 
#define SPI_WPB_PIN
Pin number for WPb - IO2. 
 
void SPI_QuadExchange(uint8_t standardSPINumBytes, uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MOSI can used for the opcode and address...
 
uint32_t SPI_PinRead(uint32_t port, uint32_t pin)
Reads the voltage on a given pin. 
 
void SPI_PinClear(uint32_t port, uint32_t pin)
Clears a given pin on a port to LOW. 
 
uint8_t SPI_DualReceiveByte()
Receives a byte along both MOSI and MISO and returns the value received. 
 
#define SPI_WPB_PORT
Base register used for WPb control. 
 
uint8_t SPI_QuadReceiveByte()
Receives a byte along MOSI, MISO, HOLDb, and WPb and returns the value received. 
 
#define DELAY
Half clock period delay interval. 
 
void SPI_PinSet(uint32_t port, uint32_t pin)
Sets a given pin on a port to HIGH. 
 
void SPI_ConfigureDualSPIIOsInput()
Configures SPIO IOs for dual input. This changes the MOSI pin from an output to an input so that the ...
 
#define SPI_MISO_PORT
Base register used for MISO control. 
 
#define SPI_CSB_PORT
Base register used for CSb control. 
 
void SPI_SendBit(uint8_t transmittedBit)
Sends a single bit along MOSI while toggling the clock. 
 
void SPI_SendByte(uint8_t transmittedByte)
Sends a byte along MOSI. 
 
#define SPI_TRIGGER_PIN
Pin number for TRIGGER. 
 
void SPI_ConfigureQuadSPIIOsOutput()
Configures SPIO IOs for quad output. This changes the MISO pin to an output so that the master can dr...
 
void SPI_Trigger()
Triggers a falling edge on the SPI_TRIGGER_PORT/PIN output. 
 
void SPI_QuadSendByte(uint8_t transmittedByte)
Sends a byte along MISO, MOSI, WPb, and HOLDb. 
 
void SPI_DualSendByte(uint8_t transmittedByte)
Sends a byte along both MOSI and MISO. 
 
void SPI_ConfigureQuadSPIIOsInput()
Configures SPIO IOs for quad input. This changes the MOSI, WPb, and HOLDb pins to inputs so that the ...
 
void SPI_ReturnToSingleSPIIOs()
Returns MISO and MOSI pins to their standard SPI state as an input and output. 
 
#define SPI_HOLDB_PORT
Base register used for HOLDb control. 
 
void USER_CONFIG_PinInit(uint32_t port, uint32_t pin, enum directionIO direction)
Initializes a given pin as either an input or output. When porting, this function must be redefined...
 
Declarations of spi_driver functions. 
 
#define SPI_MOSI_PORT
Base register used for MOSI control. 
 
directionIO
Enumeration used when initializing pins as inputs or outputs. OUTPUT = 0, INPUT = 1...
 
void SPI_DualExchange(uint8_t standardSPINumBytes, uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MOSI is used for the opcode and address...
 
#define SPI_HOLDB_PIN
Pin number for HOLDb - IO3. 
 
void SPI_Delay(uint32_t delayTime)
Performs a delayTime number of NOPs. 
 
void USER_CONFIG_PinClear(uint32_t port, uint32_t pin)
Clears a given pin on a port to LOW. 
 
uint8_t SPI_ReceiveByte()
Receives a byte along MISO and returns the value received. 
 
void SPI_PinInit(uint32_t port, uint32_t pin, enum directionIO direction)
Initializes a given pin as either an input or output. 
 
uint8_t USER_CONFIG_PinRead(uint32_t port, uint32_t pin)
Reads the voltage on a given pin. 
 
#define SPI_TRIGGER_PORT
Base register used for TRIGGER control. 
 
void SPI_ConfigureDualSPIIOsOutput()
Configures SPIO IOs for dual output. This changes the MISO pin from an input to an output so that the...
 
void SPI_ConfigureSingleSPIIOs()
Configure the IOs for SPI bit banging usage. 4 pins are needed: CSb, SCK, MOSI, MISO. 
 
#define SPI_MISO_PIN
Pin number for MISO. 
 
void SPI_Exchange(uint8_t *txBuffer, uint32_t txNumBytes, uint8_t *rxBuffer, uint32_t rxNumBytes, uint32_t dummyNumBytes)
Sends and receives bytes based on the function parameters. MISO and MOSI fill their standard SPI role...
 
#define SPI_SCK_PORT
Base register used for SCK control. 
 
void USER_CONFIG_PinSet(uint32_t port, uint32_t pin)
Sets a given pin on a port to HIGH.