mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-22 03:02:08 +10:00
Cardputer beta (#10063)
* 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> * fix cardputer sound * Add I2S BLEEBLEs * MenuHandler ifdefs * add generic tone -> I2S RTTTL conversion * not needed --------- Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
Thomas Göttgens
Ben Meadors
Manuel
parent
c4c4fe7082
commit
64cda52920
@@ -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,27 @@
|
||||
; 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 ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-I variants/esp32s3/m5stack_cardputer_adv
|
||||
build_src_filter =
|
||||
${esp32s3_base.build_src_filter}
|
||||
+<../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=git-refs depName=ESP8266Audio packageName=https://github.com/meshtastic/ESP8266Audio gitBranch=meshtastic-2.0.0-dacfix
|
||||
https://github.com/meshtastic/ESP8266Audio/archive/343024632ee78d6216907b2353fc943a62422d80.zip
|
||||
# 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,40 @@
|
||||
#include "AudioBoard.h"
|
||||
#include "configuration.h"
|
||||
|
||||
DriverPins PinsAudioBoardES8311;
|
||||
AudioBoard board(AudioDriverES8311, PinsAudioBoardES8311);
|
||||
|
||||
// M5stack Cardputer ADV specific init
|
||||
|
||||
void lateInitVariant()
|
||||
{
|
||||
// AudioDriverLogger.begin(Serial, AudioDriverLogLevel::Debug);
|
||||
// I2C: function, scl, sda
|
||||
PinsAudioBoardES8311.addI2C(PinFunction::CODEC, Wire);
|
||||
// I2S: function, mclk, bck, ws, data_out, data_in
|
||||
PinsAudioBoardES8311.addI2S(PinFunction::CODEC, DAC_I2S_MCLK, DAC_I2S_BCK, DAC_I2S_WS, DAC_I2S_DOUT, DAC_I2S_DIN);
|
||||
|
||||
// configure codec
|
||||
CodecConfig cfg;
|
||||
cfg.input_device = ADC_INPUT_LINE1;
|
||||
cfg.output_device = DAC_OUTPUT_ALL;
|
||||
cfg.i2s.bits = BIT_LENGTH_16BITS;
|
||||
cfg.i2s.rate = RATE_44K;
|
||||
board.begin(cfg);
|
||||
|
||||
// extra ES8311 init
|
||||
auto es8311_write_reg = [](uint8_t reg, uint8_t val) {
|
||||
Wire.beginTransmission(0x18); // ES8311 i2c address
|
||||
Wire.write(reg);
|
||||
Wire.write(val);
|
||||
Wire.endTransmission();
|
||||
};
|
||||
es8311_write_reg(0x00, 0x80); // reset, power on
|
||||
es8311_write_reg(0x01, 0xB5); // MCLK = BCLK
|
||||
es8311_write_reg(0x02, 0x18); // CLOCK_MANAGER/ MULT_PRE=3
|
||||
es8311_write_reg(0x0D, 0x01); // analog power up
|
||||
es8311_write_reg(0x12, 0x00); // DAC power up
|
||||
es8311_write_reg(0x13, 0x10); // enable HP drive
|
||||
es8311_write_reg(0x32, 0xBF); // DAC volume (0dB)
|
||||
es8311_write_reg(0x37, 0x08); // EQ bypass
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user