add support for adafruit feather nrf52832 - which is close to a RAK815

1.2-legacy
geeksville 2020-07-09 21:27:34 -07:00
rodzic 6954d0d5f4
commit 80b14c0a6f
8 zmienionych plików z 33 dodań i 16 usunięć

Wyświetl plik

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = nrf52840dk ; Note: the github actions CI test build can't yet build NRF52 targets
default_envs = feather_nrf52832 ; Note: the github actions CI test build can't yet build NRF52 targets
[common]
; common is not currently used
@ -178,6 +178,11 @@ board = nrf52840_dk
extends = nrf52_base
board = nrf52840_dk_modified
; Note: By default no lora device is created for this build - it uses a simulated interface
[env:feather_nrf52832]
extends = nrf52_base
board = adafruit_feather_nrf52832
# For experimenting with RAM sizes
# board_build.ldscript = linker/nrf52840_s140_sim832.ld

Wyświetl plik

@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/// Convert a preprocessor name into a quoted string and if that string is empty use "unset"
#define optstr(s) (xstr(s)[0] ? xstr(s) : "unset")
#ifdef NRF52840_XXAA // All of the NRF52 targets are configured using variant.h, so this section shouldn't need to be
#ifdef NRF52_SERIES // All of the NRF52 targets are configured using variant.h, so this section shouldn't need to be
// board specific
//
@ -74,7 +74,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RTC_DATA_ATTR
#define LED_PIN PIN_LED1 // LED1 on nrf52840-DK
// If the variant filed defines as standard button
#ifdef PIN_BUTTON1
#define BUTTON_PIN PIN_BUTTON1
#endif
// FIXME, use variant.h defs for all of this!!! (even on the ESP32 targets)
#elif defined(CubeCell_BoardPlus)
@ -283,6 +287,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define HW_VENDOR "ppr"
#elif NRF52_SERIES
#define HW_VENDOR "nrf52unknown" // FIXME - unknown nrf52 board
#endif
// -----------------------------------------------------------------------------

Wyświetl plik

@ -7,10 +7,12 @@
#ifdef GPS_RX_PIN
HardwareSerial _serial_gps_real(GPS_SERIAL_NUM);
HardwareSerial &GPS::_serial_gps = _serial_gps_real;
HardwareSerial *GPS::_serial_gps = &_serial_gps_real;
#elif defined(NRF52840_XXAA)
// Assume NRF52840
HardwareSerial *GPS::_serial_gps = &Serial1;
#else
// Assume NRF52
HardwareSerial &GPS::_serial_gps = Serial1;
HardwareSerial *GPS::_serial_gps = NULL;
#endif
bool timeSetFromGPS; // We try to set our time from GPS each time we wake from sleep

Wyświetl plik

@ -30,7 +30,7 @@ class GPS : public Observable<void *>
protected:
bool hasValidLocation = false; // default to false, until we complete our first read
static HardwareSerial &_serial_gps;
static HardwareSerial *_serial_gps;
public:
int32_t latitude = 0, longitude = 0; // as an int mult by 1e-7 to get value as double

Wyświetl plik

@ -13,9 +13,8 @@ static int32_t toDegInt(RawDegrees d)
void NEMAGPS::loop()
{
while (_serial_gps.available() > 0) {
int c = _serial_gps.read();
while (_serial_gps->available() > 0) {
int c = _serial_gps->read();
// Serial.write(c);
reader.encode(c);
}

Wyświetl plik

@ -10,20 +10,20 @@ UBloxGPS::UBloxGPS() : concurrency::PeriodicTask()
bool UBloxGPS::setup()
{
#ifdef GPS_RX_PIN
_serial_gps.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
#else
_serial_gps.begin(GPS_BAUDRATE);
_serial_gps->begin(GPS_BAUDRATE);
#endif
// _serial_gps.setRxBufferSize(1024); // the default is 256
// ublox.enableDebugging(Serial);
// note: the lib's implementation has the wrong docs for what the return val is
// it is not a bool, it returns zero for success
isConnected = ublox.begin(_serial_gps);
isConnected = ublox.begin(*_serial_gps);
// try a second time, the ublox lib serial parsing is buggy?
if (!isConnected)
isConnected = ublox.begin(_serial_gps);
isConnected = ublox.begin(*_serial_gps);
if (isConnected) {
DEBUG_MSG("Connected to UBLOX GPS successfully\n");
@ -35,7 +35,7 @@ bool UBloxGPS::setup()
// GPS_TX connected)
ublox.factoryReset();
delay(3000);
isConnected = ublox.begin(_serial_gps);
isConnected = ublox.begin(*_serial_gps);
DEBUG_MSG("Factory reset success=%d\n", isConnected);
ok = ublox.saveConfiguration(3000);
assert(ok);

Wyświetl plik

@ -172,7 +172,7 @@ void initWifi()
}
}
}
} else
} else
DEBUG_MSG("Not using WIFI\n");
#endif
}

Wyświetl plik

@ -3,7 +3,10 @@
#include <assert.h>
#include <ble_gap.h>
#include <memory.h>
#include <nrf52840.h>
#ifdef NRF52840_XXAA
// #include <nrf52840.h>
#endif
// #define USE_SOFTDEVICE