Cardputer Kit (#9540)

* Cardputer Kit
BMI270 WIP

* BMI270 support

* verify that the number of bytes read matches the requested length

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* trunk'd

* remove excessive logging

* Kick the screen when unsleeping

* Update the st7789 library, and enable displayon and displayoff

* Battery detection

* Default to arrow keys and enter, while in menus.

* Enable Backlight control

* Update src/detect/ScanI2CTwoWire.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* updateState method now accepts shouldRequestFocus parameter for better maintainability

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Thomas Göttgens
2026-03-06 05:34:41 -06:00
committed by GitHub
co-authored by GitHub Copilot Jonathan Bennett Ben Meadors
parent afd5e29bce
commit 969aefa551
19 changed files with 1106 additions and 54 deletions
@@ -0,0 +1,20 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include "soc/soc_caps.h"
#include <stdint.h>
#define USB_VID 0x303a // USB JTAG/serial debug unit ID
#define USB_PID 0x1001 // USB JTAG/serial debug unit ID
static const uint8_t SS = 5;
static const uint8_t SDA = 8;
static const uint8_t SCL = 9;
static const uint8_t ADC = 10;
static const uint8_t TXD2 = 13;
static const uint8_t MOSI = 14;
static const uint8_t RXD2 = 15;
static const uint8_t MISO = 39;
static const uint8_t SCK = 40;
#endif
@@ -0,0 +1,25 @@
; M5stack Cardputer Advanced
[env:m5stack-cardputer-adv]
extends = esp32s3_base
board = m5stack-stamps3
board_check = true
board_build.partitions = default_8MB.csv
upload_protocol = esptool
build_flags =
${esp32s3_base.build_flags}
-D M5STACK_CARDPUTER_ADV
-D BOARD_HAS_PSRAM
-D ARDUINO_USB_CDC_ON_BOOT=1
-I variants/esp32s3/m5stack_cardputer_adv
lib_deps =
${esp32s3_base.lib_deps}
# renovate: datasource=git-refs depName=meshtastic-st7789 packageName=https://github.com/meshtastic/st7789 gitBranch=main
https://github.com/meshtastic/st7789/archive/9ee76d6b18b9a8f45a2c5cae06b1134a587691eb.zip
# # renovate: datasource=github-tags depName=pschatzmann_arduino-audio-driver packageName=pschatzmann/arduino-audio-driver
# https://github.com/pschatzmann/arduino-audio-driver/archive/v0.2.1.zip
# renovate: datasource=custom.pio depName=ESP8266Audio packageName=earlephilhower/library/ESP8266Audio
earlephilhower/ESP8266Audio@1.9.9
# renovate: datasource=custom.pio depName=ESP8266SAM packageName=earlephilhower/library/ESP8266SAM
earlephilhower/ESP8266SAM@1.1.0
# renovate: datasource=custom.pio depName=NeoPixel packageName=adafruit/library/Adafruit NeoPixel
adafruit/Adafruit NeoPixel@1.15.2
@@ -0,0 +1,90 @@
#define USE_ST7789
#define ST7789_NSS 37
#define ST7789_RS 34 // DC
#define ST7789_SDA 35 // MOSI
#define ST7789_SCK 36
#define ST7789_RESET 33
#define ST7789_MISO -1
#define ST7789_BUSY -1
// #define VTFT_CTRL 38
#define VTFT_LEDA 38
// #define ST7789_BL (32+6)
#define ST7789_SPI_HOST SPI2_HOST
// #define TFT_BL (32+6)
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_HEIGHT 135
#define TFT_WIDTH 240
#define TFT_OFFSET_X 0
#define TFT_OFFSET_Y 0
#define HAS_PHYSICAL_KEYBOARD 1
// Backlight is controlled to power rail on this board, this also powers the neopixel
// #define PIN_POWER_EN 38
#define BUTTON_PIN 0
#define I2C_SDA 8
#define I2C_SCL 9
#define I2C_SDA1 2
#define I2C_SCL1 1
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 40
#define LORA_MISO 39
#define LORA_MOSI 14
#define LORA_CS 5 // NSS
#define USE_SX1262
#define LORA_DIO0 -1
#define LORA_RESET 3
#define LORA_RST 3
#define LORA_DIO1 4
#define LORA_DIO2 6
#define LORA_DIO3 RADIOLIB_NC
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define TCXO_OPTIONAL
#undef GPS_RX_PIN
#undef GPS_TX_PIN
#define GPS_RX_PIN 15
#define GPS_TX_PIN 13
#define HAS_GPS 1
#define GPS_BAUDRATE 115200
// audio codec ES8311
#define HAS_I2S
#define DAC_I2S_BCK 41
#define DAC_I2S_WS 43
#define DAC_I2S_DOUT 42
#define DAC_I2S_DIN 46
#define DAC_I2S_MCLK 45 // dummy
// TCA8418 keyboard
#define I2C_NO_RESCAN
#define KB_INT 11
#define HAS_NEOPIXEL
#define NEOPIXEL_COUNT 1
#define NEOPIXEL_DATA 21
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800)
#define BATTERY_PIN 10 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO10_CHANNEL
#define ADC_MULTIPLIER 2 * 1.02 // 100k + 100k, and add 2% to kick the voltage over the max voltage to show charging.
// BMI270 6-axis IMU on internal I2C bus
#define HAS_BMI270