Skip to content

Commit

Permalink
add TAMC Termod S3 (#7217)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
  • Loading branch information
TAMCTec and P-R-O-C-H-Y authored Sep 6, 2022
1 parent 1065e38 commit 4959b7f
Show file tree
Hide file tree
Showing 3 changed files with 362 additions and 0 deletions.
207 changes: 207 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16196,6 +16196,213 @@ franzininho_wifi_msc_esp32s2.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

tamc_termod_s3.name=TAMC Termod S3
tamc_termod_s3.vid.0=0x303a
tamc_termod_s3.pid.0=0x1001

tamc_termod_s3.bootloader.tool=esptool_py
tamc_termod_s3.bootloader.tool.default=esptool_py

tamc_termod_s3.upload.tool=esptool_py
tamc_termod_s3.upload.tool.default=esptool_py
tamc_termod_s3.upload.tool.network=esp_ota

tamc_termod_s3.upload.maximum_size=1310720
tamc_termod_s3.upload.maximum_data_size=327680
tamc_termod_s3.upload.flags=
tamc_termod_s3.upload.extra_flags=
tamc_termod_s3.upload.use_1200bps_touch=false
tamc_termod_s3.upload.wait_for_upload_port=false

tamc_termod_s3.serial.disableDTR=false
tamc_termod_s3.serial.disableRTS=false

tamc_termod_s3.build.tarch=xtensa
tamc_termod_s3.build.bootloader_addr=0x0
tamc_termod_s3.build.target=esp32s3
tamc_termod_s3.build.mcu=esp32s3
tamc_termod_s3.build.core=esp32
tamc_termod_s3.build.variant=tamc_termod_s3
tamc_termod_s3.build.board=TAMC_TERMOD_S3

tamc_termod_s3.build.usb_mode=1
tamc_termod_s3.build.cdc_on_boot=1
tamc_termod_s3.build.msc_on_boot=0
tamc_termod_s3.build.dfu_on_boot=0
tamc_termod_s3.build.f_cpu=240000000L
tamc_termod_s3.build.flash_size=8MB
tamc_termod_s3.build.flash_freq=80m
tamc_termod_s3.build.flash_mode=dio
tamc_termod_s3.build.boot=qio
tamc_termod_s3.build.boot_freq=80m
tamc_termod_s3.build.partitions=default
tamc_termod_s3.build.defines=
tamc_termod_s3.build.loop_core=
tamc_termod_s3.build.event_core=
tamc_termod_s3.build.psram_type=qspi
tamc_termod_s3.build.memory_type={build.boot}_{build.psram_type}

tamc_termod_s3.menu.PSRAM.enabled=QSPI PSRAM
tamc_termod_s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
tamc_termod_s3.menu.PSRAM.enabled.build.psram_type=qspi
tamc_termod_s3.menu.PSRAM.disabled=Disabled
tamc_termod_s3.menu.PSRAM.disabled.build.defines=
tamc_termod_s3.menu.PSRAM.disabled.build.psram_type=qspi
tamc_termod_s3.menu.PSRAM.opi=OPI PSRAM
tamc_termod_s3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM
tamc_termod_s3.menu.PSRAM.opi.build.psram_type=opi

tamc_termod_s3.menu.FlashMode.qio=QIO 80MHz
tamc_termod_s3.menu.FlashMode.qio.build.flash_mode=dio
tamc_termod_s3.menu.FlashMode.qio.build.boot=qio
tamc_termod_s3.menu.FlashMode.qio.build.boot_freq=80m
tamc_termod_s3.menu.FlashMode.qio.build.flash_freq=80m
tamc_termod_s3.menu.FlashMode.qio120=QIO 120MHz
tamc_termod_s3.menu.FlashMode.qio120.build.flash_mode=dio
tamc_termod_s3.menu.FlashMode.qio120.build.boot=qio
tamc_termod_s3.menu.FlashMode.qio120.build.boot_freq=120m
tamc_termod_s3.menu.FlashMode.qio120.build.flash_freq=80m
tamc_termod_s3.menu.FlashMode.dio=DIO 80MHz
tamc_termod_s3.menu.FlashMode.dio.build.flash_mode=dio
tamc_termod_s3.menu.FlashMode.dio.build.boot=dio
tamc_termod_s3.menu.FlashMode.dio.build.boot_freq=80m
tamc_termod_s3.menu.FlashMode.dio.build.flash_freq=80m
tamc_termod_s3.menu.FlashMode.opi=OPI 80MHz
tamc_termod_s3.menu.FlashMode.opi.build.flash_mode=dout
tamc_termod_s3.menu.FlashMode.opi.build.boot=opi
tamc_termod_s3.menu.FlashMode.opi.build.boot_freq=80m
tamc_termod_s3.menu.FlashMode.opi.build.flash_freq=80m

tamc_termod_s3.menu.FlashSize.4M=4MB (32Mb)
tamc_termod_s3.menu.FlashSize.4M.build.flash_size=4MB
tamc_termod_s3.menu.FlashSize.8M=8MB (64Mb)
tamc_termod_s3.menu.FlashSize.8M.build.flash_size=8MB
tamc_termod_s3.menu.FlashSize.8M.build.partitions=default_8MB
tamc_termod_s3.menu.FlashSize.16M=16MB (128Mb)
tamc_termod_s3.menu.FlashSize.16M.build.flash_size=16MB

tamc_termod_s3.menu.LoopCore.1=Core 1
tamc_termod_s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
tamc_termod_s3.menu.LoopCore.0=Core 0
tamc_termod_s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0

tamc_termod_s3.menu.EventsCore.1=Core 1
tamc_termod_s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
tamc_termod_s3.menu.EventsCore.0=Core 0
tamc_termod_s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0

tamc_termod_s3.menu.USBMode.hwcdc=Hardware CDC and JTAG
tamc_termod_s3.menu.USBMode.hwcdc.build.usb_mode=1
tamc_termod_s3.menu.USBMode.default=USB-OTG (TinyUSB)
tamc_termod_s3.menu.USBMode.default.build.usb_mode=0

tamc_termod_s3.menu.CDCOnBoot.cdc=Enabled
tamc_termod_s3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
tamc_termod_s3.menu.CDCOnBoot.default=Disabled
tamc_termod_s3.menu.CDCOnBoot.default.build.cdc_on_boot=0

tamc_termod_s3.menu.MSCOnBoot.default=Disabled
tamc_termod_s3.menu.MSCOnBoot.default.build.msc_on_boot=0
tamc_termod_s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode)
tamc_termod_s3.menu.MSCOnBoot.msc.build.msc_on_boot=1

