Compare commits

...

1 Commits

Author SHA1 Message Date
Ben Meadors
8d5dbdbdbf WIP 2025-11-20 06:13:32 -06:00
3 changed files with 185 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
; Elecrow ThinkNode M4 (nRF52840 + LR1110)
[env:thinknode_m4]
extends = nrf52840_base
board = ThinkNode-M4
board_check = true
debug_tool = jlink
build_flags = ${nrf52840_base.build_flags}
-Ivariants/nrf52840/ELECROW-ThinkNode-M4
-DELECROW_ThinkNode_M4
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/ELECROW-ThinkNode-M4>
lib_deps =
${nrf52840_base.lib_deps}
lewisxhe/PCF8563_Library@^1.0.1

View File

@@ -0,0 +1,47 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "nrf.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
const uint32_t g_ADigitalPinMap[] = {
// P0 - pins 0 and 1 are hardwired for xtal and should never be enabled
0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
// P1
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
void initVariant()
{
#if (PIN_LED1 >= 0)
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
#endif
#if (PIN_LED2 >= 0)
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
#endif
#if (PIN_LED3 >= 0)
pinMode(PIN_LED3, OUTPUT);
ledOff(PIN_LED3);
#endif
}

View File

@@ -0,0 +1,122 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_ELECROW_THINKNODE_M4_
#define _VARIANT_ELECROW_THINKNODE_M4_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32 kHz crystal for LF domain
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
#define NUM_ANALOG_INPUTS (6)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (32 + 9) // P1.09, status LED (blue)
#define PIN_LED2 -1
#define PIN_LED3 -1
#define LED_BUILTIN PIN_LED1
#define LED_STATE_ON 0 // active-low LED drive
// Buttons
#define PIN_BUTTON1 (0 + 4) // P0.04 KEY input
// USB / power detection
#define EXT_PWR_DETECT (32 + 3) // P1.03 USB present sense
// I2C bus
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (32 + 0) // P1.00 SDA1
#define PIN_WIRE_SCL (32 + 5) // P1.05 SCL1
// Analog pins
#define PIN_A0 (2) // P0.02
#define BATTERY_PIN PIN_A0
#define BATTERY_SENSE_SAMPLES 30
#define ADC_RESOLUTION 14
#define BATTERY_SENSE_RESOLUTION_BITS 12
#define BATTERY_SENSE_RESOLUTION 4096.0
#define ADC_MULTIPLIER (2.00F)
#undef AREF_VOLTAGE
#define AREF_VOLTAGE 3.0
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
// GPS interface (L76K)
#define HAS_GPS 1
#define GPS_L76K
#define GPS_BAUDRATE 9600
#define PIN_GPS_REINIT (0 + 3) // P0.03 GPS_RST
#define PIN_GPS_STANDBY (0 + 28) // P0.28 GPS_STANDBY
#define PIN_GPS_EN (32 + 11) // P1.11 GPS_EN
#define GPS_EN_ACTIVE HIGH
#define GPS_TX_PIN (32 + 12) // P1.12 GPS_TX -> MCU RX
#define GPS_RX_PIN (32 + 14) // P1.14 GPS_RX -> MCU TX
#define PIN_SERIAL1_RX GPS_TX_PIN
#define PIN_SERIAL1_TX GPS_RX_PIN
#define GPS_THREAD_INTERVAL 50
// LoRa (LR1110) SPI bus
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (0 + 8) // P0.08
#define PIN_SPI_MOSI (0 + 7) // P0.07
#define PIN_SPI_SCK (0 + 6) // P0.06
#define PIN_SPI_NSS (0 + 27) // P0.27
#define LORA_CS PIN_SPI_NSS
#define LORA_SCK PIN_SPI_SCK
#define LORA_MISO PIN_SPI_MISO
#define LORA_MOSI PIN_SPI_MOSI
#define LORA_RESET (32 + 8) // P1.08 LR_NRESET
#define LORA_DIO1 (0 + 24) // P0.24 LR_DIO1 / IRQ
#define LORA_DIO2 (0 + 26) // P0.26 LR_BUSY (treated as DIO2)
#define USE_LR1110
#define LR1110_IRQ_PIN LORA_DIO1
#define LR1110_NRESET_PIN LORA_RESET
#define LR1110_BUSY_PIN LORA_DIO2
#define LR1110_SPI_NSS_PIN LORA_CS
#define LR1110_SPI_SCK_PIN LORA_SCK
#define LR1110_SPI_MOSI_PIN LORA_MOSI
#define LR1110_SPI_MISO_PIN LORA_MISO
#define LR11X0_DIO3_TCXO_VOLTAGE 3.3f
#define LR11X0_DIO_AS_RF_SWITCH
// Peripheral power control
#define PIN_POWER_EN (0 + 11) // P0.11 PERIPH_EN
#ifdef __cplusplus
}
#endif
#endif // _VARIANT_ELECROW_THINKNODE_M4_