|
Prusa MINI Firmware overview
|
Wirish SPI interface. More...
#include <SPI.h>
Public Member Functions | |
| SPIClass () | |
| void | begin (uint8_t _pin=CS_PIN_CONTROLLED_BY_USER) |
| void | end (void) |
| void | beginTransaction (SPISettings settings) |
| void | endTransaction (void) |
| byte | transfer (uint8_t _data, SPITransferMode _mode=SPI_LAST) |
| uint16_t | transfer16 (uint16_t _data, SPITransferMode _mode=SPI_LAST) |
| uint8_t | dmaTransfer (uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length) |
| uint8_t | dmaSend (uint8_t *buf, uint16_t length) |
| SPIClass (uint32_t spiPortNumber) | |
| void | begin () |
| Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0). More... | |
| void | beginSlave (uint32_t bitOrder, uint32_t mode) |
| Turn on a SPI port and set its GPIO pin modes for use as a slave. More... | |
| void | beginSlave () |
| Equivalent to beginSlave(MSBFIRST, 0). More... | |
| void | end () |
| Disables the SPI port, but leaves its GPIO pin modes unchanged. More... | |
| void | beginTransaction (SPISettings settings) |
| void | beginTransaction (uint8_t pin, SPISettings settings) |
| void | endTransaction () |
| void | beginTransactionSlave (SPISettings settings) |
| void | setClockDivider (uint32_t clockDivider) |
| void | setBitOrder (BitOrder bitOrder) |
| void | setDataMode (uint8_t dataMode) |
| void | attachInterrupt () |
| void | detachInterrupt () |
| void | setDataSize (uint32_t ds) |
| void | onReceive (void(*)()) |
| void | onTransmit (void(*)()) |
| uint16_t | read () |
| Return the next unread byte/word. More... | |
| void | read (uint8_t *buffer, uint32_t length) |
| Read length bytes, storing them into buffer. More... | |
| void | write (uint16_t data) |
| Transmit one byte/word. More... | |
| void | write16 (uint16_t data) |
| void | write (uint16_t data, uint32_t n) |
| Transmit one byte/word a specified number of times. More... | |
| void | write (const void *buffer, uint32_t length) |
| Transmit multiple bytes/words. More... | |
| uint8_t | transfer (uint8_t data) const |
| Transmit a byte, then return the next unread byte. More... | |
| uint16_t | transfer16 (uint16_t data) const |
| uint8_t | dmaTransfer (const void *transmitBuf, void *receiveBuf, uint16_t length) |
| Sets up a DMA Transfer for "length" bytes. The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting. More... | |
| void | dmaTransferSet (const void *transmitBuf, void *receiveBuf) |
| uint8_t | dmaTransferRepeat (uint16_t length) |
| uint8_t | dmaSend (const void *transmitBuf, uint16_t length, bool minc=1) |
| Sets up a DMA Transmit for SPI 8 or 16 bit transfer mode. The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting. More... | |
| void | dmaSendSet (const void *transmitBuf, bool minc) |
| uint8_t | dmaSendRepeat (uint16_t length) |
| uint8_t | dmaSendAsync (const void *transmitBuf, uint16_t length, bool minc=1) |
| uint8_t | misoPin () |
| Return the number of the MISO (master in, slave out) pin. More... | |
| uint8_t | mosiPin () |
| Return the number of the MOSI (master out, slave in) pin. More... | |
| uint8_t | sckPin () |
| Return the number of the SCK (serial clock) pin. More... | |
| uint8_t | nssPin () |
| Return the number of the NSS (slave select) pin. More... | |
| spi_dev * | c_dev () |
| Get a pointer to the underlying libmaple spi_dev for this HardwareSPI instance. More... | |
| spi_dev * | dev () |
| void | setModule (int spi_num) |
| Sets the number of the SPI peripheral to be used by this HardwareSPI instance. More... | |
| uint8_t | send (uint8_t data) |
| Deprecated. More... | |
| uint8_t | send (uint8_t *data, uint32_t length) |
| Deprecated. More... | |
| uint8_t | recv () |
| Deprecated. More... | |
Wirish SPI interface.
This implementation uses software slave management, so the caller is responsible for controlling the slave select line.
| SPIClass::SPIClass | ( | uint32_t | spiPortNumber | ) |
| spiPortNumber | Number of the SPI port to manage. |
| void SPIClass::begin | ( | uint8_t | _pin = CS_PIN_CONTROLLED_BY_USER | ) |
| void SPIClass::beginTransaction | ( | SPISettings | settings | ) |
| byte SPIClass::transfer | ( | uint8_t | _data, |
| SPITransferMode | _mode = SPI_LAST |
||
| ) |

| uint16_t SPIClass::transfer16 | ( | uint16_t | _data, |
| SPITransferMode | _mode = SPI_LAST |
||
| ) |



| void SPIClass::begin | ( | ) |
Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
| void SPIClass::beginSlave | ( | uint32_t | bitOrder, |
| uint32_t | mode | ||
| ) |
Turn on a SPI port and set its GPIO pin modes for use as a slave.
SPI port is enabled in full duplex mode, with software slave management.
| bitOrder | Either LSBFIRST (little-endian) or MSBFIRST(big-endian) |
| mode | SPI mode to use |
| void SPIClass::beginSlave | ( | ) |
Equivalent to beginSlave(MSBFIRST, 0).
| void SPIClass::end | ( | ) |
Disables the SPI port, but leaves its GPIO pin modes unchanged.
| void SPIClass::beginTransaction | ( | SPISettings | settings | ) |
| void SPIClass::beginTransaction | ( | uint8_t | pin, |
| SPISettings | settings | ||
| ) |
| void SPIClass::endTransaction | ( | ) |
| void SPIClass::beginTransactionSlave | ( | SPISettings | settings | ) |
| void SPIClass::setClockDivider | ( | uint32_t | clockDivider | ) |
| void SPIClass::attachInterrupt | ( | ) |
| void SPIClass::detachInterrupt | ( | ) |
| void SPIClass::setDataSize | ( | uint32_t | ds | ) |
| uint16_t SPIClass::read | ( | ) |
Return the next unread byte/word.
If there is no unread byte/word waiting, this function will block until one is received.

Read length bytes, storing them into buffer.
| buffer | Buffer to store received bytes into. |
| length | Number of bytes to store in buffer. This function will block until the desired number of bytes have been read. |
| void SPIClass::write | ( | uint16_t | data | ) |
Transmit one byte/word.
| data | to transmit. |
| void SPIClass::write16 | ( | uint16_t | data | ) |
| void SPIClass::write | ( | uint16_t | data, |
| uint32_t | n | ||
| ) |
Transmit one byte/word a specified number of times.
| data | to transmit. |
Transmit multiple bytes/words.
| buffer | Bytes/words to transmit. |
| length | Number of bytes/words in buffer to transmit. |
Transmit a byte, then return the next unread byte.
This function transmits before receiving.
| data | Byte to transmit. |
| uint16_t SPIClass::transfer16 | ( | uint16_t | data | ) | const |
Sets up a DMA Transfer for "length" bytes. The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
This function transmits and receives to buffers.
| transmitBuf | buffer Bytes to transmit. If passed as 0, it sends FF repeatedly for "length" bytes |
| receiveBuf | buffer Bytes to save received data. |
| length | Number of bytes in buffer to transmit. |
| uint8_t SPIClass::dmaTransferRepeat | ( | uint16_t | length | ) |
Sets up a DMA Transmit for SPI 8 or 16 bit transfer mode. The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
This function only transmits and does not care about the RX fifo.
| data | buffer half words to transmit, |
| length | Number of bytes in buffer to transmit. |
| minc | Set to use Memory Increment mode, clear to use Circular mode. |
| uint8_t SPIClass::dmaSendRepeat | ( | uint16_t | length | ) |
| uint8_t SPIClass::misoPin | ( | ) |
Return the number of the MISO (master in, slave out) pin.
| uint8_t SPIClass::mosiPin | ( | ) |
Return the number of the MOSI (master out, slave in) pin.
| uint8_t SPIClass::sckPin | ( | ) |
Return the number of the SCK (serial clock) pin.
| uint8_t SPIClass::nssPin | ( | ) |
Return the number of the NSS (slave select) pin.
| spi_dev* SPIClass::c_dev | ( | ) |
| void SPIClass::setModule | ( | int | spi_num | ) |
Deprecated.
Use HardwareSPI::transfer() instead.
Deprecated.
Use HardwareSPI::write() in combination with HardwareSPI::read() (or HardwareSPI::transfer()) instead.
| uint8_t SPIClass::recv | ( | ) |
Deprecated.
Use HardwareSPI::read() instead.