Skip to content
Open

Dev #2349

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
1 change: 1 addition & 0 deletions .github/workflows/PR_All_envs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
- { env: "lilygo-t-hmi", family: "ESP32-S3",}
- { env: "lilygo-t-lora-pager", family: "ESP32-S3",}
- { env: "smoochiee-board", family: "ESP32-S3",}
- { env: "S3_supermini_madara", family: "ESP32-S3",}
- { env: "Phantom_S024R", family: "ESP32",}
- { env: "LAUNCHER_Phantom_S024R", family: "ESP32",}
- { env: "Marauder-Mini", family: "ESP32",}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buil_parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- { env: "lilygo-t-hmi", family: "ESP32-S3",}
- { env: "lilygo-t-lora-pager", family: "ESP32-S3",}
- { env: "smoochiee-board", family: "ESP32-S3",}
- { env: "S3_supermini_madara", family: "ESP32-S3",}
- { env: "Phantom_S024R", family: "ESP32",}
- { env: "LAUNCHER_Phantom_S024R", family: "ESP32",}
- { env: "Marauder-Mini", family: "ESP32",}
Expand Down
32 changes: 32 additions & 0 deletions boards/S3_supermini_madara/S3_supermini_madara.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html


[env:S3_supermini_madara]
board = S3_supermini_madara
build_src_filter =${env.build_src_filter} +<../boards/S3_supermini_madara>
board_build.arduino.memory_type = qio_qspi
board_build.partitions = custom_4Mb_fullv2.csv
build_flags =
${env.build_flags}
-Iboards/S3_supermini_madara
-Os
-DCORE_DEBUG_LEVEL=1
-DRF_TX_PINS='{{"Pin 4", 4}, {"Pin 5", 5}}'
-DRF_RX_PINS='{{"Pin 4", 4}, {"Pin 5", 5}}'
-DIR_TX_PINS='{{"Pin 4", 4}, {"Pin 5", 5}}'
-DIR_RX_PINS='{{"Pin 4", 4}, {"Pin 5", 5}}'
;Have buzzer
-DBUZZ_PIN=47
-D USE_HSPI_PORT=1
-DDEVICE_NAME='"Madara Board"'

lib_deps =
${env.lib_deps}
89 changes: 89 additions & 0 deletions boards/S3_supermini_madara/interface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include "core/powerSave.h"
#include <interface.h>

/***************************************************************************************
** Function name: _setup_gpio()
** Location: main.cpp
** Description: initial setup for the device
***************************************************************************************/

void _setup_gpio() {
pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH);
pinMode(TFT_MOSI, OUTPUT);
digitalWrite(TFT_MOSI, HIGH);
pinMode(TFT_SCLK, OUTPUT);

pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
pinMode(TFT_RST, OUTPUT);
pinMode(TFT_DC, OUTPUT);
digitalWrite(TFT_DC, HIGH);

pinMode(UP_BTN, INPUT_PULLUP);
pinMode(SEL_BTN, INPUT_PULLUP);
pinMode(DW_BTN, INPUT_PULLUP);

pinMode(NRF24_SS_PIN, OUTPUT);
pinMode(CC1101_SS_PIN, OUTPUT);
pinMode(SDCARD_CS, OUTPUT);
pinMode(TFT_CS, OUTPUT);

digitalWrite(NRF24_SS_PIN, HIGH);
digitalWrite(CC1101_SS_PIN, HIGH);
digitalWrite(SDCARD_CS, HIGH);
digitalWrite(TFT_CS, HIGH);
}

bool isCharging() { return false; }

int getBattery() { return 0; }
/*********************************************************************
** Function: setBrightness
** location: settings.cpp
** set brightness value
**********************************************************************/
void _setBrightness(uint8_t brightval) {
if (brightval == 0) {
analogWrite(TFT_BL, brightval);
} else {
int bl = MINBRIGHT + round(((255 - MINBRIGHT) * brightval / 100));
analogWrite(TFT_BL, bl);
}
}

/*********************************************************************
** Function: InputHandler
** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
**********************************************************************/
void InputHandler(void) {
static unsigned long tm = 0;
if (millis() - tm < 200 && !LongPress) return;
bool upPressed = (digitalRead(UP_BTN) == LOW);
bool selPressed = (digitalRead(SEL_BTN) == LOW);
bool dwPressed = (digitalRead(DW_BTN) == LOW);

bool anyPressed = upPressed || selPressed || dwPressed;
if (anyPressed) tm = millis();
if (anyPressed && wakeUpScreen()) return;

AnyKeyPress = anyPressed;
PrevPress = upPressed;
EscPress = upPressed && dwPressed;
NextPress = dwPressed;
SelPress = selPressed;
}

/*********************************************************************
** Function: powerOff
** location: mykeyboard.cpp
** Turns off the device (or try to)
**********************************************************************/
void powerOff() {}

