esp32/boards: Add UM_OMGS3 and UM_RGBTOUCH_MINI board definitions.
This adds two new UM boards: OMGS3 and RGB Touch Mini. Also fixed the NanoS3 deploy info. Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
This commit is contained in:
parent
d775db72b9
commit
9b5f99eb59
|
@ -1,7 +1,8 @@
|
|||
Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool).
|
||||
|
||||
To flash or erase your NanoS3, you have to first put it into download mode.
|
||||
To do this, follow these steps:
|
||||
To flash or erase your NANOS3, you have to first put it into download mode.
|
||||
NANOS3 doesn't include buttons for RESET and IO0, which should be provided by adding external buttons via a carrier board or other method.
|
||||
To put the NANOS3 into download, follow these steps:
|
||||
|
||||
- Press and hold the [BOOT] button
|
||||
- Press and release the [RESET] button
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Battery Charging",
|
||||
"RGB LED",
|
||||
"External RAM",
|
||||
"WiFi",
|
||||
"BLE"
|
||||
],
|
||||
"features_non_filterable": [
|
||||
"I2C BAT Fuel Gauge"
|
||||
],
|
||||
"id": "omgs3",
|
||||
"images": [
|
||||
"unexpectedmaker_omgs3.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "OMGS3",
|
||||
"thumbnail": "",
|
||||
"url": "https://omgs3.io",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
The following files are firmware for the OMGS3.
|
|
@ -0,0 +1,53 @@
|
|||
Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool).
|
||||
|
||||
To flash or erase your OMGS3, you have to first put it into download mode.
|
||||
OMGS3 doesn't include buttons for RESET and IO0, which should be provided by adding external buttons via a carrier board or other method.
|
||||
To put the OMGS3 into download, follow these steps:
|
||||
|
||||
- Press and hold the [BOOT] button
|
||||
- Press and release the [RESET] button
|
||||
- Release the [BOOT] button
|
||||
|
||||
Now the board is in download mode and the native USB will have enumerated as a serial device.
|
||||
|
||||
If you are putting MicroPython on your board for the first time then you should
|
||||
first erase the entire flash using:
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash
|
||||
```
|
||||
|
||||
### Mac
|
||||
Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash
|
||||
```
|
||||
|
||||
### Windows
|
||||
Change (X) to whatever COM port is being used by the board
|
||||
```bash
|
||||
esptool --chip esp32s3 --port COM(X) erase_flash
|
||||
```
|
||||
|
||||
Now download the version of the firmware you would like to install from the options below,
|
||||
then use the following command to program the firmware starting at address 0x0,
|
||||
remembering to replace `omgs3-micropython-firmware-version.bin` with the name of
|
||||
the firmware you just downloaded:
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 omgs3-micropython-firmware-version.bin
|
||||
```
|
||||
|
||||
### Mac
|
||||
Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 omgs3-micropython-firmware-version.bin
|
||||
```
|
||||
|
||||
### Windows
|
||||
Change (X) to whatever COM port is being used by the board
|
||||
```bash
|
||||
esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 omgs3-micropython-firmware-version.bin
|
||||
```
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
|
@ -0,0 +1,72 @@
|
|||
# Basic MAX17048 library for OMGS3 and other Unexpected Maker products
|
||||
# MIT license; Copyright (c) 2024 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# https://unexpectedmaker.com
|
||||
|
||||
from machine import I2C
|
||||
|
||||
|
||||
class MAX17048:
|
||||
_MAX17048_ADDRESS = 0x36
|
||||
|
||||
_VCELL_REGISTER = 0x02
|
||||
_SOC_REGISTER = 0x04
|
||||
_MODE_REGISTER = 0x06
|
||||
_VERSION_REGISTER = 0x08
|
||||
_HIBRT_REGISTER = 0x0A
|
||||
_CONFIG_REGISTER = 0x0C
|
||||
_COMMAND_REGISTER = 0xFE
|
||||
|
||||
def __init__(self, i2c, address=_MAX17048_ADDRESS):
|
||||
self.i2c = i2c
|
||||
self.address = address
|
||||
|
||||
def _read_register(self, register, num_bytes):
|
||||
result = self.i2c.readfrom_mem(self.address, register, num_bytes)
|
||||
return int.from_bytes(result, "big")
|
||||
|
||||
def _write_register(self, register, value, num_bytes):
|
||||
data = value.to_bytes(num_bytes, "big")
|
||||
self.i2c.writeto_mem(self.address, register, data)
|
||||
|
||||
@property
|
||||
def cell_voltage(self):
|
||||
"""The voltage of the connected cell in Volts."""
|
||||
raw_voltage = self._read_register(self._VCELL_REGISTER, 2)
|
||||
voltage = (raw_voltage >> 4) * 0.00125
|
||||
return voltage
|
||||
|
||||
@property
|
||||
def state_of_charge(self):
|
||||
"""The state of charge of the battery in percentage."""
|
||||
raw_soc = self._read_register(self._SOC_REGISTER, 2)
|
||||
return raw_soc / 256
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""The chip version."""
|
||||
return self._read_register(self._VERSION_REGISTER, 2)
|
||||
|
||||
@property
|
||||
def hibernate(self):
|
||||
"""True if the chip is in hibernate mode, False otherwise."""
|
||||
hib = self._read_register(self._HIBRT_REGISTER, 2)
|
||||
return (hib & 0x4000) != 0
|
||||
|
||||
@hibernate.setter
|
||||
def hibernate(self, value):
|
||||
config = self._read_register(self._CONFIG_REGISTER, 2)
|
||||
if value:
|
||||
config |= 0x8000 # Set the sleep bit
|
||||
else:
|
||||
config &= ~0x8000 # Clear the sleep bit
|
||||
self._write_register(self._CONFIG_REGISTER, config, 2)
|
||||
|
||||
def quick_start(self):
|
||||
"""Perform a quick start to reset the SOC calculation in the chip."""
|
||||
self._write_register(self._MODE_REGISTER, 0x4000, 2)
|
||||
|
||||
def reset(self):
|
||||
"""Reset the chip."""
|
||||
self._write_register(self._COMMAND_REGISTER, 0x5400, 2)
|
|
@ -0,0 +1,57 @@
|
|||
# OMGS3 Helper Library
|
||||
# MIT license; Copyright (c) 2024 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# https://omgs3.io
|
||||
|
||||
# Import required libraries
|
||||
from micropython import const
|
||||
from machine import Pin, I2C
|
||||
from max17048 import MAX17048
|
||||
import time
|
||||
|
||||
# Initialize I2C bus
|
||||
fg_i2c = I2C(0, scl=Pin.board.I2C_SCL, sda=Pin.board.I2C_SDA)
|
||||
|
||||
# Create an instance of the MAX17048 class
|
||||
max17048 = MAX17048(fg_i2c)
|
||||
|
||||
|
||||
# Helper functions
|
||||
def get_bat_voltage():
|
||||
"""Read the battery voltage from the fuel gauge"""
|
||||
voltage = max17048.cell_voltage
|
||||
print(f"Bat Voltage: {voltage}V")
|
||||
return voltage
|
||||
|
||||
|
||||
def get_state_of_charge():
|
||||
"""Read the battery state of charge from the fuel gauge"""
|
||||
soc = max17048.state_of_charge
|
||||
print(f"State of Charge: {soc}%")
|
||||
return soc
|
||||
|
||||
|
||||
def get_vbus_present():
|
||||
"""Detect if VBUS (5V) power source is present"""
|
||||
return Pin(Pin.board.VBUS_SENSE, Pin.IN).value() == 1
|
||||
|
||||
|
||||
def set_pixel_power(state):
|
||||
"""Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep."""
|
||||
Pin(Pin.board.RGB_PWR, Pin.OUT).value(state)
|
||||
|
||||
|
||||
# NeoPixel rainbow colour wheel
|
||||
def rgb_color_wheel(wheel_pos):
|
||||
"""Color wheel to allow for cycling through the rainbow of RGB colors."""
|
||||
wheel_pos = wheel_pos % 255
|
||||
|
||||
if wheel_pos < 85:
|
||||
return 255 - wheel_pos * 3, 0, wheel_pos * 3
|
||||
elif wheel_pos < 170:
|
||||
wheel_pos -= 85
|
||||
return 0, wheel_pos * 3, 255 - wheel_pos * 3
|
||||
else:
|
||||
wheel_pos -= 170
|
||||
return wheel_pos * 3, 255 - wheel_pos * 3, 0
|
|
@ -0,0 +1,13 @@
|
|||
set(IDF_TARGET esp32s3)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
${SDKCONFIG_IDF_VERSION_SPECIFIC}
|
||||
boards/sdkconfig.usb
|
||||
boards/sdkconfig.ble
|
||||
boards/sdkconfig.240mhz
|
||||
boards/sdkconfig.spiram_sx
|
||||
boards/UM_OMGS3/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
|
@ -0,0 +1,10 @@
|
|||
#define MICROPY_HW_BOARD_NAME "OMGS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3-PICO-1-N8R2"
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "OMGS3"
|
||||
|
||||
#define MICROPY_HW_I2C0_SCL (9)
|
||||
#define MICROPY_HW_I2C0_SDA (8)
|
||||
|
||||
#define MICROPY_HW_SPI1_MOSI (6)
|
||||
#define MICROPY_HW_SPI1_MISO (5)
|
||||
#define MICROPY_HW_SPI1_SCK (4)
|
|
@ -0,0 +1,8 @@
|
|||
I2C_SCL,GPIO9
|
||||
I2C_SDA,GPIO8
|
||||
FG_INT,GPIO21
|
||||
RGB_DATA,GPIO35
|
||||
RGB_PWR,GPIO34
|
||||
UART0_TX,GPIO43
|
||||
UART0_RX,GPIO44
|
||||
VBUS_SENSE,GPIO33
|
|
|
@ -0,0 +1,21 @@
|
|||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=y
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"
|
||||
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="UMOMGS3"
|
||||
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x8225
|
||||
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
|
||||
CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=n
|
||||
CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=n
|
||||
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
|
||||
CONFIG_TINYUSB_DESC_PRODUCT_STRING="OMGS3"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_omgs3_"
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"BLE",
|
||||
"Battery Charging",
|
||||
"External Flash",
|
||||
"External RAM",
|
||||
"RGB LED",
|
||||
"USB-C",
|
||||
"WiFi"
|
||||
],
|
||||
"features_non_filterable": [
|
||||
"3 Axis IMU",
|
||||
"12x12 RGB LED Matrix",
|
||||
"Capacitive Touch",
|
||||
"I2S Audio Amplifier + Speaker"
|
||||
],
|
||||
"images": [
|
||||
"unexpectedmaker_rgbtouch_mini.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "RGB Touch Mini",
|
||||
"thumbnail": "",
|
||||
"url": "https://rgbtouch.com",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
The following files are firmware for the RGB Touch Mini.
|
|
@ -0,0 +1,52 @@
|
|||
Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool).
|
||||
|
||||
To flash or erase your RGB Touch Mini, you have to first put it into download mode.
|
||||
To do this, follow these steps:
|
||||
|
||||
- Press and hold the [BOOT] button
|
||||
- Press and release the [RESET] button
|
||||
- Release the [BOOT] button
|
||||
|
||||
Now the board is in download mode and the native USB will have enumerated as a serial device.
|
||||
|
||||
If you are putting MicroPython on your board for the first time then you should
|
||||
first erase the entire flash using:
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash
|
||||
```
|
||||
|
||||
### Mac
|
||||
Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash
|
||||
```
|
||||
|
||||
### Windows
|
||||
Change (X) to whatever COM port is being used by the board
|
||||
```bash
|
||||
esptool --chip esp32s3 --port COM(X) erase_flash
|
||||
```
|
||||
|
||||
Now download the version of the firmware you would like to install from the options below,
|
||||
then use the following command to program the firmware starting at address 0x0,
|
||||
remembering to replace `rgbtouch_mini-micropython-firmware-version.bin` with the name of
|
||||
the firmware you just downloaded:
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 rgbtouch_mini-micropython-firmware-version.bin
|
||||
```
|
||||
|
||||
### Mac
|
||||
Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as.
|
||||
```bash
|
||||
esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 rgbtouch_mini-micropython-firmware-version.bin
|
||||
```
|
||||
|
||||
### Windows
|
||||
Change (X) to whatever COM port is being used by the board
|
||||
```bash
|
||||
esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 rgbtouch_mini-micropython-firmware-version.bin
|
||||
```
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
|
@ -0,0 +1,13 @@
|
|||
set(IDF_TARGET esp32s3)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
${SDKCONFIG_IDF_VERSION_SPECIFIC}
|
||||
boards/sdkconfig.usb
|
||||
boards/sdkconfig.ble
|
||||
boards/sdkconfig.240mhz
|
||||
boards/sdkconfig.spiram_sx
|
||||
boards/UM_RGBTOUCH_MINI/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
|
@ -0,0 +1,10 @@
|
|||
#define MICROPY_HW_BOARD_NAME "RGB Touch Mini"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3-PICO-1-N8R2"
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "RGBTouchMini"
|
||||
|
||||
#define MICROPY_HW_I2C0_SCL (9)
|
||||
#define MICROPY_HW_I2C0_SDA (8)
|
||||
|
||||
#define MICROPY_HW_SPI1_MOSI (35)
|
||||
#define MICROPY_HW_SPI1_MISO (37)
|
||||
#define MICROPY_HW_SPI1_SCK (36)
|
|
@ -0,0 +1,17 @@
|
|||
INT_IMU,GPIO7
|
||||
INT_ROWS, GPIO15
|
||||
INT_COLS, GPIO16
|
||||
I2C_SDA,GPIO8
|
||||
I2C_SCL,GPIO9
|
||||
VBAT_SENSE,GPIO18
|
||||
VBUS_SENSE,GPIO48
|
||||
|
||||
MATRIX_PWR,GPIO38
|
||||
MATRIX_DATA,GPIO39
|
||||
|
||||
AMP_LRCLK,GPIO37
|
||||
AMP_BCLK,GPIO36
|
||||
AMP_DATA,GPIO35
|
||||
AMP_SD,GPIO34
|
||||
PWR_SHUTDOWN,GPIO21
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=y
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"
|
||||
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="UMRGBTouchMini"
|
||||
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x81FF
|
||||
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
|
||||
CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=n
|
||||
CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=n
|
||||
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
|
||||
CONFIG_TINYUSB_DESC_PRODUCT_STRING="RGBTouchMini"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_rgbtouch_mini_"
|
Loading…
Reference in New Issue