SPI performance tweak
This commit is contained in:
parent
4ed912eb23
commit
eebb68cd7f
@ -39,7 +39,7 @@ class SPISettings {
|
|||||||
class SPIClass {
|
class SPIClass {
|
||||||
public:
|
public:
|
||||||
void begin();
|
void begin();
|
||||||
void beginTransaction(SPISettings);
|
void beginTransaction(const SPISettings&);
|
||||||
void endTransaction() {};
|
void endTransaction() {};
|
||||||
uint8_t transfer(uint8_t data);
|
uint8_t transfer(uint8_t data);
|
||||||
uint16_t transfer16(uint16_t data);
|
uint16_t transfer16(uint16_t data);
|
||||||
|
@ -243,7 +243,7 @@ void SPIClass::setDataMode(uint8_t dataMode) {
|
|||||||
_currentSetting->spi_d->regs->CR1 = cr1 | (dataMode & (SPI_CR1_CPOL|SPI_CR1_CPHA));
|
_currentSetting->spi_d->regs->CR1 = cr1 | (dataMode & (SPI_CR1_CPOL|SPI_CR1_CPHA));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) {
|
void SPIClass::beginTransaction(uint8_t pin, const SPISettings &settings) {
|
||||||
setBitOrder(settings.bitOrder);
|
setBitOrder(settings.bitOrder);
|
||||||
setDataMode(settings.dataMode);
|
setDataMode(settings.dataMode);
|
||||||
setDataSize(settings.dataSize);
|
setDataSize(settings.dataSize);
|
||||||
@ -251,7 +251,7 @@ void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) {
|
|||||||
begin();
|
begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::beginTransactionSlave(SPISettings settings) {
|
void SPIClass::beginTransactionSlave(const SPISettings &settings) {
|
||||||
setBitOrder(settings.bitOrder);
|
setBitOrder(settings.bitOrder);
|
||||||
setDataMode(settings.dataMode);
|
setDataMode(settings.dataMode);
|
||||||
setDataSize(settings.dataSize);
|
setDataSize(settings.dataSize);
|
||||||
|
@ -126,6 +126,7 @@ private:
|
|||||||
bitOrder = inBitOrder;
|
bitOrder = inBitOrder;
|
||||||
dataMode = inDataMode;
|
dataMode = inDataMode;
|
||||||
dataSize = inDataSize;
|
dataSize = inDataSize;
|
||||||
|
//state = SPI_STATE_IDLE;
|
||||||
}
|
}
|
||||||
uint32_t clock;
|
uint32_t clock;
|
||||||
uint32_t dataSize;
|
uint32_t dataSize;
|
||||||
@ -187,11 +188,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
void beginTransaction(SPISettings settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); }
|
void beginTransaction(const SPISettings &settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); }
|
||||||
void beginTransaction(uint8_t pin, SPISettings settings);
|
void beginTransaction(uint8_t pin, const SPISettings &settings);
|
||||||
void endTransaction();
|
void endTransaction();
|
||||||
|
|
||||||
void beginTransactionSlave(SPISettings settings);
|
void beginTransactionSlave(const SPISettings &settings);
|
||||||
|
|
||||||
void setClockDivider(uint32_t clockDivider);
|
void setClockDivider(uint32_t clockDivider);
|
||||||
void setBitOrder(BitOrder bitOrder);
|
void setBitOrder(BitOrder bitOrder);
|
||||||
|
Loading…
Reference in New Issue
Block a user