Merge branch 'master' of github.com:adafruit/Adafruit_nRF52_Arduino

This commit is contained in:
hathach committed 2017-02-10 16:48:39 +07:00
commit 1129099eb7
6 files changed
+73 -12

No files matched your search

+1 -2
View File
@@ -21,7 +21,7 @@ menu.chip=Chip
menu.lfclk=Low Frequency Clock
menu.board_variant=Board Variant
feather52.name=Adafruit Bluefruit Feather52
feather52.name=Adafruit Bluefruit nRF52 Feather
feather52.vid.0=0x10C4
feather52.pid.0=0xEA60
@@ -68,4 +68,3 @@ feather52.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
#feather52.menu.softdevice.s132.upload.maximum_size=409600
#feather52.menu.softdevice.s132.build.extra_flags=-DNRF52 -DS132 -DNRF51_S132
#feather52.menu.softdevice.s132.build.ldscript=armgcc_s132_nrf52832_xxaa.ld
+9 -4
View File
@@ -76,8 +76,13 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to
}
/*
* Internal Reference is at 1.0v
* External Reference should be between 1v and VDDANA-0.6v=2.7v
* Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4,
* 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels.
*
* External Reference is VDD/4, with an adjustable gain of 1, 2 or 4, meaning
* VDD/4, VDD/2 or VDD for the ADC levels.
*
* Default settings are internal reference with 1/6 gain (GND..3.6V ADC range)
*
* Warning : On Arduino Zero board the input/output voltage for SAMD21G18 is 3.3 volts maximum
*/
@@ -167,9 +172,9 @@ uint32_t analogRead( uint32_t ulPin )
NRF_SAADC->CH[i].PSELN = SAADC_CH_PSELP_PSELP_NC;
NRF_SAADC->CH[i].PSELP = SAADC_CH_PSELP_PSELP_NC;
}
NRF_SAADC->CH[0].CONFIG = ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk)
NRF_SAADC->CH[0].CONFIG = ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk)
| ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk)
| ((SAADC_CH_CONFIG_GAIN_Gain1 << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk)
| ((SAADC_CH_CONFIG_GAIN_Gain1_6 << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk)
| ((saadcReference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk)
| ((SAADC_CH_CONFIG_TACQ_3us << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk)
| ((SAADC_CH_CONFIG_MODE_SE << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk);
@@ -0,0 +1,37 @@
#include <bluefruit.h>
typedef volatile uint32_t REG32;
#define pREG32 (REG32 *)
#define DEVICE_ID_HIGH (*(pREG32 (0x10000060)))
#define DEVICE_ID_LOW (*(pREG32 (0x10000064)))
#define MAC_ADDRESS_HIGH (*(pREG32 (0x100000a8)))
#define MAC_ADDRESS_LOW (*(pREG32 (0x100000a4)))
void setup() {
Serial.begin(115200);
Serial.println("Bluefruit Feather 52 HW Info");
Serial.println("");
// MAC Address
uint32_t addr_high = ((MAC_ADDRESS_HIGH) & 0x0000ffff) | 0x0000c000;
uint32_t addr_low = MAC_ADDRESS_LOW;
Serial.print("MAC Address: ");
Serial.print((addr_high >> 8) & 0xFF, HEX); Serial.print(":");
Serial.print((addr_high) & 0xFF, HEX); Serial.print(":");
Serial.print((addr_low >> 24) & 0xFF, HEX); Serial.print(":");
Serial.print((addr_low >> 16) & 0xFF, HEX); Serial.print(":");
Serial.print((addr_low >> 8) & 0xFF, HEX); Serial.print(":");
Serial.print((addr_low) & 0xFF, HEX); Serial.println("");
// Unique Device ID
Serial.print("Device ID: ");
Serial.print(DEVICE_ID_HIGH, HEX);
Serial.println(DEVICE_ID_LOW, HEX);
}
void loop() {
// put your main code here, to run repeatedly:
}
@@ -17,12 +17,22 @@ BLEDis bledis;
BLEUart bleuart;
BLEBas blebas;
void setup()
#define STATUS_LED (17)
#define BLE_LED (19)
int blinkyms;
void setup()
{
Serial.begin(115200);
Serial.println("Bluefruit52 BLEUART Example");
// Setup LED pins and reset blinky counter
pinMode(STATUS_LED, OUTPUT);
pinMode(BLE_LED, OUTPUT);
blinkyms = millis();
Bluefruit.begin();
Bluefruit.setName("Bluefruit52");
@@ -48,11 +58,11 @@ void setup()
}
void setupAdv(void)
{
{
//Bluefruit.addAdvTxPower();
Bluefruit.addAdvFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.addAdvTxPower();
// Include bleuart 128-bit uuid
Bluefruit.addAdvService(bleuart);
@@ -61,8 +71,15 @@ void setupAdv(void)
Bluefruit.addScanName();
}
void loop()
void loop()
{
// Blinky!
if (blinkyms+500 < millis()) {
blinkyms = millis();
digitalWrite(STATUS_LED, !digitalRead(STATUS_LED));
digitalWrite(BLE_LED, !digitalRead(STATUS_LED));
}
// forward from Serial to BLEUART
if (Serial.available())
{
@@ -82,4 +99,3 @@ void loop()
Serial.write(ch);
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ bootutil_help(int rc)
BOOTUTIL_VER_MINOR,
BOOTUTIL_VER_REVISION);
printf("\n");
#ifndef _WIN32
#ifdef _WIN32
printf("Usage: bootutil.exe -d <TTY.DEVICE> [-c <cmd>] [-ghrv]\n");
#else
printf("Usage: bootutil -d <TTY.DEVICE> [-c <cmd>] [-hrv]\n");
+4
View File
@@ -77,6 +77,10 @@ static const uint8_t A7 = PIN_A7 ;
// Other pins
#define PIN_AREF (24)
#define PIN_DFU (20)
#define PIN_NFC1 (9)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
/*