-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 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 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 PulseWidth from "embedded:io/pulsewidth"; | ||
import PWM from "embedded:io/pwm"; | ||
import Serial from "embedded:io/serial"; | ||
import SMBus from "embedded:io/smbus"; | ||
import SPI from "embedded:io/spi"; | ||
|
||
const device = { | ||
I2C: { | ||
default: { | ||
io: I2C, | ||
data: 2, | ||
clock: 1 | ||
}, | ||
internal: { | ||
io: I2C, | ||
data: 38, | ||
clock: 39 | ||
} | ||
}, | ||
SPI: { | ||
default: { | ||
io: SPI, | ||
port: 3, | ||
clock: 17, | ||
out: 21 | ||
} | ||
}, | ||
Analog: { | ||
default: { | ||
io: Analog, | ||
pin: 8 | ||
} | ||
}, | ||
io: {Analog, Digital, DigitalBank, I2C, PulseCount, PulseWidth, PWM, Serial, SMBus, SPI}, | ||
pin: { | ||
button: 41, | ||
} | ||
}; | ||
|
||
export default device; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"build":{ | ||
"ESP32_SUBCLASS": "esp32s3", | ||
"USE_USB": "1", | ||
"SDKCONFIGPATH": "$(MODDABLE)/build/devices/esp32/targets/atoms3_lite/sdkconfig" | ||
}, | ||
"include": [ | ||
"$(MODULES)/pins/smbus/manifest.json", | ||
"$(MODULES)/pins/digital/manifest.json", | ||
"$(MODULES)/pins/digital/monitor/manifest.json", | ||
"$(MODULES)/drivers/button/manifest.json" | ||
], | ||
"modules": { | ||
"*": [ | ||
"$(MODULES)/drivers/neopixel/*", | ||
"$(MODULES)/drivers/neopixel/esp32/*", | ||
"../m5stack_fire/m5button" | ||
], | ||
"setup/target": "./setup-target" | ||
}, | ||
"preload": [ | ||
"setup/target", | ||
"neopixel", | ||
"m5button" | ||
], | ||
"defines": { | ||
"i2c": { | ||
"sda_pin": 38, | ||
"scl_pin": 39 | ||
}, | ||
"neopixel": { | ||
"length": 1, | ||
"pin": 35, | ||
"order": "#GRB", | ||
"rmt_channel": "RMT_CHANNEL_0" | ||
} | ||
} | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
build/devices/esp32/targets/atoms3_lite/sdkconfig/sdkconfig.defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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_ESP_SYSTEM_PANIC_GDBSTUB=n | ||
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=n | ||
CONFIG_ESP_COREDUMP_ENABLE=n | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Digital from "pins/digital"; | ||
//import Monitor from "monitor"; | ||
import M5Button from "m5button"; | ||
import config from "mc/config"; | ||
import Timer from "timer"; | ||
import Button from "button"; | ||
import I2C from "pins/i2c"; | ||
import NeoPixel from "neopixel"; | ||
|
||
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) | ||
}; | ||
|
||
globalThis.lights = new NeoPixel({}); | ||
|
||
done(); | ||
} | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters