mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-21 17:27:30 +00:00
Fixed XPT2046 syntax and using unPhone library to clean up support (#3631)
* Fixed XPT2046 syntax and using unPhone library to clean up main and TFTDisplay. * strange extra edits removed wtf
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
; platformio.ini for unphone meshtastic
|
||||
|
||||
[env:unphone]
|
||||
;build_type = debug ; to make it possible to step through our jtag debugger
|
||||
|
||||
extends = esp32s3_base
|
||||
board_level = extra
|
||||
board = unphone9
|
||||
@@ -14,6 +16,15 @@ build_flags = ${esp32_base.build_flags}
|
||||
-D UNPHONE
|
||||
-I variants/unphone
|
||||
-D ARDUINO_USB_MODE=0
|
||||
-D UNPHONE_ACCEL=0
|
||||
-D UNPHONE_TOUCHS=0
|
||||
-D UNPHONE_SDCARD=0
|
||||
-D UNPHONE_UI0=0
|
||||
-D UNPHONE_LORA=0
|
||||
-D UNPHONE_FACTORY_MODE=0
|
||||
|
||||
build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone>
|
||||
|
||||
lib_deps = ${esp32s3_base.lib_deps}
|
||||
lovyan03/LovyanGFX@^1.1.8
|
||||
lovyan03/LovyanGFX @ ^1.1.8
|
||||
https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0
|
||||
20
variants/unphone/variant.cpp
Normal file
20
variants/unphone/variant.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// meshtastic/firmware/variants/unphone/variant.cpp
|
||||
|
||||
#include "unPhone.h"
|
||||
unPhone unphone = unPhone("meshtastic_unphone");
|
||||
|
||||
void initVariant()
|
||||
{
|
||||
unphone.begin(); // initialise hardware etc.
|
||||
unphone.store(unphone.buildTime);
|
||||
unphone.printWakeupReason(); // what woke us up? (stored, not printed :|)
|
||||
unphone.checkPowerSwitch(); // if power switch is off, shutdown
|
||||
unphone.backlight(false); // setup backlight and make sure its off
|
||||
|
||||
for (int i = 0; i < 3; i++) { // buzz a bit
|
||||
unphone.vibe(true);
|
||||
delay(150);
|
||||
unphone.vibe(false);
|
||||
delay(150);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
// meshtastic/firmware/variants/unphone/variant.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SPI_SCK 39
|
||||
#define SPI_MOSI 40
|
||||
#define SPI_MISO 41
|
||||
@@ -28,7 +32,7 @@
|
||||
#define TFT_WIDTH 320
|
||||
#define TFT_OFFSET_X 0
|
||||
#define TFT_OFFSET_Y 0
|
||||
#define TFT_OFFSET_ROTATION 6 // the unPhone's screen is wired unusually, 0 is typical value here
|
||||
#define TFT_OFFSET_ROTATION 6 // unPhone's screen wired unusually, 0 typical
|
||||
#define TFT_INVERT false
|
||||
#define SCREEN_ROTATE true
|
||||
#define SCREEN_TRANSITION_FRAMERATE 5
|
||||
@@ -37,7 +41,10 @@
|
||||
#define USE_XPT2046 1
|
||||
#define TOUCH_CS 38
|
||||
|
||||
#define HAS_GPS 0 // the unphone doesn't have a gps module
|
||||
#define HAS_GPS \
|
||||
0 // the unphone doesn't have a gps module by default (though
|
||||
// GPS featherwing -- https://www.adafruit.com/product/3133
|
||||
// -- can be added)
|
||||
#undef GPS_RX_PIN
|
||||
#undef GPS_TX_PIN
|
||||
|
||||
@@ -49,6 +56,7 @@
|
||||
|
||||
#define BUTTON_PIN 21 // Button 3 - square - top button in landscape mode
|
||||
#define BUTTON_NEED_PULLUP // we do need a helping hand up
|
||||
#define BUTTON_PIN_ALT 45 // Button 1 - triangle - bottom button in landscape mode
|
||||
|
||||
#define I2C_SDA 3 // I2C pins for this board
|
||||
#define I2C_SCL 4
|
||||
@@ -58,6 +66,6 @@
|
||||
// ratio of voltage divider = 3.20 (R1=100k, R2=220k)
|
||||
// #define ADC_MULTIPLIER 3.2
|
||||
|
||||
// #define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||
// #define BATTERY_PIN 13 // battery V measurement pin; vbat divider is here
|
||||
// #define ADC_CHANNEL ADC2_GPIO13_CHANNEL
|
||||
// #define BAT_MEASURE_ADC_UNIT 2
|
||||
Reference in New Issue
Block a user