Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8399c7c
WIP: Add M5Stack CoreS3
meganetaaan Jun 7, 2023
4ff6f82
Temporarily remove unimplemented peripherals
meganetaaan Jun 7, 2023
ab48969
Add Axp2101
meganetaaan Jun 7, 2023
fe0a36d
Use Axp2101
meganetaaan Jun 7, 2023
525cc37
Configure LCD
meganetaaan Jun 7, 2023
19527ef
Remove miso_pin to avoid conflict with dc_pin
meganetaaan Jun 7, 2023
7b4368d
WIP: reset LCD
meganetaaan Jun 7, 2023
94bd8da
WIP: set LDO voltage
meganetaaan Jun 7, 2023
605f3b5
Include Timer
meganetaaan Jun 7, 2023
0cda061
Update modServo.c
washishi Jun 8, 2023
3a0669f
WIP: add i2s settings
meganetaaan Jun 13, 2023
fdf2338
WIP: Add m5stack_core3 to examples/piu/sound
meganetaaan Jun 13, 2023
5e87376
Fix power reset sequnce according to M5Unified
meganetaaan Jun 13, 2023
714a32a
Fix format
meganetaaan Jun 13, 2023
27a1862
Add mck_pin settings
meganetaaan Jun 13, 2023
95cce76
WIP: set i2s port number
meganetaaan Jun 13, 2023
74ae79a
WIP: Add Amplifier AW88298
meganetaaan Jun 13, 2023
f190a6e
Change default sample rate
meganetaaan Jun 13, 2023
dfa6f7d
Set sampleRate of the amp IC
meganetaaan Jun 13, 2023
fd00b24
piuMC -> xsmc
meganetaaan Jun 13, 2023
bdc9780
Merge remote-tracking branch 'washishi/Fix-servo/esp32-suport-ESP32S3…
meganetaaan Jun 13, 2023
1058474
Enable bus output
meganetaaan Jun 19, 2023
f86363a
Merge branch 'feature/m5stack_cores3' of github.com:meganetaaan/modda…
meganetaaan Jun 19, 2023
d403620
Merge branch 'feature/m5stack_cores3' of github.com:meganetaaan/modda…
meganetaaan Jun 20, 2023
88a222e
Fix I2C power
meganetaaan Jun 20, 2023
f3ec274
Fix resetLcd
meganetaaan Jun 23, 2023
fbd42dd
Add a valid vendor id for FT6206
meganetaaan Jun 23, 2023
832d7e8
Add M5StackCoreS3Audio
meganetaaan Jun 23, 2023
03f9082
Add virtual button
meganetaaan Jun 23, 2023
461d64e
Add valid ID 0 for FT6206
meganetaaan Jun 23, 2023
347c881
Add startup sound
meganetaaan Jun 23, 2023
557d282
Ignore error and continue writing
meganetaaan Jun 23, 2023
bfb7f06
Merge branch 'public' into feature/m5stack_cores3
meganetaaan Jun 23, 2023
c05c446
Build other audioout related files
meganetaaan Jun 23, 2023
b04dd71
Move AW88298 implementation to setup-target.js
meganetaaan Jun 25, 2023
6ea0063
Specify internal i2c sampleRate
meganetaaan Jun 25, 2023
fbe8123
Defer calling done
meganetaaan Jun 25, 2023
fd3640e
Slow down ft6206 sample rate to avoid write fail
meganetaaan Jun 25, 2023
717d477
Remove trace
meganetaaan Jun 25, 2023
bdda49d
Fix comment and format
meganetaaan Jun 25, 2023
4791f42
Make virtual buttons opt-in
meganetaaan Jun 27, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2023 Shinya Ishikawa
*
* 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 AudioOut from "pins/audioout-original";

/**
* A special AudioOut implementation for M5Stack CoreS3
* CoreS3 has an amplifier IC (AW88298).
* The user must set the sample rate to the IC before playing audio.
*/
export default class M5StackCoreS3AudioOut extends AudioOut {
constructor(options) {
super(options);
if (globalThis.amp == null) {
trace("amp not found\n");
} else {
globalThis.amp.sampleRate = this.sampleRate;
}
}
}
55 changes: 55 additions & 0 deletions build/devices/esp32/targets/m5stack_cores3/M5StackCoreS3Touch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2022-2023 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 Touch from "ft6206";

