Commit 81429bf2 authored by Sandeep Mistry's avatar Sandeep Mistry

Add nRF52833 support + generic variant

parent a9ca22cd
...@@ -41,3 +41,4 @@ script: ...@@ -41,3 +41,4 @@ script:
- buildExampleSketch sandeepmistry:nRF5:Sinobit 01.Basics BareMinimum - buildExampleSketch sandeepmistry:nRF5:Sinobit 01.Basics BareMinimum
- buildExampleSketch sandeepmistry:nRF5:DWM1001-DEV 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:DWM1001-DEV 01.Basics Blink
- buildExampleSketch sandeepmistry:nRF5:SeeedArchLink 01.Basics Blink - buildExampleSketch sandeepmistry:nRF5:SeeedArchLink 01.Basics Blink
- buildExampleSketch sandeepmistry:nRF5:Generic_nRF52833 01.Basics Blink
...@@ -21,6 +21,39 @@ menu.version=Version ...@@ -21,6 +21,39 @@ menu.version=Version
menu.lfclk=Low Frequency Clock menu.lfclk=Low Frequency Clock
menu.board_variant=Board Variant menu.board_variant=Board Variant
# nRF52833 variants
###################
Generic_nRF52833.name=Generic nRF52833
Generic_nRF52833.upload.tool=sandeepmistry:openocd
Generic_nRF52833.upload.target=nrf52
Generic_nRF52833.upload.maximum_size=524288
Generic_nRF52833.bootloader.tool=sandeepmistry:openocd
Generic_nRF52833.build.mcu=cortex-m4
Generic_nRF52833.build.f_cpu=64000000
Generic_nRF52833.build.board=GENERIC
Generic_nRF52833.build.core=nRF5
Generic_nRF52833.build.variant=Generic
Generic_nRF52833.build.variant_system_lib=
Generic_nRF52833.build.extra_flags=-DNRF52833_XXAA
Generic_nRF52833.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
Generic_nRF52833.build.ldscript=nrf52833_xxaa.ld
Generic_nRF52833.menu.softdevice.none=None
Generic_nRF52833.menu.softdevice.none.softdevice=none
Generic_nRF52833.menu.softdevice.none.softdeviceversion=
Generic_nRF52833.menu.lfclk.lfxo=Crystal Oscillator
Generic_nRF52833.menu.lfclk.lfxo.build.lfclk_flags=-DUSE_LFXO
Generic_nRF52833.menu.lfclk.lfrc=RC Oscillator
Generic_nRF52833.menu.lfclk.lfrc.build.lfclk_flags=-DUSE_LFRC
Generic_nRF52833.menu.lfclk.lfsynt=Synthesized
Generic_nRF52833.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
# nRF52832 variants # nRF52832 variants
################### ###################
......
...@@ -95,10 +95,19 @@ void loop( void ) ; ...@@ -95,10 +95,19 @@ void loop( void ) ;
#define bit(b) (1UL << (b)) #define bit(b) (1UL << (b))
#if (GPIO_COUNT == 1)
#define gpioBaseForPin(P) ( NRF_GPIO ) #define gpioBaseForPin(P) ( NRF_GPIO )
#define digitalPinToPort(P) ( (NRF_GPIO_Type *) gpioBaseForPin(P) ) #define digitalPinToPort(P) ( (NRF_GPIO_Type *) gpioBaseForPin(P) )
#define digitalPinToPin(P) ( g_ADigitalPinMap[P] ) #define digitalPinToPin(P) ( g_ADigitalPinMap[P] )
#define digitalPinToBitMask(P) ( 1 << digitalPinToPin(P) ) #define digitalPinToBitMask(P) ( 1 << digitalPinToPin(P) )
#elif (GPIO_COUNT == 2)
#define gpioBaseForPin(P) ( (g_ADigitalPinMap[P] & 0x20) ? NRF_P1 : NRF_P0 )
#define digitalPinToPort(P) ( (NRF_GPIO_Type *) gpioBaseForPin(P) )
#define digitalPinToPin(P) ( g_ADigitalPinMap[P] & 0x1f )
#define digitalPinToBitMask(P) ( 1 << digitalPinToPin(P) )
#else
#error "Unsupported GPIO_COUNT"
#endif
#define portOutputRegister(port) ( &(port->OUTSET) ) #define portOutputRegister(port) ( &(port->OUTSET) )
#define portInputRegister(port) ( &(port->IN) ) #define portInputRegister(port) ( &(port->IN) )
......
...@@ -29,18 +29,22 @@ extern "C" { ...@@ -29,18 +29,22 @@ extern "C" {
static uint32_t saadcReference = SAADC_CH_CONFIG_REFSEL_Internal; static uint32_t saadcReference = SAADC_CH_CONFIG_REFSEL_Internal;
static uint32_t saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_5; static uint32_t saadcGain = SAADC_CH_CONFIG_GAIN_Gain1_5;
#define PWM_COUNT 3
static NRF_PWM_Type* pwms[PWM_COUNT] = { static NRF_PWM_Type* pwms[PWM_COUNT] = {
NRF_PWM0, NRF_PWM0,
NRF_PWM1, NRF_PWM1,
NRF_PWM2 NRF_PWM2,
#if PWM_COUNT > 3
NRF_PWM3
#endif
}; };
static uint32_t pwmChannelPins[PWM_COUNT] = { static uint32_t pwmChannelPins[PWM_COUNT] = {
0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF 0xFFFFFFFF,
#if PWM_COUNT > 3
0xFFFFFFFF,
#endif
}; };
static uint16_t pwmChannelSequence[PWM_COUNT]; static uint16_t pwmChannelSequence[PWM_COUNT];
......
...@@ -51,5 +51,39 @@ const uint32_t g_ADigitalPinMap[] = { ...@@ -51,5 +51,39 @@ const uint32_t g_ADigitalPinMap[] = {
28, 28,
29, 29,
30, 30,
31 31,
#if GPIO_COUNT > 1
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
#endif
}; };
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define _VARIANT_GENERIC_ #define _VARIANT_GENERIC_
#include "nrf.h" #include "nrf.h"
#include "nrf_peripherals.h"
/** Master clock frequency */ /** Master clock frequency */
#if defined(NRF52_SERIES) #if defined(NRF52_SERIES)
...@@ -38,8 +39,15 @@ extern "C" ...@@ -38,8 +39,15 @@ extern "C"
#endif // __cplusplus #endif // __cplusplus
// Number of pins defined in PinDescription array // Number of pins defined in PinDescription array
#if GPIO_COUNT == 1
#define PINS_COUNT (32u) #define PINS_COUNT (32u)
#define NUM_DIGITAL_PINS (32u) #define NUM_DIGITAL_PINS (32u)
#elif GPIO_COUNT == 2
#define PINS_COUNT (64u)
#define NUM_DIGITAL_PINS (64u)
#else
#error "Unsupported GPIO_COUNT"
#endif
#define NUM_ANALOG_INPUTS (6u) #define NUM_ANALOG_INPUTS (6u)
#define NUM_ANALOG_OUTPUTS (0u) #define NUM_ANALOG_OUTPUTS (0u)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment