Skip to content

Commit

Permalink
- disable SPI using SPI transactions on SAMD (Arduino Zero) for now
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Jul 25, 2015
1 parent 051765c commit 474ef48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nRF8001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ nRF8001::nRF8001(unsigned char req, unsigned char rdy, unsigned char rst) :
this->_aciState.aci_pins.reqn_pin = req;
this->_aciState.aci_pins.rdyn_pin = rdy;

#ifndef SPI_HAS_TRANSACTION
#if !defined(SPI_HAS_TRANSACTION) || defined(__SAMD21G18A__)
#if defined(__SAM3X8E__)
this->_aciState.aci_pins.spi_clock_divider = 42;
#else
Expand Down
8 changes: 4 additions & 4 deletions utility/hal_aci_tl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ static void m_aci_pins_set(aci_pins_t *a_pins_ptr)
static inline void m_aci_reqn_disable (void)
{
digitalWrite(a_pins_local_ptr->reqn_pin, 1);
#ifdef SPI_HAS_TRANSACTION
#if defined(SPI_HAS_TRANSACTION) && !defined(__SAMD21G18A__)
SPI.endTransaction();
#endif
}

static inline void m_aci_reqn_enable (void)
{
#ifdef SPI_HAS_TRANSACTION
#if defined(SPI_HAS_TRANSACTION) && !defined(__SAMD21G18A__)
SPI.beginTransaction(SPISettings(2000000, LSBFIRST, SPI_MODE0));
#endif
digitalWrite(a_pins_local_ptr->reqn_pin, 0);
Expand Down Expand Up @@ -350,7 +350,7 @@ bool hal_aci_tl_event_get(hal_aci_data_t *p_aci_data)
{
/* Enable RDY line interrupt again */
attachInterrupt(a_pins_local_ptr->interrupt_number, m_aci_isr, LOW);
#ifdef SPI_HAS_TRANSACTION
#if defined(SPI_HAS_TRANSACTION) && defined(__SAMD21G18A__)
SPI.usingInterrupt(a_pins->interrupt_number);
#endif
}
Expand Down Expand Up @@ -385,7 +385,7 @@ void hal_aci_tl_init(aci_pins_t *a_pins, bool debug)
The SPI library assumes that the hardware pins are used
*/
SPI.begin();
#ifndef SPI_HAS_TRANSACTION
#if !defined(SPI_HAS_TRANSACTION) || defined(__SAMD21G18A__)
//Board dependent defines
#if defined (__AVR__) || defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
//For Arduino use the LSB first
Expand Down
2 changes: 1 addition & 1 deletion utility/hal_aci_tl.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typedef struct aci_pins_t
{
uint8_t reqn_pin; //Required
uint8_t rdyn_pin; //Required
#ifndef SPI_HAS_TRANSACTION
#if !defined(SPI_HAS_TRANSACTION) || defined(__SAMD21G18A__)
uint8_t spi_clock_divider; //Required : Clock divider on the SPI clock : nRF8001 supports a maximum clock of 3MHz
#endif
uint8_t reset_pin; //Recommended but optional - Set it to UNUSED when not connected
Expand Down

0 comments on commit 474ef48

Please sign in to comment.