Adding a getClockDivider function (#1355)

* Adding getClockDivider function

* indentation correction
This commit is contained in:
BuzzRage 2018-05-14 07:08:27 -04:00 committed by Me No Dev
parent 6bf7619ccc
commit f5246cf4c1
2 changed files with 8 additions and 1 deletions

View File

@ -31,7 +31,7 @@ SPIClass::SPIClass(uint8_t spi_bus)
,_ss(-1) ,_ss(-1)
,_div(0) ,_div(0)
,_freq(1000000) ,_freq(1000000)
, _inTransaction(false) ,_inTransaction(false)
{} {}
void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
@ -109,6 +109,11 @@ void SPIClass::setClockDivider(uint32_t clockDiv)
spiSetClockDiv(_spi, _div); spiSetClockDiv(_spi, _div);
} }
uint32_t SPIClass::getClockDivider()
{
return spiGetClockDiv(_spi);
}
void SPIClass::setDataMode(uint8_t dataMode) void SPIClass::setDataMode(uint8_t dataMode)
{ {
spiSetDataMode(_spi, dataMode); spiSetDataMode(_spi, dataMode);

View File

@ -61,6 +61,8 @@ public:
void setFrequency(uint32_t freq); void setFrequency(uint32_t freq);
void setClockDivider(uint32_t clockDiv); void setClockDivider(uint32_t clockDiv);
uint32_t getClockDivider();
void beginTransaction(SPISettings settings); void beginTransaction(SPISettings settings);
void endTransaction(void); void endTransaction(void);