Skip to content

Commit e414d37

Browse files
committed
now spi compiles; fix #define use of isr cbs in IComm
1 parent 3dbe473 commit e414d37

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/sfTk/sfDevFPC2534IComm.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static volatile bool data_available = false;
2121

2222
static bool isISRInitialized = false;
2323

24+
#if !defined(ESP32) && !defined(ARDUINO_ARCH_RP2040)
2425
//--------------------------------------------------------------------------------------------
2526
// standard ISR handler - no param version
2627
static void the_isr_cb()
@@ -31,7 +32,7 @@ static void the_isr_cb()
3132

3233
data_available = true;
3334
}
34-
35+
#else
3536
//--------------------------------------------------------------------------------------------
3637
// ISR handler with param version ()
3738
static void the_isr_cb_arg(void *arg)
@@ -40,7 +41,7 @@ static void the_isr_cb_arg(void *arg)
4041
if (arg != nullptr)
4142
static_cast<sfDevFPC2534IComm *>(arg)->setISRDataAvailable();
4243
}
43-
44+
#endif
4445
//--------------------------------------------------------------------------------------------
4546
// method used to set the IRS Handler by a sub-class
4647
void sfDevFPC2534IComm::initISRHandler(uint32_t interruptPin)

src/sfTk/sfDevFPC2534SPI.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// --------------------------------------------------------------------------------------------
1414
// CTOR
15-
sfDevFPC2534SPI::sfDevFPC2534SPI() : _spiPort{nullptr}, _spiSettings{nullptr}, _csPin{0}
15+
sfDevFPC2534SPI::sfDevFPC2534SPI() : _spiPort{nullptr}, _csPin{0}
1616
{
1717
}
1818

@@ -37,7 +37,9 @@ bool sfDevFPC2534SPI::initialize(SPIClass &spiPort, SPISettings &busSPISettings,
3737
//--------------------------------------------------------------------------------------------
3838
bool sfDevFPC2534SPI::initialize(uint8_t csPin, uint32_t interruptPin, bool bInit)
3939
{
40-
return initialize(SPI, SPISettings(3000000, MSBFIRST, SPI_MODE3), csPin, interruptPin, bInit);
40+
// If the transaction settings are not provided by the user they are built here.
41+
SPISettings spiSettings = SPISettings(3000000, MSBFIRST, SPI_MODE3);
42+
return initialize(SPI, spiSettings, csPin, interruptPin, bInit);
4143
}
4244
//--------------------------------------------------------------------------------------------
4345
// Is data available to read - either the device is indicating it via an interrupt, or we have
@@ -49,7 +51,7 @@ bool sfDevFPC2534SPI::dataAvailable()
4951
return false;
5052

5153
// the data available flag is set, or we have data in the buffer
52-
return isISRDataAvailable() || _dataCount > 0;
54+
return isISRDataAvailable();
5355
}
5456

5557
//--------------------------------------------------------------------------------------------

src/sfTk/sfDevFPC2534SPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// from the FPC SDK
1414
#include "fpc_api.h"
15+
#include "sfDevFPC2534IComm.h"
1516

1617
#include <Arduino.h>
1718
#include <SPI.h>

0 commit comments

Comments
 (0)