Skip to content

Commit 313705e

Browse files
committed
add nrf52 series common macros NRF52_SERIES
1 parent 6106bdf commit 313705e

File tree

8 files changed

+13
-12
lines changed

8 files changed

+13
-12
lines changed

cores/nRF5/Uart.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void Uart::begin(unsigned long baudrate, uint16_t /*config*/)
7474

7575
uint32_t nrfBaudRate;
7676

77-
#ifdef NRF52
77+
#if defined(NRF52) || defined(NRF52_SERIES)
7878
if (baudrate <= 1200) {
7979
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud1200;
8080
} else if (baudrate <= 2400) {
@@ -229,7 +229,7 @@ size_t Uart::write(const uint8_t data)
229229
return 1;
230230
}
231231

232-
#if defined(NRF52)
232+
#if defined(NRF52) || defined(NRF52_SERIES)
233233
#define NRF_UART0_IRQn UARTE0_UART0_IRQn
234234
#elif defined(NRF51)
235235
#define NRF_UART0_IRQn UART0_IRQn
@@ -241,7 +241,7 @@ size_t Uart::write(const uint8_t data)
241241
Uart Serial( NRF_UART0, NRF_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
242242
#endif
243243

244-
#if defined(NRF52)
244+
#if defined(NRF52) || defined(NRF52_SERIES)
245245
extern "C"
246246
{
247247
void UARTE0_UART0_IRQHandler()

cores/nRF5/WInterrupts.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include <string.h>
2626

27-
#ifdef NRF52
27+
#if defined(NRF52) || defined(NRF52_SERIES)
2828
#define NUMBER_OF_GPIO_TE 8
2929
#else
3030
#define NUMBER_OF_GPIO_TE 4

cores/nRF5/wiring_analog.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
/*
3030
* \brief SAMD products have only one reference for ADC
3131
*/
32-
#ifdef NRF52
32+
#if defined(NRF52) || defined(NRF52_SERIES)
3333
typedef enum _eAnalogReference
3434
{
3535
AR_DEFAULT,

cores/nRF5/wiring_analog_nRF52.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#ifdef NRF52
20+
#if defined(NRF52) || defined(NRF52_SERIES)
2121

2222
#include "nrf.h"
2323

libraries/Wire/Wire.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
class TwoWire : public Stream
3535
{
3636
public:
37-
#ifdef NRF52
37+
#if defined(NRF52) || defined(NRF52_SERIES)
3838
TwoWire(NRF_TWIM_Type * p_twim, NRF_TWIS_Type * p_twis, IRQn_Type IRQn, uint8_t pinSDA, uint8_t pinSCL);
3939
#else
4040
TwoWire(NRF_TWI_Type * p_twi, uint8_t pinSDA, uint8_t pinSCL);
4141
#endif
4242
void begin();
43-
#ifdef NRF52
43+
#if defined(NRF52) || defined(NRF52_SERIES)
4444
void begin(uint8_t);
4545
#endif
4646
void end();
@@ -60,7 +60,7 @@ class TwoWire : public Stream
6060
virtual int read(void);
6161
virtual int peek(void);
6262
virtual void flush(void);
63-
#ifdef NRF52
63+
#if defined(NRF52) || defined(NRF52_SERIES)
6464
void onReceive(void(*)(int));
6565
void onRequest(void(*)(void));
6666
void onService(void);
@@ -69,7 +69,7 @@ class TwoWire : public Stream
6969
using Print::write;
7070

7171
private:
72-
#ifdef NRF52
72+
#if defined(NRF52) || defined(NRF52_SERIES)
7373
NRF_TWIM_Type * _p_twim;
7474
NRF_TWIS_Type * _p_twis;
7575
#else

libraries/Wire/Wire_nRF52.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21-
#ifdef NRF52
21+
#if defined(NRF52) || defined(NRF52_SERIES)
2222

2323
extern "C" {
2424
#include <string.h>

platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ nffs.includes="-I{nffs.path}/fs/nffs/include" "-I{nffs.path}/fs/fs/include" "-I
6363
# ARDUINO_FEATHER52 is defined for backward compatiable with other lib only
6464
# should be replaced by ARDUINO_NRF52_ADAFRUIT in the future
6565

66-
compiler.nrf.flags= -DARDUINO_FEATHER52 -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DUSE_LFXO {build.sd_flags} {build.debug_flags} "-I{nrf.sdk.path}/components/toolchain/" "-I{nrf.sdk.path}/components/toolchain/cmsis/include" "-I{nrf.sdk.path}/components/toolchain/gcc/" "-I{nrf.sdk.path}/components/device/" "-I{nrf.sdk.path}/components/drivers_nrf/delay/" "-I{nrf.sdk.path}/components/drivers_nrf/hal/" "-I{nrf.sdk.path}/components/libraries/util/" "-I{build.core.path}/softdevice/{build.sd_name}/{build.sd_version}/headers/" "-I{rtos.path}/source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" {nffs.includes}
66+
compiler.nrf.flags= -DARDUINO_FEATHER52 -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DUSE_LFXO {build.sd_flags} {build.debug_flags} "-I{nrf.sdk.path}/components/toolchain/cmsis/include" "-I{nrf.sdk.path}/components/device/" "-I{nrf.sdk.path}/components/drivers_nrf/delay/" "-I{nrf.sdk.path}/components/drivers_nrf/hal/" "-I{nrf.sdk.path}/components/libraries/util/" "-I{build.core.path}/softdevice/{build.sd_name}/{build.sd_version}/headers/" "-I{rtos.path}/source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" {nffs.includes}
6767

6868
# These can be overridden in platform.local.txt
6969
compiler.c.extra_flags=

variants/feather52840/variant.h

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static const uint8_t SCK = PIN_SPI_SCK ;
119119
#define PIN_WIRE_SCL (26u)
120120

121121

122+
// TODO remove
122123
static inline bool isPinValid(uint32_t pin)
123124
{
124125
// 0, 1 is xtal

0 commit comments

Comments
 (0)