Skip to content

Commit 26fe314

Browse files
committed
Arduino Nesso N1 support
1 parent de26dfe commit 26fe314

File tree

12 files changed

+308
-7
lines changed

12 files changed

+308
-7
lines changed

src/detect/ScanI2CTwoWire.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
298298
type = AHT10;
299299
break;
300300
#endif
301-
#if !defined(M5STACK_UNITC6L)
301+
#if !defined(M5STACK_UNITC6L) && !defined(ARDUINO_NESSO_N1)
302302
case INA_ADDR:
303303
case INA_ADDR_ALTERNATE:
304304
case INA_ADDR_WAVESHARE_UPS:

src/graphics/TFTDisplay.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
extern SX1509 gpioExtender;
1616
#endif
1717

18+
#ifdef TFT_BL_EXT
19+
#include "GpioExtLogic.h"
20+
#endif
21+
1822
#ifdef TFT_MESH_OVERRIDE
1923
uint16_t TFT_MESH = TFT_MESH_OVERRIDE;
2024
#else
@@ -479,7 +483,7 @@ class LGFX : public lgfx::LGFX_Device
479483
lgfx::Bus_SPI _bus_instance;
480484
lgfx::Light_PWM _light_instance;
481485
#if HAS_TOUCHSCREEN
482-
#if defined(T_WATCH_S3) || defined(ELECROW)
486+
#if defined(T_WATCH_S3) || defined(ELECROW) || defined(ARDUINO_NESSO_N1)
483487
lgfx::Touch_FT5x06 _touch_instance;
484488
#elif defined(HELTEC_V4_TFT)
485489
lgfx::TOUCH_CHSC6X _touch_instance;
@@ -1160,6 +1164,9 @@ TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY g
11601164
virtPin, p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio
11611165
p = virtPin;
11621166
}
1167+
#elif defined(TFT_BL_EXT)
1168+
#include "GpioExtLogic.h"
1169+
GpioPin *p = new GpioExtPin(TFT_BL_EXT);
11631170
#else
11641171
GpioPin *p = new GpioVirtPin(); // Just simulate a pin
11651172
#endif

src/input/i2cButton.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "meshUtils.h"
33

44
#include "configuration.h"
5-
#if defined(M5STACK_UNITC6L)
5+
#if defined(M5STACK_UNITC6L) || defined(ARDUINO_NESSO_N1)
66

77
#include "MeshService.h"
88
#include "RadioLibInterface.h"
@@ -92,4 +92,4 @@ int32_t i2cButtonThread::runOnce()
9292
}
9393
return 50;
9494
}
95-
#endif
95+
#endif

src/input/i2cButton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "OneButton.h"
55
#include "concurrency/OSThread.h"
66
#include "configuration.h"
7-
#if defined(M5STACK_UNITC6L)
7+
#if defined(M5STACK_UNITC6L) || defined(ARDUINO_NESSO_N1)
88

99
class i2cButtonThread : public Observable<const InputEvent *>, public concurrency::OSThread
1010
{

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void setup()
563563
#endif
564564
#endif
565565

566-
#if defined(M5STACK_UNITC6L)
566+
#if defined(M5STACK_UNITC6L) || defined(ARDUINO_NESSO_N1)
567567
pinMode(LORA_CS, OUTPUT);
568568
digitalWrite(LORA_CS, 1);
569569
c6l_init();

src/modules/Modules.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void setupModules()
203203
#endif
204204
cardKbI2cImpl = new CardKbI2cImpl();
205205
cardKbI2cImpl->init();
206-
#if defined(M5STACK_UNITC6L)
206+
#if defined(M5STACK_UNITC6L) || defined(ARDUINO_NESSO_N1)
207207
i2cButton = new i2cButtonThread("i2cButtonThread");
208208
#endif
209209
#ifdef INPUTBROKER_MATRIX_TYPE
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "GpioExtLogic.h"
2+
#include <assert.h>
3+
4+
void GpioExtPin::set(bool value)
5+
{
6+
gpio_ext_set(this->address, this->pin, value);
7+
}
8+
9+
uint8_t GpioExtPin::get()
10+
{
11+
return gpio_ext_get(this->address, this->pin);
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "GpioLogic.h"
2+
3+
class GpioExtPin : public GpioPin
4+
{
5+
uint32_t num;
6+
7+
public:
8+
GpioExtPin(uint16_t _pin) : pin(_pin & 0x3F), address(_pin & 0x100 ? 0x44 : 0x43){};
9+
uint8_t pin;
10+
uint8_t address;
11+
12+
void set(bool value);
13+
uint8_t get();
14+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x303A
7+
#define USB_PID 0x1001
8+
9+
static const uint8_t TX = -1;
10+
static const uint8_t RX = -1;
11+
12+
static const uint8_t SDA = 10;
13+
static const uint8_t SCL = 8;
14+
15+
// Default SPI will be mapped to Radio
16+
static const uint8_t MOSI = 21;
17+
static const uint8_t MISO = 22;
18+
static const uint8_t SCK = 20;
19+
static const uint8_t SS = 23;
20+
21+
#endif /* Pins_Arduino_h */
22+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[env:arduino-nesso-n1]
2+
extends = esp32c6_base
3+
board = esp32-c6-devkitc-1
4+
upload_protocol = esptool
5+
build_unflags =
6+
-D HAS_BLUETOOTH
7+
-D MESHTASTIC_EXCLUDE_BLUETOOTH
8+
-D HAS_WIFI
9+
lib_deps =
10+
${esp32c6_base.lib_deps}
11+
h2zero/NimBLE-Arduino@^2.3.6
12+
lovyan03/LovyanGFX@^1.2.0
13+
https://github.com/mverch67/BQ27220/archive/07d92be846abd8a0258a50c23198dac0858b22ed.zip
14+
build_flags =
15+
${esp32c6_base.build_flags}
16+
-D PRIVATE_HW
17+
-D ARDUINO_NESSO_N1
18+
-I variants/esp32c6/arduino_nesso_n1
19+
-DMESHTASTIC_EXCLUDE_PAXCOUNTER=1
20+
-DSOC_USB_OTG_SUPPORTED=1
21+
-DARDUINO_USB_CDC_ON_BOOT=1
22+
-DARDUINO_USB_MODE=1
23+
-D HAS_BLUETOOTH=1
24+
-D MESHTASTIC_EXCLUDE_WEBSERVER
25+
-D MESHTASTIC_EXCLUDE_MQTT
26+
-DCONFIG_BT_NIMBLE_EXT_ADV=1
27+
-DCONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=2
28+
-D NIMBLE_TWO
29+
-D CORE_DEBUG_LEVEL=5
30+
-D _ESP_LOGLEVEL_=5
31+
monitor_speed=115200
32+
lib_ignore =
33+
NonBlockingRTTTL
34+
libpax
35+
build_src_filter =
36+
${esp32c6_base.build_src_filter} +<../variants/esp32c6/arduino_nesso_n1>

0 commit comments

Comments
 (0)