add second hardware i2c as Wire1 for cplayground bluefruit

This commit is contained in:
hathach committed 2019-10-18 16:09:21 +07:00
1 parent d61c88ae5f
commit 74b2463953
3 files changed
+24 -12

No files matched your search

+5 -8
View File
@@ -34,15 +34,9 @@
class TwoWire : public Stream
{
public:
#if defined(NRF52) || defined(NRF52_SERIES)
TwoWire(NRF_TWIM_Type * p_twim, NRF_TWIS_Type * p_twis, IRQn_Type IRQn, uint8_t pinSDA, uint8_t pinSCL);
#else
TwoWire(NRF_TWI_Type * p_twi, uint8_t pinSDA, uint8_t pinSCL);
#endif
void begin();
#if defined(NRF52) || defined(NRF52_SERIES)
void begin(uint8_t);
#endif
void end();
void setClock(uint32_t);
@@ -60,11 +54,10 @@ class TwoWire : public Stream
virtual int read(void);
virtual int peek(void);
virtual void flush(void);
#if defined(NRF52) || defined(NRF52_SERIES)
void onReceive(void(*)(int));
void onRequest(void(*)(void));
void onService(void);
#endif
using Print::write;
@@ -105,4 +98,8 @@ class TwoWire : public Stream
extern TwoWire Wire;
#endif
#if WIRE_INTERFACES_COUNT > 1
extern TwoWire Wire1;
#endif
#endif
+13 -1
View File
@@ -392,9 +392,9 @@ void TwoWire::onService(void)
}
}
#if WIRE_INTERFACES_COUNT > 0
TwoWire Wire(NRF_TWIM0, NRF_TWIS0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL);
#if WIRE_INTERFACES_COUNT > 0
extern "C"
{
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void)
@@ -404,4 +404,16 @@ extern "C"
}
#endif
#if WIRE_INTERFACES_COUNT > 1
TwoWire Wire1(NRF_TWIM1, NRF_TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
extern "C"
{
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void)
{
Wire1.onService();
}
}
#endif
#endif // NRF52_SERIES
@@ -112,10 +112,13 @@ static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define WIRE_INTERFACES_COUNT 2
#define PIN_WIRE_SDA (28)
#define PIN_WIRE_SCL (26)
#define PIN_WIRE_SDA (2)
#define PIN_WIRE_SCL (3)
#define PIN_WIRE1_SDA (28)
#define PIN_WIRE1_SCL (26)
// QSPI Pins
#define PIN_QSPI_SCK 29