tamc_termod_s3.menu.DFUOnBoot.default=Disabled
tamc_termod_s3.menu.DFUOnBoot.default.build.dfu_on_boot=0
tamc_termod_s3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode)
tamc_termod_s3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1

tamc_termod_s3.menu.UploadMode.default=UART0 / Hardware CDC
tamc_termod_s3.menu.UploadMode.default.upload.use_1200bps_touch=false
tamc_termod_s3.menu.UploadMode.default.upload.wait_for_upload_port=false
tamc_termod_s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
tamc_termod_s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true
tamc_termod_s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true

tamc_termod_s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.default.build.partitions=default
tamc_termod_s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
tamc_termod_s3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
tamc_termod_s3.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
tamc_termod_s3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
tamc_termod_s3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
tamc_termod_s3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.minimal.build.partitions=minimal
tamc_termod_s3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.no_ota.build.partitions=no_ota
tamc_termod_s3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
tamc_termod_s3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
tamc_termod_s3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
tamc_termod_s3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
tamc_termod_s3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
tamc_termod_s3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
tamc_termod_s3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
tamc_termod_s3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
tamc_termod_s3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
tamc_termod_s3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.huge_app.build.partitions=huge_app
tamc_termod_s3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
tamc_termod_s3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
tamc_termod_s3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
tamc_termod_s3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
tamc_termod_s3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
tamc_termod_s3.menu.PartitionScheme.fatflash.build.partitions=ffat
tamc_termod_s3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
tamc_termod_s3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
tamc_termod_s3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
tamc_termod_s3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
tamc_termod_s3.menu.PartitionScheme.rainmaker=RainMaker
tamc_termod_s3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
tamc_termod_s3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728

tamc_termod_s3.menu.CPUFreq.240=240MHz (WiFi)
tamc_termod_s3.menu.CPUFreq.240.build.f_cpu=240000000L
tamc_termod_s3.menu.CPUFreq.160=160MHz (WiFi)
tamc_termod_s3.menu.CPUFreq.160.build.f_cpu=160000000L
tamc_termod_s3.menu.CPUFreq.80=80MHz (WiFi)
tamc_termod_s3.menu.CPUFreq.80.build.f_cpu=80000000L
tamc_termod_s3.menu.CPUFreq.40=40MHz
tamc_termod_s3.menu.CPUFreq.40.build.f_cpu=40000000L
tamc_termod_s3.menu.CPUFreq.20=20MHz
tamc_termod_s3.menu.CPUFreq.20.build.f_cpu=20000000L
tamc_termod_s3.menu.CPUFreq.10=10MHz
tamc_termod_s3.menu.CPUFreq.10.build.f_cpu=10000000L

tamc_termod_s3.menu.UploadSpeed.921600=921600
tamc_termod_s3.menu.UploadSpeed.921600.upload.speed=921600
tamc_termod_s3.menu.UploadSpeed.115200=115200
tamc_termod_s3.menu.UploadSpeed.115200.upload.speed=115200
tamc_termod_s3.menu.UploadSpeed.256000.windows=256000
tamc_termod_s3.menu.UploadSpeed.256000.upload.speed=256000
tamc_termod_s3.menu.UploadSpeed.230400.windows.upload.speed=256000
tamc_termod_s3.menu.UploadSpeed.230400=230400
tamc_termod_s3.menu.UploadSpeed.230400.upload.speed=230400
tamc_termod_s3.menu.UploadSpeed.460800.linux=460800
tamc_termod_s3.menu.UploadSpeed.460800.macosx=460800
tamc_termod_s3.menu.UploadSpeed.460800.upload.speed=460800
tamc_termod_s3.menu.UploadSpeed.512000.windows=512000
tamc_termod_s3.menu.UploadSpeed.512000.upload.speed=512000

tamc_termod_s3.menu.DebugLevel.none=None
tamc_termod_s3.menu.DebugLevel.none.build.code_debug=0
tamc_termod_s3.menu.DebugLevel.error=Error
tamc_termod_s3.menu.DebugLevel.error.build.code_debug=1
tamc_termod_s3.menu.DebugLevel.warn=Warn
tamc_termod_s3.menu.DebugLevel.warn.build.code_debug=2
tamc_termod_s3.menu.DebugLevel.info=Info
tamc_termod_s3.menu.DebugLevel.info.build.code_debug=3
tamc_termod_s3.menu.DebugLevel.debug=Debug
tamc_termod_s3.menu.DebugLevel.debug.build.code_debug=4
tamc_termod_s3.menu.DebugLevel.verbose=Verbose
tamc_termod_s3.menu.DebugLevel.verbose.build.code_debug=5

tamc_termod_s3.menu.EraseFlash.none=Disabled
tamc_termod_s3.menu.EraseFlash.none.upload.erase_cmd=
tamc_termod_s3.menu.EraseFlash.all=Enabled
tamc_termod_s3.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

dpu_esp32.name=DPU ESP32

dpu_esp32.bootloader.tool=esptool_py
Expand Down
117 changes: 117 additions & 0 deletions variants/tamc_termod_s3/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

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

#define USB_VID 0x303a
#define USB_PID 0x1001

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 48
#define NUM_ANALOG_INPUTS 20

// Some boards have too low voltage on this pin (board design bug)
// Use different pin with 3V and connect with 48
// and change this setup for the chosen pin (for example 38)
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+48;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

static const uint8_t SDA = 8;
static const uint8_t SCL = 9;

static const uint8_t SS = 10;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 13;
static const uint8_t SCK = 12;

static const uint8_t A0 = 1;
static const uint8_t A1 = 2;
static const uint8_t A2 = 3;
static const uint8_t A3 = 4;
static const uint8_t A4 = 5;
static const uint8_t A5 = 6;
static const uint8_t A6 = 7;
static const uint8_t A7 = 8;
static const uint8_t A8 = 9;
static const uint8_t A9 = 10;
static const uint8_t A10 = 11;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
static const uint8_t A13 = 14;
static const uint8_t A14 = 15;
static const uint8_t A15 = 16;
static const uint8_t A16 = 17;
static const uint8_t A17 = 18;
static const uint8_t A18 = 19;
static const uint8_t A19 = 20;

static const uint8_t T1 = 1;
static const uint8_t T2 = 2;
static const uint8_t T3 = 3;
static const uint8_t T4 = 4;
static const uint8_t T5 = 5;
static const uint8_t T6 = 6;
static const uint8_t T7 = 7;
static const uint8_t T8 = 8;
static const uint8_t T9 = 9;
static const uint8_t T10 = 10;
static const uint8_t T11 = 11;
static const uint8_t T12 = 12;
static const uint8_t T13 = 13;
static const uint8_t T14 = 14;

static const uint8_t BAT_LV = 1;
static const uint8_t CHG = 2;
static const uint8_t TFT_CS = 10;
static const uint8_t TFT_DC = 18;
static const uint8_t TFT_RST = 14;
static const uint8_t TFT_BCKL = 48; // TFT Backlight is enabled by soldering JP2 together
static const uint8_t SD_CS = 21;
static const uint8_t SD_CD = 47; // uSD Card Detect is enabled by soldering JP1 together.

#define DISPLAY_PORTRAIT 2
#define DISPLAY_LANDSCAPE 3
#define DISPLAY_PORTRAIT_FLIP 0
#define DISPLAY_LANDSCAPE_FLIP 1

#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320

/**
* Get battery voltage in volts
* @return Battery voltage in volts
*/
float getBatteryVoltage();
/**
* Get battery level in percent
* @return Battery level in percent(0-100)
*/
float getBatteryCapacity();
/**
* Get battery charge state
* @return Battery charge state(true=charging, false=not charging)
*/
bool getChargingState();
/**
* Set on charge start callback
* @param func On charge start Callback function
*/
void setOnChargeStart(void (*func)());
/**
* Set on charge end callback
* @param func On charge end Callback function
*/
void setOnChargeEnd(void (*func)());

#endif /* Pins_Arduino_h */
38 changes: 38 additions & 0 deletions variants/tamc_termod_s3/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "Arduino.h"

float getBatteryVoltage() {
int analogVolt = analogReadMilliVolts(1);
float voltage = analogVolt / 1000.0;
voltage = voltage * (100.0+200.0) / 200.0;
return voltage;
}

float getBatteryCapacity() {
float voltage = getBatteryVoltage();
float capacity = (voltage - 3.3) / (4.2 - 3.3) * 100.0;
capacity = constrain(capacity, 0, 100);
return capacity;
}

bool getChargingState() {
pinMode(CHG, INPUT_PULLUP);
return !digitalRead(CHG);
}

void (*__onChargeStart__)();
void (*__onChargeEnd__)();
void setOnChargeStart(void (*func)()) { __onChargeStart__ = func; }
void setOnChargeEnd(void (*func)()) { __onChargeEnd__ = func; }

void ARDUINO_ISR_ATTR chargeIsr() {
if (getChargingState()) {
__onChargeStart__();
} else {
__onChargeEnd__();
}
}

extern "C" void initVariant(void){
attachInterrupt(CHG, chargeIsr, CHANGE);
analogReadResolution(12);
}

0 comments on commit 4959b7f

Please sign in to comment.