/**
* A special implementation for M5Stack CoreS3,
* ensuring backward compatibility with previous Core series.
* It updates virtual button objects when pressed below 200 pixels,
* but may potentially interfere with GUI objects like piu.
*/
class M5StackCoreTouch extends Touch {
#captured; // undefined or pressed button instance

read(points) {
super.read(points);

if (!globalThis.button) {
return;
}
if (this.#captured) {
if (0 === points[0].state) {
this.#captured.write(0);
this.#captured = undefined;
}
} else if (1 === points[0].state && points[0].y >= 200) {
this.#captured =
button[
String.fromCharCode("a".charCodeAt() + Math.idiv(points[0].x, 107))
];
this.#captured?.write(1);
}

if (this.#captured) points[0].state = 0;
}
}

export default M5StackCoreTouch;
86 changes: 86 additions & 0 deletions build/devices/esp32/targets/m5stack_cores3/host/provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2023 Shinya Ishikawa
*
* 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 PulseWidth from "embedded:io/pulsewidth";

const device = {
I2C: {
default: {
io: I2C,
data: 2,
clock: 1,
},
internal: {
io: I2C,
data: 12,
clock: 11,
},
},
Serial: {
default: {
io: Serial,
port: 1,
receive: 44,
transmit: 43,
},
},
SPI: {
default: {
io: SPI,
clock: 36,
in: 35,
out: 37,
port: 1,
},
},
Analog: {
default: {
io: Analog,
pin: 10,
},
},
io: {
Analog,
Digital,
DigitalBank,
I2C,
PulseCount,
PulseWidth,
PWM,
Serial,
SMBus,
SPI,
},
pin: {
displayDC: 15,
displaySelect: 5,
},
};

export default device;
123 changes: 123 additions & 0 deletions build/devices/esp32/targets/m5stack_cores3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"build": {
"ESP32_SUBCLASS": "esp32s3",
"USE_USB": "1",
"SDKCONFIGPATH": "./sdkconfig"
},
"include": [
"$(MODDABLE)/modules/drivers/ili9341/manifest.json",
"$(MODDABLE)/modules/drivers/ft6206/manifest.json",
"$(MODDABLE)/modules/drivers/axp2101/manifest.json"
],
"config": {
"screen": "ili9341",
"virtualButton": false,
"touch": "M5StackCoreS3Touch",
"startupSound": "bflatmajor.maud",
"startupVibration": 600
},
"modules": {
"setup/target": "./setup-target",
"pins/smbus": "$(MODULES)/pins/smbus/smbus",
"pins/audioout-original": "$(MODULES)/pins/i2s/*",
"pins/audioout": "./M5StackCoreS3AudioOut",
"*": [
"$(MODULES)/drivers/mpu6886/*",
"./M5StackCoreS3Touch"
]
},
"preload": [
"pins/smbus",
"pins/audioout-original",
"pins/audioout",
"mpu6886",
"M5StackCoreS3Touch",
"setup/target"
],
"resources": {
"*": "$(MODDABLE)/examples/assets/sounds/bflatmajor"
},
"creation": {
"static": 0,
"chunk": {
"initial": 78848,
"incremental": 0
},
"heap": {
"initial": 4928,
"incremental": 0
},
"stack": 512
},
"defines": {
"i2c": {
"sda_pin": 2,
"scl_pin": 1
},
"spi": {
"mosi_pin": 37,
"sck_pin": 36
},
"ili9341": {
"hz": 40000000,
"width": 320,
"height": 240,
"cs_pin": 3,
"dc_pin": 35,
"spi_port": "SPI3_HOST",
"registers": [
"0x01, 0,",
"0xC8, 3, 0xFF, 0x93, 0x42,",
"0xC0, 2, 0x12, 0x12,",
"0xC1, 1, 0x03,",
"0xB0, 1, 0xE0,",
"0xF6, 3, 0x00, 0x01, 0x01,",
"0x36, 1, 0x08,",
"0x3A, 1, 0x55,",
"0xB6, 3, 0x08, 0x82, 0x27,",
"0xE0, 15, 0x00 ,0x0C ,0x11 ,0x04 ,0x11 ,0x08 ,0x37 ,0x89 ,0x4C ,0x06 ,0x0C ,0x0A ,0x2E ,0x34 ,0x0F,",
"0xE1, 15 ,0x00 ,0x0B ,0x11 ,0x05 ,0x13 ,0x09 ,0x33 ,0x67 ,0x48 ,0x07 ,0x0E ,0x0B ,0x2E ,0x33 ,0x0F,",
"0x11, 0,",
"0x29, 0,",
"0x21, 0,",
"0xFF, 0"
]
},
"ft6206": {
"width": 320,
"height": 280,
"hz": 100000,
"sda": 12,
"scl": 11,
"threshold": 128,
"flipX": false,
"flipY": false,
"fitX": false,
"fitY": false
},
"audioOut": {
"bitsPerSample": 16,
"numChannels": 1,
"sampleRate": 24000,
"volume_divider": 1,
"i2s": {
"num": 1,
"bitsPerSample": 16,
"bck_pin": 34,
"lr_pin": 33,
"mck_pin": 0,
"dataout_pin": 13
}
},
"audioIn": {
"sampleRate": 11025,
"bitsPerSample": 16,
"i2s": {
"bck_pin": 34,
"lr_pin": 33,
"datain": 14,
"pdm": 1
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
CONFIG_TINYUSB=y
CONFIG_TINYUSB_CDC_ENABLED=y

#
# Descriptor configuration
#
CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=n
CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=n
CONFIG_TINYUSB_DESC_CUSTOM_VID=0xbeef
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x1cee
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Moddable"
CONFIG_TINYUSB_DESC_PRODUCT_STRING="Moddable"
CONFIG_TINYUSB_DESC_SERIAL_STRING="123456"
CONFIG_TINYUSB_DESC_CDC_STRING="xsbug"
# end of Descriptor configuration

CONFIG_CONSOLE_UART_DEFAULT=y
CONFIG_CONSOLE_UART=y
CONFIG_CONSOLE_UART_NUM=0
CONFIG_CONSOLE_UART_BAUDRATE=115200

# CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"

#CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y

CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=n
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=n
CONFIG_ESP_COREDUMP_ENABLE=n

#CONFIG_FLASHMODE_QIO=y
CONFIG_FLASHMODE_DIO=y
Loading