61 #define SPI_CSB_PORT USER_CONFIG_CSB_PORT 65 #define SPI_TRIGGER_PORT USER_CONFIG_TRIGGER_PORT 69 #define SPI_SCK_PORT USER_CONFIG_SCK_PORT 73 #define SPI_MOSI_PORT USER_CONFIG_MOSI_PORT 77 #define SPI_MISO_PORT USER_CONFIG_MISO_PORT 81 #define SPI_WPB_PORT USER_CONFIG_IO2_PORT 85 #define SPI_HOLDB_PORT USER_CONFIG_IO3_PORT 94 #define SPI_CSB_PIN USER_CONFIG_CSB_PIN 95 #define SPI_TRIGGER_PIN USER_CONFIG_TRIGGER_PIN 97 #define SPI_SCK_PIN USER_CONFIG_SCK_PIN 99 #define SPI_MOSI_PIN USER_CONFIG_MOSI_PIN 101 #define SPI_MISO_PIN USER_CONFIG_MISO_PIN 103 #define SPI_WPB_PIN USER_CONFIG_IO2_PIN 105 #define SPI_HOLDB_PIN USER_CONFIG_IO3_PIN 172 uint32_t dummyNumBytes);
197 uint32_t dummyNumBytes);
222 uint32_t dummyNumBytes);
void SPI_ConfigureQuadSPIIOsOutput()
Configures SPIO IOs for quad output. This changes the MISO pin to an output so that the master can dr...
Project declarations exist here.
uint8_t SPI_ReceiveByte()
Receives a byte along MISO and returns the value received.
void SPI_ConfigureQuadSPIIOsInput()
Configures SPIO IOs for quad input. This changes the MOSI, WPb, and HOLDb pins to inputs so that the ...
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...
void SPI_ClockTick()
Toggles the clock: current_state->high->low.
void SPI_JEDECReset()
Performs a JEDEC reset on the SPI device.
void SPI_Delay(uint32_t delayTime)
Performs a delayTime number of NOPs.
void SPI_PinInit(uint32_t port, uint32_t pin, enum directionIO direction)
Initializes a given pin as either an input or output.
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.
void SPI_ConfigureDualSPIIOsOutput()
Configures SPIO IOs for dual output. This changes the MISO pin from an input to an output so that the...
uint8_t SPI_QuadReceiveByte()
Receives a byte along MOSI, MISO, HOLDb, and WPb and returns the value received.
directionIO
Enumeration used when initializing pins as inputs or outputs. OUTPUT = 0, INPUT = 1...
void SPI_SendBit(uint8_t transmittedBit)
Sends a single bit along MOSI while toggling the clock.
void SPI_DualSendByte(uint8_t transmittedByte)
Sends a byte along both MOSI and MISO.
void SPI_SendByte(uint8_t transmittedByte)
Sends a byte along MOSI.
void SPI_ReturnToSingleSPIIOs()
Returns MISO and MOSI pins to their standard SPI state as an input and output.
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...
void SPI_ConfigureSingleSPIIOs()
Configure the IOs for SPI bit banging usage. 4 pins are needed: CSb, SCK, MOSI, MISO.
void SPI_Trigger()
Triggers a falling edge on the SPI_TRIGGER_PORT/PIN output.
uint8_t SPI_DualReceiveByte()
Receives a byte along both MOSI and MISO and returns the value received.
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...
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 ...
void SPI_QuadSendByte(uint8_t transmittedByte)
Sends a byte along MISO, MOSI, WPb, and HOLDb.