Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions boards/lilygo_t_impulse_plus_nrf52840.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"build": {
"arduino":{
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_T_IMPULSE_PLUS -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
[
"0x239A",
"0x8029"
]
],
"usb_product": "T-Impulse-Plus-nRF52840",
"mcu": "nrf52840",
"variant": "t_impulse_plus_nrf52840",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"onboard_tools": [
"jlink"
],
"svd_path": "nrf52840.svd"
},
"frameworks": [
"arduino"
],
"name": "Lilygo T-Impulse-Plus-nRF52840",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"stlink",
"cmsis-dap",
"blackmagic"
],
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.lilygo.cc/",
"vendor": "Lilygo"
}
39 changes: 39 additions & 0 deletions variants/lilygo_t_impulse_plus/TImpulsePlusBoard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <Arduino.h>
#include <Wire.h>

#include "TImpulsePlusBoard.h"

void TImpulsePlusBoard::begin() {
NRF52BoardDCDC::begin();

// turn on 3.3v
pinMode(RT9080_EN, OUTPUT);
digitalWrite(RT9080_EN, HIGH);
delay(100);

// init gps pins
pinMode(GPS_EN, OUTPUT);
digitalWrite(GPS_EN, HIGH); // gps off by default

// configure battery measurement
pinMode(BATTERY_ADC_DATA, INPUT);
pinMode(BATTERY_MEASUREMENT_CONTROL, OUTPUT);
digitalWrite(BATTERY_MEASUREMENT_CONTROL, LOW); // turn off battery voltage measurement

// set the analog reference to 3.0V (default = 3.6V)
analogReference(AR_INTERNAL_3_0);

// set the resolution to 12-bit (0..4095)
analogReadResolution(12); // Can be 8, 10, 12 or 14

// configure user button
pinMode(TTP223_KEY, INPUT_PULLDOWN);

#if defined(PIN_WIRE_SDA) && defined(PIN_WIRE_SCL)
Wire.setPins(PIN_WIRE_SDA, PIN_WIRE_SCL);
#endif

Wire.begin();

delay(10); // give sx1262 some time to power up
}
59 changes: 59 additions & 0 deletions variants/lilygo_t_impulse_plus/TImpulsePlusBoard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#pragma once

#include <MeshCore.h>
#include <Arduino.h>
#include <helpers/NRF52Board.h>

class TImpulsePlusBoard : public NRF52BoardDCDC {
protected:
uint8_t btn_prev_state;

public:
TImpulsePlusBoard() : NRF52Board("T-Impulse-Plus OTA") {}
void begin();

#if defined(P_LORA_TX_LED)
void onBeforeTransmit() override {
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
}
void onAfterTransmit() override {
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
}
#endif

uint16_t getBattMilliVolts() override {
// enable battery voltage measurement
digitalWrite(BATTERY_MEASUREMENT_CONTROL, HIGH);
delay(100);

analogReadResolution(12);
analogReference(AR_INTERNAL);
delay(10);

// read battery voltage
int adcvalue = 0;
analogReadResolution(12);
analogReference(AR_INTERNAL_3_0);
delay(10);
adcvalue = analogRead(BATTERY_ADC_DATA);

// disable battery voltage measurement
digitalWrite(BATTERY_MEASUREMENT_CONTROL, LOW);

return ((adcvalue * ((3000.0 / 4096.0)))) * 2.0;
}

const char* getManufacturerName() const override {
return "LilyGo T-Impulse-Plus";
}

void powerOff() override {

// turn off 3.3v
digitalWrite(RT9080_EN, LOW);

// power off system
sd_power_system_off();

}
};
73 changes: 73 additions & 0 deletions variants/lilygo_t_impulse_plus/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[LilyGo_T_Impulse_Plus]
extends = nrf52_base
board = lilygo_t_impulse_plus_nrf52840
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/lilygo_t_impulse_plus
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
-D PIN_USER_BTN=-1
; -D PIN_USER_BTN=TTP223_KEY ; leave button disabled until screen implemented
; -D USER_BTN_PRESSED=HIGH
-D PIN_WIRE_SDA=SCREEN_SDA
-D PIN_WIRE_SCL=SCREEN_SCL
-D ENV_PIN_SDA=IIC_SDA_2 ; firmware hangs without this
-D ENV_PIN_SCL=IIC_SCL_2 ; firmware hangs without this
build_src_filter = ${nrf52_base.build_src_filter}
+<TImpulsePlusBoard.cpp>
+<../variants/lilygo_t_impulse_plus>
+<helpers/ui/SSD1306Display.cpp>
+<helpers/sensors>
lib_deps= ${nrf52_base.lib_deps}
${sensor_base.lib_deps}
adafruit/Adafruit SSD1306 @ ^2.5.13
adafruit/Adafruit GFX Library @ ^1.12.1

