MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / select

Method select

RFM69.cpp:558–580  ·  view source on GitHub ↗

select the RFM69 transceiver (save SPI settings, set CS low)

Source from the content-addressed store, hash-verified

556
557// select the RFM69 transceiver (save SPI settings, set CS low)
558void RFM69::select() {
559#if defined (SPCR) && defined (SPSR)
560 // save current SPI settings
561 _SPCR = SPCR;
562 _SPSR = SPSR;
563#endif
564
565#ifdef SPI_HAS_TRANSACTION
566 _spi->beginTransaction(_settings);
567#else
568 // set RFM69 SPI settings explicitly
569 _spi->setDataMode(SPI_MODE0);
570 _spi->setBitOrder(MSBFIRST);
571 #if defined(__STM32F1__)
572 _spi->setClockDivider(SPI_CLOCK_DIV8);
573 #elif defined(__arm__)
574 _spi->setClockDivider(SPI_CLOCK_DIV16);
575 #else
576 _spi->setClockDivider(SPI_CLOCK_DIV2);
577 #endif
578#endif
579 digitalWrite(_slaveSelectPin, LOW);
580}
581
582// unselect the RFM69 transceiver (set CS high, restore SPI settings)
583void RFM69::unselect() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected