Skip to content
Closed
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
110 changes: 110 additions & 0 deletions build/devices/esp32/targets/m5atom_s3r/host/provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2025 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
* The Moddable SDK Runtime 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 3 of the License, or
* (at your option) any later version.
*
* The Moddable SDK Runtime 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 the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
*
*/

import Analog from "embedded:io/analog";
import Digital from "embedded:io/digital";
import DigitalBank from "embedded:io/digitalbank";
import I2C from "embedded:io/i2c";
import PulseCount from "embedded:io/pulsecount";
import PWM from "embedded:io/pwm";
import Serial from "embedded:io/serial";
import SMBus from "embedded:io/smbus";
import SPI from "embedded:io/spi";
import Timer from "timer";

class Backlight {
#io;

constructor(options) {
const io = this.#io = new SMBus({
...device.I2C.internal,
hz: 400_000,
address:48,
});

io.writeUint8(0x00, 0b01000000)
Timer.delay(1)
io.writeUint8(0x08, 0b00000001)
io.writeUint8(0x70, 0b00000000)
}
close() {
this.#io?.close();
this.#io = undefined;
}
set brightness(value) {
if (value <= 0) value = 0;
else if (value >= 1) value = 255;
else value *= 255;
this.#io.writeUint8(0x0e, value)
}
}

const device = {
I2C: {
default: {
io: I2C,
data: 2,
clock: 1,
},
internal: {
io: I2C,
data: 45,
clock: 0,
},
},
SPI: {
default: {
io: SPI,
port: 3,
clock: 15,
out: 21,
},
},
Analog: {
default: {
io: Analog,
pin: 8,
},
},
io: {
Analog,
Digital,
DigitalBank,
I2C,
PulseCount,
PWM,
Serial,
SMBus,
SPI,
},
pin: {
button: 41,
displaySelect: 14,
},
peripheral: {
Backlight: class {
constructor() {
return new Backlight();
}
},
},
};

export default device;
93 changes: 93 additions & 0 deletions build/devices/esp32/targets/m5atom_s3r/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"build":{
"ESP32_SUBCLASS": "esp32s3",
"USE_USB": "2",
"SDKCONFIGPATH": "./sdkconfig",
"PARTITIONS_FILE_FOR_TARGET": "./sdkconfig/partitions.csv",
"PROGRAMMING_MODE_MESSAGE": "INSTRUCTIONS: Press and hold the button until the LED lights.",
"BEFORE_DEBUGGING_MESSAGE": "Press and release the Reset button."
},
"include": [
"$(MODDABLE)/modules/io/manifest.json",
"$(MODDABLE)/modules/drivers/ili9341/manifest.json",
"$(MODULES)/drivers/button/manifest.json"
],
"modules": {
"*": [
"../m5stack_fire/m5button"
],
"setup/target": "./setup-target"
},
"preload": [
"setup/target",
"m5button"
],
"config": {
"screen": "ili9341",
"touch": ""
},
"creation": {
"static": 0,
"chunk": {
"initial": 78848,
"incremental": 0
},
"heap": {
"initial": 4928,
"incremental": 0
},
"stack": 512
},
"defines": {
"i2c": {
"sda_pin": 45,
"scl_pin": 0
},
"spi": {
"mosi_pin":21,
"sck_pin": 15
},
"ili9341": {
"hz": 27000000,
"width": 128,
"height": 128,
"cs_pin": 14,
"rst_pin": 48,
"dc_pin": 42,
"column_offset": 0,
"row_offset": 32,
"spi_port": "SPI3_HOST",
"registers": [
"0xFE, 0,",
"kDelayMS, 10,",
"0xEF, 0,",
"kDelayMS, 10,",
"0x36, 1, 0x08,",
"0xB0, 1, 0xC0,",
"0xB2, 1, 0x2F,",
"0xB3, 1, 0x03,",
"0xB6, 1, 0x19,",
"0xB7, 1, 0x01,",
"0xAC, 1, 0xCB,",
"0xAB, 1, 0x0E,",
"0xB4, 1, 0x04,",
"0xA8, 1, 0x19,",
"0x3A, 1, 0x05,",
"0xB8, 1, 0x08,",
"0xE8, 1, 0x24,",
"0xE9, 1, 0x48,",
"0xEA, 1, 0x22,",
"0xC6, 1, 0x30,",
"0xC7, 1, 0x18,",
"0xF0, 14, 0x1F,0x28,0x04,0x3E,0x2A,0x2E,0x20,0x00,0x0C,0x06,0x00,0x1C,0x1F,0x0F,",
"0xF1, 14, 0x00,0x2D,0x2F,0x3C,0x6F,0x1C,0x0B,0x00,0x00,0x00,0x07,0x0D,0x11,0x0F,",
"0x20, 0,",
"0x11, 0,",
"kDelayMS, 120,",
"0x29, 0,",
"kDelayMS, 20,",
"kDelayMS, 0"
]
}
}
}
24 changes: 24 additions & 0 deletions build/devices/esp32/targets/m5atom_s3r/sdkconfig/partitions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2016-2023 Moddable Tech, Inc.
#
# This file is part of the Moddable SDK Tools.
#
# The Moddable SDK Tools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Moddable SDK Tools 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
#

# Name, Type, SubType, Offset, Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild,,,,
nvs, data, nvs, 0x9000, 0x006000,
phy_init, data, phy, 0xf000, 0x001000,
factory, app, factory, 0x10000, 0x7F0000,
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Serial flasher config
#
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=n
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=n
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"

# for ESP32-S3 module N8R8
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_MODE_QUAD=n
CONFIG_SPIRAM_SPEED_80M=n
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=n
CONFIG_SPIRAM_TYPE_AUTO=y
# CONFIG_SPIRAM_USE_CAPS_ALLOC=y

# for ESP32-S3 module P2N8
# CONFIG_SPIRAM_MODE_OCT=n
# CONFIG_SPIRAM_MODE_QUAD=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Automatically generated file; DO NOT EDIT.
# Espressif IoT Development Framework Configuration
#

# CONFIG_ESP_DEBUG_STUBS_ENABLE=n
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_TASK_WDT_INIT=y
CONFIG_ESP_TASK_WDT_PANIC=y
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n

# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=n
# CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=n
# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=n

CONFIG_ESP_CONSOLE_UART_DEFAULT=y
CONFIG_ESP_CONSOLE_UART_CUSTOM=n
CONFIG_ESP_CONSOLE_NONE=n
CONFIG_ESP_CONSOLE_UART_NUM=0
30 changes: 30 additions & 0 deletions build/devices/esp32/targets/m5atom_s3r/sdkconfig/sdkconfig.inst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##### TEST INSTRUMENTATION
#
# ESP32-specific
#
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=y

#
# ESP32-specific
#
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
CONFIG_ESP_CONSOLE_UART_CUSTOM=n
CONFIG_ESP_CONSOLE_NONE=n
CONFIG_ESP_CONSOLE_UART_NUM=0


#
# Log output
#
CONFIG_LOG_DEFAULT_LEVEL_NONE=n
CONFIG_LOG_DEFAULT_LEVEL_ERROR=n
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
CONFIG_LOG_DEFAULT_LEVEL_INFO=n
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=n
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=n
CONFIG_LOG_DEFAULT_LEVEL=2

CONFIG_ESP_DEBUG_STUBS_ENABLE=y
CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=y

CONFIG_ESP_TASK_WDT_EN=y
30 changes: 30 additions & 0 deletions build/devices/esp32/targets/m5atom_s3r/setup-target.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import M5Button from "m5button";
import Button from "button";

class Flash {
constructor(options) {
return new Button({
...options,
pin: 0,
invert: true,
});
}
}

globalThis.Host = Object.freeze(
{
Button: {
Default: Flash,
Flash,
},
},
true
);

export default function (done) {
globalThis.button = {
a: new M5Button(41),
};

done();
}
Binary file removed documentation/assets/devices/m5atom_s3r.jpg
Binary file not shown.
Binary file added documentation/assets/devices/m5atom_s3r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions documentation/devices/esp32.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ The Moddable SDK supports devices built on ESP32-S3. The following table lists e
| <img src="./../assets/devices/adafruit-esp32-s3-tft-feather.png" width=125><BR>Adafruit ESP32-S3 TFT Feather | `esp32/feather_s3_tft` | 1.14" TFT display<BR> 240 x 135 16-bit color | <li>[Product page](https://www.adafruit.com/product/5483)</li>|
|<img src="./../assets/devices/atoms3.png" width=125><BR>AtomS3| `esp32/m5atom_s3` | 0.85" IPS display<BR> 128 x 128 16-bit color<BR> 1 button<BR> IMU |<li>[Product page](https://docs.m5stack.com/en/core/AtomS3)</li>|
|<img src="./../assets/devices/atoms3_lite.png" width=125><BR>AtomS3 Lite| `esp32/m5atom_s3_lite` | Neopixel, 1 button |<li>[Product page](https://docs.m5stack.com/en/core/AtomS3%20Lite)</li>|
| <img src="../assets/devices/m5atom_s3r.png" width=140></a><BR>M5 Atom S3R | `esp32/m5atom_s3r` | 0.85" IPS display<BR> 128 x 128 16-bit color<BR> 1 button<BR>BMI270 IMU<Br>8MB PSRAM| <li>[Product info](https://shop.m5stack.com/products/atoms3r-dev-kit)</li> |
|<img src="./../assets/devices/m5dial.png" width=125><BR>M5Dial| `esp32/m5dial` | 1.28" IPS 240×240 Round Display, Touch, 1 button,Rotary Encoder, RTC |<li>[Product page](https://docs.m5stack.com/en/core/M5Dial)</li>|
|<img src="./../assets/devices/m5stamp_s3.png" width=125><BR>M5Stamp S3| `esp32/m5stamp_s3` | Neopixel, 1 button |<li>[Product page](https://shop.m5stack.com/products/m5stamp-esp32s3-module)</li>|
| <img src="./../assets/devices/lilygo-qt-pro-s3.png" width=100><BR>Lilygo T-QT ESP32-S3 | `esp32/lilygo_t_qt` | 0.85" LCD display<br>128 x 128 16 bit color<br>2 buttons<br>Qwiic connector | <li>[Product page](https://www.lilygo.cc/products/t-qt-v1-1)</li>|
Expand Down