Adapts RFM69 to be used with SAMD
This commit is contained in:
@@ -142,9 +142,10 @@ static const uint8_t ATN = PIN_ATN;
|
|||||||
#define USR_SPI_MISO (48u)
|
#define USR_SPI_MISO (48u)
|
||||||
#define USR_SPI_MOSI (47u)
|
#define USR_SPI_MOSI (47u)
|
||||||
#define USR_SPI_SCK (49u)
|
#define USR_SPI_SCK (49u)
|
||||||
/*
|
|
||||||
|
|
||||||
static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference.
|
static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference.
|
||||||
static const uint8_t MOSI = PIN_SPI_MOSI ;
|
/*static const uint8_t MOSI = PIN_SPI_MOSI ;
|
||||||
static const uint8_t MISO = PIN_SPI_MISO ;
|
static const uint8_t MISO = PIN_SPI_MISO ;
|
||||||
static const uint8_t SCK = PIN_SPI_SCK ;
|
static const uint8_t SCK = PIN_SPI_SCK ;
|
||||||
*/
|
*/
|
||||||
@@ -194,6 +195,9 @@ static const uint8_t SCK = PIN_SPI_SCK ;
|
|||||||
#define MY_HW_ERR_LED_PIN LED_RED
|
#define MY_HW_ERR_LED_PIN LED_RED
|
||||||
#define MY_HW_RX_LED_PIN LED_YELLOW
|
#define MY_HW_RX_LED_PIN LED_YELLOW
|
||||||
#define MY_HW_TX_LED_PIN LED_GREEN
|
#define MY_HW_TX_LED_PIN LED_GREEN
|
||||||
|
#define MY_RF69_SPI_CS 22
|
||||||
|
#define MY_RF69_IRQ_PIN 2
|
||||||
|
#define MY_RF69_IRQ_NUM 3
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
* Arduino objects - C++ only
|
* Arduino objects - C++ only
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ void RFM69::writeReg(byte addr, byte value)
|
|||||||
void RFM69::select() {
|
void RFM69::select() {
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
//save current SPI settings
|
//save current SPI settings
|
||||||
#ifndef ESP8266
|
#if !defined(ESP8266) && !defined(ARDUINO_ARCH_SAMD)
|
||||||
_SPCR = SPCR;
|
_SPCR = SPCR;
|
||||||
_SPSR = SPSR;
|
_SPSR = SPSR;
|
||||||
#endif
|
#endif
|
||||||
@@ -425,7 +425,7 @@ void RFM69::select() {
|
|||||||
void RFM69::unselect() {
|
void RFM69::unselect() {
|
||||||
digitalWrite(_slaveSelectPin, HIGH);
|
digitalWrite(_slaveSelectPin, HIGH);
|
||||||
//restore SPI settings to what they were before talking to RFM69
|
//restore SPI settings to what they were before talking to RFM69
|
||||||
#ifndef ESP8266
|
#if !defined(ESP8266) && !defined(ARDUINO_ARCH_SAMD)
|
||||||
SPCR = _SPCR;
|
SPCR = _SPCR;
|
||||||
SPSR = _SPSR;
|
SPSR = _SPSR;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user