esp32/boards: Add three UM ESP32-S3 based boards.
This commit is contained in:
parent
468d1979ba
commit
aca40127bf
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Battery Charging",
|
||||
"RGB LED",
|
||||
"SPIRAM",
|
||||
"USB-C",
|
||||
"WiFi",
|
||||
"BLE",
|
||||
"STEMMA QT/QWIIC",
|
||||
"Feather"
|
||||
],
|
||||
"features_non_filterable": [
|
||||
],
|
||||
"id": "feathers3",
|
||||
"images": [
|
||||
"unexpectedmaker_feathers3.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "FeatherS3",
|
||||
"thumbnail": "",
|
||||
"url": "https://feathers3.io",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
The following files are daily firmware for the FeatherS3. This firmware is
|
||||
compiled using ESP-IDF v4.4 or later.
|
|
@ -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 FeatherS3, 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 `feathers3-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 feathers3-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 feathers3-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 feathers3-micropython-firmware-version.bin
|
||||
```
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
|
@ -0,0 +1,90 @@
|
|||
# FeatherS3 MicroPython Helper Library
|
||||
# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# http://feathers3.io
|
||||
|
||||
# Import required libraries
|
||||
from micropython import const
|
||||
from machine import Pin, ADC
|
||||
import time
|
||||
|
||||
# FeatherS3 Hardware Pin Assignments
|
||||
|
||||
# Sense Pins
|
||||
VBUS_SENSE = const(34)
|
||||
VBAT_SENSE = const(2)
|
||||
|
||||
# RGB LED, LDO2 & Other Pins
|
||||
RGB_DATA = const(40)
|
||||
LDO2 = const(39)
|
||||
LED = const(13)
|
||||
AMB_LIGHT = const(4)
|
||||
|
||||
# SPI
|
||||
SPI_MOSI = const(35)
|
||||
SPI_MISO = const(37)
|
||||
SPI_CLK = const(36)
|
||||
|
||||
# I2C
|
||||
I2C_SDA = const(8)
|
||||
I2C_SCL = const(9)
|
||||
|
||||
# Helper functions
|
||||
|
||||
# LED & Ambient Light Sensor control
|
||||
def led_set(state):
|
||||
"""Set the state of the BLUE LED on IO13"""
|
||||
l = Pin(LED, Pin.OUT)
|
||||
l.value(state)
|
||||
|
||||
|
||||
def led_blink():
|
||||
"""Toggle the BLUE LED on IO13"""
|
||||
l = Pin(LED, Pin.OUT)
|
||||
l.value(not l.value())
|
||||
|
||||
|
||||
# Create ADC and set attenuation and return the ambient light value from the onboard sensor
|
||||
def get_amb_light():
|
||||
"""Get Ambient Light Sensor reading"""
|
||||
adc = ADC(Pin(AMB_LIGHT))
|
||||
adc.atten(ADC.ATTN_11DB)
|
||||
return adc.read()
|
||||
|
||||
|
||||
def set_ldo2_power(state):
|
||||
"""Enable or Disable power to the second LDO"""
|
||||
Pin(LDO2, Pin.OUT).value(state)
|
||||
|
||||
|
||||
def get_battery_voltage():
|
||||
"""
|
||||
Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage
|
||||
This is an approximation only, but useful to detect if the charge state of the battery is getting low.
|
||||
"""
|
||||
adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read
|
||||
measuredvbat = adc.read()
|
||||
measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB
|
||||
measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo
|
||||
return round(measuredvbat, 2)
|
||||
|
||||
|
||||
def get_vbus_present():
|
||||
"""Detect if VBUS (5V) power source is present"""
|
||||
return Pin(VBUS_SENSE, Pin.IN).value() == 1
|
||||
|
||||
|
||||
# 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,12 @@
|
|||
set(IDF_TARGET esp32s3)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.usb
|
||||
boards/sdkconfig.ble
|
||||
boards/sdkconfig.240mhz
|
||||
boards/sdkconfig.spiram_sx
|
||||
boards/UM_TINYS3/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
|
@ -0,0 +1,11 @@
|
|||
#define MICROPY_HW_BOARD_NAME "FeatherS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3"
|
||||
|
||||
#define MICROPY_PY_MACHINE_DAC (0)
|
||||
|
||||
#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,23 @@
|
|||
CONFIG_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=y
|
||||
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv"
|
||||
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS3"
|
||||
|
||||
# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D7
|
||||
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
|
||||
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
|
||||
CONFIG_TINYUSB_DESC_PRODUCT_STRING="FeatherS3"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_fs3_"
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Battery Charging",
|
||||
"RGB LED",
|
||||
"SPIRAM",
|
||||
"USB-C",
|
||||
"WiFi",
|
||||
"BLE",
|
||||
"STEMMA QT/QWIIC",
|
||||
"Feather"
|
||||
],
|
||||
"features_non_filterable": [
|
||||
],
|
||||
"id": "pros3",
|
||||
"images": [
|
||||
"unexpectedmaker_pros3.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "ProS3",
|
||||
"thumbnail": "",
|
||||
"url": "https://pros3.io",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
The following files are daily firmware for the ProS3. This firmware is
|
||||
compiled using ESP-IDF v4.4 or later.
|
|
@ -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 ProS3, 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 `pros3-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 pros3-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 pros3-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 pros3-pros3-firmware-version.bin
|
||||
```
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
|
@ -0,0 +1,66 @@
|
|||
# ProS3 MicroPython Helper Library
|
||||
# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# http://pros3.io
|
||||
|
||||
# Import required libraries
|
||||
from micropython import const
|
||||
from machine import Pin, ADC
|
||||
import time
|
||||
|
||||
# ProS3 Hardware Pin Assignments
|
||||
|
||||
# Sense Pins
|
||||
VBUS_SENSE = const(33)
|
||||
VBAT_SENSE = const(10)
|
||||
|
||||
# RGB LED & LDO2 Pins
|
||||
RGB_DATA = const(18)
|
||||
LDO2 = const(17)
|
||||
|
||||
# SPI
|
||||
SPI_MOSI = const(35)
|
||||
SPI_MISO = const(37)
|
||||
SPI_CLK = const(36)
|
||||
|
||||
# I2C
|
||||
I2C_SDA = const(8)
|
||||
I2C_SCL = const(9)
|
||||
|
||||
# Helper functions
|
||||
def set_ldo2_power(state):
|
||||
"""Enable or Disable power to the second LDO"""
|
||||
Pin(LDO2, Pin.OUT).value(state)
|
||||
|
||||
|
||||
def get_battery_voltage():
|
||||
"""
|
||||
Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage
|
||||
This is an approximation only, but useful to detect if the charge state of the battery is getting low.
|
||||
"""
|
||||
adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read
|
||||
measuredvbat = adc.read()
|
||||
measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB
|
||||
measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo
|
||||
return round(measuredvbat, 2)
|
||||
|
||||
|
||||
def get_vbus_present():
|
||||
"""Detect if VBUS (5V) power source is present"""
|
||||
return Pin(VBUS_SENSE, Pin.IN).value() == 1
|
||||
|
||||
|
||||
# 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,12 @@
|
|||
set(IDF_TARGET esp32s3)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.usb
|
||||
boards/sdkconfig.ble
|
||||
boards/sdkconfig.240mhz
|
||||
boards/sdkconfig.spiram_sx
|
||||
boards/UM_PROS3/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
|
@ -0,0 +1,11 @@
|
|||
#define MICROPY_HW_BOARD_NAME "ProS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3"
|
||||
|
||||
#define MICROPY_PY_MACHINE_DAC (0)
|
||||
|
||||
#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,23 @@
|
|||
CONFIG_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=y
|
||||
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv"
|
||||
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="UMProS3"
|
||||
|
||||
# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D4
|
||||
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
|
||||
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
|
||||
CONFIG_TINYUSB_DESC_PRODUCT_STRING="ProS3"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_ps3_"
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"Battery Charging",
|
||||
"RGB LED",
|
||||
"SPIRAM",
|
||||
"USB-C",
|
||||
"WiFi",
|
||||
"BLE"
|
||||
],
|
||||
"features_non_filterable": [
|
||||
"TinyPICO Compatible"
|
||||
],
|
||||
"id": "tinys3",
|
||||
"images": [
|
||||
"unexpectedmaker_tinys3.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "TinyS3",
|
||||
"thumbnail": "",
|
||||
"url": "https://tinys3.io",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
The following files are daily firmware for the TinyS3. This firmware is
|
||||
compiled using ESP-IDF v4.4 or later.
|
|
@ -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 TinyS3, 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 `tinys3-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 tinys3-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 tinys3-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 tinys3-micropython-firmware-version.bin
|
||||
```
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
|
@ -0,0 +1,66 @@
|
|||
# TinyS3 Helper Library
|
||||
# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# https://tinys3.io
|
||||
|
||||
# Import required libraries
|
||||
from micropython import const
|
||||
from machine import Pin, ADC
|
||||
import time
|
||||
|
||||
# TinyS3 Hardware Pin Assignments
|
||||
|
||||
# Sense Pins
|
||||
VBUS_SENSE = const(33)
|
||||
VBAT_SENSE = const(10)
|
||||
|
||||
# RGB LED Pins
|
||||
RGB_DATA = const(18)
|
||||
RGB_PWR = const(17)
|
||||
|
||||
# SPI
|
||||
SPI_MOSI = const(35)
|
||||
SPI_MISO = const(37)
|
||||
SPI_CLK = const(36)
|
||||
|
||||
# I2C
|
||||
I2C_SDA = const(8)
|
||||
I2C_SCL = const(9)
|
||||
|
||||
# Helper functions
|
||||
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(RGB_PWR, Pin.OUT).value(state)
|
||||
|
||||
|
||||
def get_battery_voltage():
|
||||
"""
|
||||
Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage
|
||||
This is an approximation only, but useful to detect if the charge state of the battery is getting low.
|
||||
"""
|
||||
adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read
|
||||
measuredvbat = adc.read()
|
||||
measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB
|
||||
measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo
|
||||
return round(measuredvbat, 2)
|
||||
|
||||
|
||||
def get_vbus_present():
|
||||
"""Detect if VBUS (5V) power source is present"""
|
||||
return Pin(VBUS_SENSE, Pin.IN).value() == 1
|
||||
|
||||
|
||||
# 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,12 @@
|
|||
set(IDF_TARGET esp32s3)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.usb
|
||||
boards/sdkconfig.ble
|
||||
boards/sdkconfig.240mhz
|
||||
boards/sdkconfig.spiram_sx
|
||||
boards/UM_TINYS3/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
|
@ -0,0 +1,11 @@
|
|||
#define MICROPY_HW_BOARD_NAME "TinyS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3-FN8"
|
||||
|
||||
#define MICROPY_PY_MACHINE_DAC (0)
|
||||
|
||||
#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,23 @@
|
|||
CONFIG_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=y
|
||||
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"
|
||||
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS3"
|
||||
|
||||
# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D1
|
||||
CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100
|
||||
CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker"
|
||||
CONFIG_TINYUSB_DESC_PRODUCT_STRING="TinyS3"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_ts3_"
|
Loading…
Reference in New Issue