|
|
@ -86,7 +86,7 @@ void spiBegin() { |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initializes SPI port to required speed rate and transfer mode (MSB, SPI MODE 0) |
|
|
|
* @brief Initialize SPI port to required speed rate and transfer mode (MSB, SPI MODE 0) |
|
|
|
* |
|
|
|
* @param spiRate Rate as declared in HAL.h (speed do not match AVR) |
|
|
|
* @return Nothing |
|
|
@ -109,7 +109,7 @@ void spiInit(uint8_t spiRate) { |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Receives a single byte from the SPI port. |
|
|
|
* @brief Receive a single byte from the SPI port. |
|
|
|
* |
|
|
|
* @return Byte received |
|
|
|
* |
|
|
@ -123,7 +123,7 @@ uint8_t spiRec(void) { |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Receives a number of bytes from the SPI port to a buffer |
|
|
|
* @brief Receive a number of bytes from the SPI port to a buffer |
|
|
|
* |
|
|
|
* @param buf Pointer to starting address of buffer to write to. |
|
|
|
* @param nbyte Number of bytes to receive. |
|
|
@ -138,7 +138,7 @@ void spiRead(uint8_t* buf, uint16_t nbyte) { |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sends a single byte on SPI port |
|
|
|
* @brief Send a single byte on SPI port |
|
|
|
* |
|
|
|
* @param b Byte to send |
|
|
|
* |
|
|
@ -165,7 +165,16 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) { |
|
|
|
SPI.endTransaction(); |
|
|
|
} |
|
|
|
|
|
|
|
/** Begin SPI transaction, set clock, bit order, data mode */ |
|
|
|
/**
|
|
|
|
* @brief Begin SPI transaction, set clock, bit order, data mode |
|
|
|
* |
|
|
|
* @param spiClock Clock setting |
|
|
|
* @param bitOrder Bit Order setting |
|
|
|
* @param dataMode Data Mode setting |
|
|
|
* @return Nothing |
|
|
|
* |
|
|
|
* @details Uses an SPI Config via SPISettings |
|
|
|
*/ |
|
|
|
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { |
|
|
|
spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode); |
|
|
|
SPI.beginTransaction(spiConfig); |
|
|
|