[env:LilyGo_T_Impulse_Plus_repeater]
extends = LilyGo_T_Impulse_Plus
build_src_filter = ${LilyGo_T_Impulse_Plus.build_src_filter}
+<../examples/simple_repeater>
build_flags =
${LilyGo_T_Impulse_Plus.build_flags}
-D ADVERT_NAME='"T-Impulse-Plus Repeater"'
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps = ${LilyGo_T_Impulse_Plus.lib_deps}
adafruit/RTClib @ ^2.1.3

[env:LilyGo_T_Impulse_Plus_companion_radio_ble]
extends = LilyGo_T_Impulse_Plus
; board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
; board_upload.maximum_size = 712704
build_flags =
${LilyGo_T_Impulse_Plus.build_flags}
-I src/helpers/ui
-I examples/companion_radio/ui-new
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D QSPIFLASH=1
-D BLE_PIN_CODE=123456
-D OFFLINE_QUEUE_SIZE=256
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_T_Impulse_Plus.build_src_filter}
+<helpers/nrf52/SerialBLEInterface.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_T_Impulse_Plus.lib_deps}
densaugeo/base64 @ ~1.4.0

[env:LilyGo_T_Impulse_Plus_kiss_modem]
extends = LilyGo_T_Impulse_Plus
build_src_filter = ${LilyGo_T_Impulse_Plus.build_src_filter}
+<../examples/kiss_modem/>
37 changes: 37 additions & 0 deletions variants/lilygo_t_impulse_plus/target.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <Arduino.h>
#include "target.h"
#include <helpers/ArduinoHelpers.h>
#include <helpers/sensors/MicroNMEALocationProvider.h>

TImpulsePlusBoard board;

RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);

WRAPPER_CLASS radio_driver(radio, board);

VolatileRTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);

#ifdef ENV_INCLUDE_GPS
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
#else
EnvironmentSensorManager sensors = EnvironmentSensorManager();
#endif

#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
#endif

bool radio_init() {
rtc_clock.begin(Wire);

return radio.std_init(&SPI);
}

mesh::LocalIdentity radio_new_identity() {
RadioNoiseListener rng(radio);
return mesh::LocalIdentity(&rng); // create new random identity
}

27 changes: 27 additions & 0 deletions variants/lilygo_t_impulse_plus/target.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <TImpulsePlusBoard.h>
#include <helpers/radiolib/CustomSX1262Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/ArduinoHelpers.h>
#include <helpers/sensors/EnvironmentSensorManager.h>
#ifdef DISPLAY_CLASS
#include <helpers/ui/SSD1306Display.h>
#include <helpers/ui/MomentaryButton.h>
#endif

extern TImpulsePlusBoard board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
extern EnvironmentSensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
#endif

bool radio_init();
mesh::LocalIdentity radio_new_identity();

43 changes: 43 additions & 0 deletions variants/lilygo_t_impulse_plus/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
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 "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"

const uint32_t g_ADigitalPinMap[] =
{
// P0
0 , 1 , 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()
{

}
Loading
Loading