esp32/boards/UM_FEATHERS3NEO: Add FeatherS3 Neo board definition.
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
This commit is contained in:
parent
230e521515
commit
d775db72b9
9 changed files with 245 additions and 0 deletions
26
ports/esp32/boards/UM_FEATHERS3NEO/board.json
Normal file
26
ports/esp32/boards/UM_FEATHERS3NEO/board.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"docs": "",
|
||||
"features": [
|
||||
"BLE",
|
||||
"Battery Charging",
|
||||
"External Flash",
|
||||
"External RAM",
|
||||
"Feather",
|
||||
"JST-SH",
|
||||
"RGB LED",
|
||||
"USB-C",
|
||||
"WiFi"
|
||||
],
|
||||
"features_non_filterable": [],
|
||||
"images": [
|
||||
"unexpectedmaker_feathers3_neo.jpg"
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"product": "FeatherS3 Neo",
|
||||
"thumbnail": "",
|
||||
"url": "https://esp32s3.com/feathers3neo.html",
|
||||
"vendor": "Unexpected Maker"
|
||||
}
|
||||
1
ports/esp32/boards/UM_FEATHERS3NEO/board.md
Normal file
1
ports/esp32/boards/UM_FEATHERS3NEO/board.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
The following files are firmware for the FeatherS3 Neo.
|
||||
52
ports/esp32/boards/UM_FEATHERS3NEO/deploy.md
Normal file
52
ports/esp32/boards/UM_FEATHERS3NEO/deploy.md
Normal file
|
|
@ -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 Neo, 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 `feathers3neo-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 feathers3neo-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 feathers3neo-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 feathers3neo-micropython-firmware-version.bin
|
||||
```
|
||||
2
ports/esp32/boards/UM_FEATHERS3NEO/manifest.py
Normal file
2
ports/esp32/boards/UM_FEATHERS3NEO/manifest.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
||||
104
ports/esp32/boards/UM_FEATHERS3NEO/modules/feathers3neo.py
Normal file
104
ports/esp32/boards/UM_FEATHERS3NEO/modules/feathers3neo.py
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# FeatherS3 Neo MicroPython Helper Library
|
||||
# MIT license; Copyright (c) 2024 Seon Rozenblum - Unexpected Maker
|
||||
#
|
||||
# Project home:
|
||||
# http://esp32s3.com
|
||||
|
||||
# Import required libraries
|
||||
from micropython import const
|
||||
from machine import Pin, ADC
|
||||
import time
|
||||
|
||||
# FeatherS3 Hardware Pin Assignments
|
||||
|
||||
# Sense Pins
|
||||
VBUS_SENSE = const(15)
|
||||
VBAT_SENSE = const(2)
|
||||
|
||||
# LDO2 & Other Pins
|
||||
LDO2 = const(39)
|
||||
LED = const(13)
|
||||
AMB_LIGHT = const(4)
|
||||
|
||||
# RGB LED Pins
|
||||
RGB_DATA = const(40)
|
||||
RGB_PWR = const(39)
|
||||
|
||||
# RGB MATRIX LED Pins
|
||||
RGB_MATRIX_DATA = const(16)
|
||||
RGB_MATRIX_PWR = const(39)
|
||||
|
||||
# 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, which is the LDO that powers the following items
|
||||
RGB Matrix, RGB status LED, Ambient light Sensor.
|
||||
This is ON by default and will automatically shut down when the ESP32 going into deep sleep.
|
||||
"""
|
||||
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
|
||||
# Max voltage on ADC input will be 4.2V divided by R2 (442K) & R5 (160K), 4.2 / (160+442) * 160 = 1.1163V
|
||||
adc.atten(ADC.ATTN_2_5DB) # Needs 2.5DB attenuation to read a max voltage of 1.1163V
|
||||
# Use read_uv() to get ADC reading as this will use the on-chip calibration data
|
||||
measuredvbat = adc.read_uv() / 1000000 # Read micovolts and convert to volts
|
||||
measuredvbat *= 3.7624 # Multiply by ratio of battery voltage to ADC pin voltage: 4.2/1.1163
|
||||
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
|
||||
13
ports/esp32/boards/UM_FEATHERS3NEO/mpconfigboard.cmake
Normal file
13
ports/esp32/boards/UM_FEATHERS3NEO/mpconfigboard.cmake
Normal file
|
|
@ -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_FEATHERS3NEO/sdkconfig.board
|
||||
)
|
||||
|
||||
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
||||
10
ports/esp32/boards/UM_FEATHERS3NEO/mpconfigboard.h
Normal file
10
ports/esp32/boards/UM_FEATHERS3NEO/mpconfigboard.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#define MICROPY_HW_BOARD_NAME "FeatherS3 Neo"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32-S3"
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "FeatherS3 Neo"
|
||||
|
||||
#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)
|
||||
16
ports/esp32/boards/UM_FEATHERS3NEO/pins.csv
Normal file
16
ports/esp32/boards/UM_FEATHERS3NEO/pins.csv
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
AMB_LIGHT,GPIO4
|
||||
I2C_SCL,GPIO9
|
||||
I2C_SDA,GPIO8
|
||||
LDO2_PWR,GPIO39
|
||||
LED_BLUE,GPIO13
|
||||
SPI_MOSI,GPIO35
|
||||
SPI_SCK,GPIO36
|
||||
SPI_MISO,GPIO37
|
||||
RGB_DATA,GPIO40
|
||||
RGB_PWR,GPIO39
|
||||
RGB_MATRIX_DATA,GPIO16
|
||||
RGB_MATRIX_PWR,GPIO39
|
||||
UART0_TX,GPIO43
|
||||
UART0_RX,GPIO44
|
||||
VBAT_SENSE,GPIO2
|
||||
VBUS_SENSE,GPIO15
|
||||
|
21
ports/esp32/boards/UM_FEATHERS3NEO/sdkconfig.board
Normal file
21
ports/esp32/boards/UM_FEATHERS3NEO/sdkconfig.board
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=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="UMFeatherS3Neo"
|
||||
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A
|
||||
CONFIG_TINYUSB_DESC_CUSTOM_PID=0x81FC
|
||||
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="FeatherS3 Neo"
|
||||
CONFIG_TINYUSB_DESC_SERIAL_STRING="_fs3neo_"
|
||||
Loading…
Reference in a new issue