/*********************************************************************
** Function: checkReboot
** location: mykeyboard.cpp
** Btn logic to turn off the device (name is odd btw)
**********************************************************************/
void checkReboot() {}
109 changes: 109 additions & 0 deletions boards/S3_supermini_madara/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include "soc/soc_caps.h"
#include <stdint.h>

static const uint8_t TX = 4;
static const uint8_t RX = 5;

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;

// Modified elsewhere
static const uint8_t SS = 6;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 8;
static const uint8_t SCK = 10;

#define SPI_SCK_PIN 10
#define SPI_MOSI_PIN 11
#define SPI_MISO_PIN 8

#define SERIAL_RX 5
#define SERIAL_TX 4
#define BAD_RX SERIAL_RX
#define BAD_TX SERIAL_TX
#define GPS_SERIAL_TX SERIAL_TX
#define GPS_SERIAL_RX SERIAL_RX
#define USB_as_HID 1

#define BTN_ALIAS "\"OK\""
#define HAS_3_BUTTONS
#define SEL_BTN 1
#define DW_BTN 2
#define UP_BTN 3
#define BTN_ACT LOW
#define DEEPSLEEP_WAKEUP_PIN SEL_BTN

#define RXLED 4
#define TXLED 5
#define LED_ON HIGH
#define LED_OFF LOW

#define USE_CC1101_VIA_SPI
#define CC1101_GDO0_PIN 16
#define CC1101_SS_PIN 17
#define CC1101_MOSI_PIN SPI_MOSI_PIN
#define CC1101_SCK_PIN SPI_SCK_PIN
#define CC1101_MISO_PIN SPI_MISO_PIN

#define USE_NRF24_VIA_SPI
#define NRF24_CE_PIN 21
#define NRF24_SS_PIN 18
#define NRF24_MOSI_PIN SPI_MOSI_PIN
#define NRF24_SCK_PIN SPI_SCK_PIN
#define NRF24_MISO_PIN SPI_MISO_PIN

#define FP 1
#define FM 2
#define FG 3

#define HAS_SCREEN 1
#define ROTATION 1
#define MINBRIGHT (uint8_t)1

#define USER_SETUP_LOADED 1
#define ST7789_DRIVER 1
#define TFT_RGB_ORDER 0
#define TFT_WIDTH 240
#define TFT_HEIGHT 280
#define TFT_BACKLIGHT_ON 1
#define TFT_BL 43
#define TFT_RST 12
#define TFT_DC 13
#define TFT_MISO 8
#define TFT_MOSI 11
#define TFT_SCLK 10
#define TFT_CS 44
#define TOUCH_CS -1
#define SMOOTH_FONT 1
#define SPI_FREQUENCY 20000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000

#define SDCARD_CS 7
#define SDCARD_SCK 10
#define SDCARD_MISO 8
#define SDCARD_MOSI 11

#define GROVE_SDA 4
#define GROVE_SCL 5

#define SPI_SCK_PIN 10
#define SPI_MOSI_PIN 11
#define SPI_MISO_PIN 8
#define SPI_SS_PIN 6

// RGB LED

#define HAS_RGB_LED 1
#define RGB_LED 48
#define LED_TYPE WS2812B
#define LED_ORDER GRB
#define LED_TYPE_IS_RGBW 0
#define LED_COUNT 16

#define LED_COLOR_STEP 15

#endif /* Pins_Arduino_h */
49 changes: 49 additions & 0 deletions boards/_boards_json/S3_supermini_madara.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "custom_4Mb_fullv2.csv"
},
"core": "esp32",
"extra_flags": [
"-DMADARA_BOARD",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1",
"-DARDUINO_USB_CDC_ON_BOOT",
"-DARDUINO_USB_MODE=1",
"-DBOARD_HAS_PSRAM"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "pinouts"
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Madara Board",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.m5stack.com/en/core/StampS3",
"vendor": "Madara"
}
2 changes: 2 additions & 0 deletions boards/pinouts/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@
#include "../lilygo-t-hmi/pins_arduino.h"
#elif ESP32C5_DEVKITC_1
#include "../ESP32-C5/pins_arduino.h"
#elif MADARA_BOARD
#include "../S3_supermini_madara/pins_arduino.h"
#endif
4 changes: 4 additions & 0 deletions custom_4Mb_fullv2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
app0, app, ota_0, 0x10000, 0x3B0000,
spiffs, data, spiffs, 0x3C0000, 0x40000,
4 changes: 3 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ default_envs =
;LAUNCHER_Marauder-V4-V6
;LAUNCHER_Marauder-v61
;Awok-Touch"
;esp32-c5
;esp32-c5
;S3_supermini_madara


;uncomment to not use global dirs to avoid possible conflicts
;platforms_dir = .pio/platforms
Expand Down