esp32/boards: Add M5STACK_ATOM board definition.
ATOM is a very small ESP32 development board produced by M5Stack, with a size of 24mm * 24mm, with peripherals such as WS2812, IR, button, MPU6886 (Only Matrix), and 8 GPIO extensions. It also has a plastic shell.
This commit is contained in:
parent
a6a8941d84
commit
a18f695e29
2
ports/esp32/boards/M5STACK_ATOM/manifest.py
Normal file
2
ports/esp32/boards/M5STACK_ATOM/manifest.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
include("$(PORT_DIR)/boards/manifest.py")
|
||||||
|
freeze("modules")
|
75
ports/esp32/boards/M5STACK_ATOM/modules/atom.py
Normal file
75
ports/esp32/boards/M5STACK_ATOM/modules/atom.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# M5Stack ATOM MicroPython Helper Library
|
||||||
|
# MIT license; Copyright (c) 2021 IAMLIUBO work for M5STACK
|
||||||
|
#
|
||||||
|
# Hardware details:
|
||||||
|
# ATOM Lite https://docs.m5stack.com/en/core/atom_lite
|
||||||
|
# ATOM Matrix https://docs.m5stack.com/en/core/atom_matrix
|
||||||
|
|
||||||
|
from micropython import const
|
||||||
|
from machine import Pin
|
||||||
|
import neopixel
|
||||||
|
|
||||||
|
# M5STACK ATOM Hardware Pin Assignments
|
||||||
|
"""
|
||||||
|
FRONT
|
||||||
|
|3V3|
|
||||||
|
|G21| IR G12 |G22|
|
||||||
|
|G25| BTN G39 |G19|
|
||||||
|
| 5V| WS2812 G27 |G23|
|
||||||
|
|GNG| MPU G21 G25 |G33|
|
||||||
|
G32 G26 5V GND
|
||||||
|
Grove Port
|
||||||
|
"""
|
||||||
|
|
||||||
|
# WS2812
|
||||||
|
WS2812_PIN = const(27)
|
||||||
|
|
||||||
|
# Button
|
||||||
|
BUTTON_PIN = const(39)
|
||||||
|
|
||||||
|
# IR
|
||||||
|
IR_PIN = const(12)
|
||||||
|
|
||||||
|
# I2C
|
||||||
|
I2C0_SCL_PIN = const(21)
|
||||||
|
I2C0_SDA_PIN = const(25)
|
||||||
|
|
||||||
|
# Grove port
|
||||||
|
GROVE_PORT_PIN = (const(26), const(32))
|
||||||
|
|
||||||
|
|
||||||
|
class ATOM:
|
||||||
|
def __init__(self, np_n):
|
||||||
|
self._np = neopixel.NeoPixel(pin=Pin(WS2812_PIN), n=np_n)
|
||||||
|
self._btn = Pin(BUTTON_PIN, Pin.IN, Pin.PULL_UP)
|
||||||
|
|
||||||
|
def get_button_status(self):
|
||||||
|
return self._btn.value()
|
||||||
|
|
||||||
|
def set_button_callback(self, cb):
|
||||||
|
self._btn.irq(trigger=Pin.IRQ_FALLING, handler=cb)
|
||||||
|
|
||||||
|
def set_pixel_color(self, num, r, g, b):
|
||||||
|
if num <= self._np.n:
|
||||||
|
self._np[num] = [r, g, b]
|
||||||
|
self._np.write()
|
||||||
|
|
||||||
|
def get_pixel_color(self, num):
|
||||||
|
if num <= self._np.n:
|
||||||
|
return self._np[num]
|
||||||
|
|
||||||
|
def set_pixels_color(self, r, g, b):
|
||||||
|
self._np.fill([r, g, b])
|
||||||
|
self._np.write()
|
||||||
|
|
||||||
|
|
||||||
|
class Lite(ATOM):
|
||||||
|
# WS2812 number: 1
|
||||||
|
def __init__(self):
|
||||||
|
super(Lite, self).__init__(np_n=1)
|
||||||
|
|
||||||
|
|
||||||
|
class Matrix(ATOM):
|
||||||
|
# WS2812 number: 25
|
||||||
|
def __init__(self):
|
||||||
|
super(Matrix, self).__init__(np_n=25)
|
10
ports/esp32/boards/M5STACK_ATOM/mpconfigboard.cmake
Normal file
10
ports/esp32/boards/M5STACK_ATOM/mpconfigboard.cmake
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set(SDKCONFIG_DEFAULTS
|
||||||
|
boards/sdkconfig.base
|
||||||
|
boards/sdkconfig.ble
|
||||||
|
boards/sdkconfig.240mhz
|
||||||
|
boards/M5STACK_ATOM/sdkconfig.board
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT MICROPY_FROZEN_MANIFEST)
|
||||||
|
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
|
||||||
|
endif()
|
2
ports/esp32/boards/M5STACK_ATOM/mpconfigboard.h
Normal file
2
ports/esp32/boards/M5STACK_ATOM/mpconfigboard.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#define MICROPY_HW_BOARD_NAME "M5Stack ATOM"
|
||||||
|
#define MICROPY_HW_MCU_NAME "ESP32-PICO-D4"
|
5
ports/esp32/boards/M5STACK_ATOM/sdkconfig.board
Normal file
5
ports/esp32/boards/M5STACK_ATOM/sdkconfig.board
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CONFIG_FLASHMODE_QIO=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||||
|
CONFIG_SPIRAM_SPEED_80M=y
|
||||||
|
CONFIG_ESP32_REV_MIN_1=y
|
||||||
|
CONFIG_LWIP_LOCAL_HOSTNAME="M5StackATOM"
|
Loading…
Reference in New Issue
Block a user