add nrf52 series common macros NRF52_SERIES

This commit is contained in:
hathach committed 2018-04-17 17:20:22 +07:00
1 parent 6106bdfc82
commit 313705e15c
8 files changed
+13 -12

No files matched your search

+3 -3
View File
@@ -74,7 +74,7 @@ void Uart::begin(unsigned long baudrate, uint16_t /*config*/)
uint32_t nrfBaudRate;
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
if (baudrate <= 1200) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud1200;
} else if (baudrate <= 2400) {
@@ -229,7 +229,7 @@ size_t Uart::write(const uint8_t data)
return 1;
}
#if defined(NRF52)
#if defined(NRF52) || defined(NRF52_SERIES)
#define NRF_UART0_IRQn UARTE0_UART0_IRQn
#elif defined(NRF51)
#define NRF_UART0_IRQn UART0_IRQn
@@ -241,7 +241,7 @@ size_t Uart::write(const uint8_t data)
Uart Serial( NRF_UART0, NRF_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
#endif
#if defined(NRF52)
#if defined(NRF52) || defined(NRF52_SERIES)
extern "C"
{
void UARTE0_UART0_IRQHandler()
+1 -1
View File
@@ -24,7 +24,7 @@
#include <string.h>
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
#define NUMBER_OF_GPIO_TE 8
#else
#define NUMBER_OF_GPIO_TE 4
+1 -1
View File
@@ -29,7 +29,7 @@ extern "C" {
/*
* \brief SAMD products have only one reference for ADC
*/
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
typedef enum _eAnalogReference
{
AR_DEFAULT,
+1 -1
View File
@@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
#include "nrf.h"
+4 -4
View File
@@ -34,13 +34,13 @@
class TwoWire : public Stream
{
public:
#ifdef NRF52
#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();
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
void begin(uint8_t);
#endif
void end();
@@ -60,7 +60,7 @@ class TwoWire : public Stream
virtual int read(void);
virtual int peek(void);
virtual void flush(void);
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
void onReceive(void(*)(int));
void onRequest(void(*)(void));
void onService(void);
@@ -69,7 +69,7 @@ class TwoWire : public Stream
using Print::write;
private:
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
NRF_TWIM_Type * _p_twim;
NRF_TWIS_Type * _p_twis;
#else
+1 -1
View File
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef NRF52
#if defined(NRF52) || defined(NRF52_SERIES)
extern "C" {
#include <string.h>
+1 -1
View File
@@ -63,7 +63,7 @@ nffs.includes="-I{nffs.path}/fs/nffs/include" "-I{nffs.path}/fs/fs/include" "-I
# ARDUINO_FEATHER52 is defined for backward compatiable with other lib only
# should be replaced by ARDUINO_NRF52_ADAFRUIT in the future
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}
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}
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
+1
View File
@@ -119,6 +119,7 @@ static const uint8_t SCK = PIN_SPI_SCK ;
#define PIN_WIRE_SCL (26u)
// TODO remove
static inline bool isPinValid(uint32_t pin)
{
// 0, 1 is xtal