Signed-off-by: 吴文峰 <kevin@lmve.net>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
[esp32c6_base]
|
||||
extends = esp32_common
|
||||
platform =
|
||||
# Do not renovate until we have switched to pioarduino tagged builds
|
||||
https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip
|
||||
build_flags =
|
||||
${arduino_base.build_flags}
|
||||
-Wall
|
||||
-Wextra
|
||||
-Isrc/platform/esp32
|
||||
-std=c++11
|
||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||
-DSERIAL_BUFFER_SIZE=4096
|
||||
-DLIBPAX_ARDUINO
|
||||
-DLIBPAX_WIFI
|
||||
-DLIBPAX_BLE
|
||||
-DMESHTASTIC_EXCLUDE_WEBSERVER
|
||||
;-DDEBUG_HEAP
|
||||
; TEMP
|
||||
-DHAS_BLUETOOTH=0
|
||||
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
-DMESHTASTIC_EXCLUDE_BLUETOOTH
|
||||
|
||||
lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
${networking_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
${environmental_extra.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
||||
lewisxhe/XPowersLib@0.3.3
|
||||
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
||||
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
build_src_filter =
|
||||
${esp32_common.build_src_filter} -<mesh/http>
|
||||
|
||||
monitor_speed = 460800
|
||||
monitor_filters = esp32_c3_exception_decoder
|
||||
|
||||
lib_ignore =
|
||||
${esp32_common.lib_ignore}
|
||||
NonBlockingRTTTL
|
||||
NimBLE-Arduino
|
||||
libpax
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define USB_VID 0x2886
|
||||
#define USB_PID 0x0048
|
||||
|
||||
static const uint8_t TX = 16;
|
||||
static const uint8_t RX = 17;
|
||||
|
||||
static const uint8_t SDA = 10;
|
||||
static const uint8_t SCL = 8;
|
||||
|
||||
// Default SPI will be mapped to Radio
|
||||
static const uint8_t MISO = 22;
|
||||
static const uint8_t SCK = 20;
|
||||
static const uint8_t MOSI = 21;
|
||||
static const uint8_t SS = 6;
|
||||
|
||||
// #define SPI_MOSI (11)
|
||||
// #define SPI_SCK (14)
|
||||
// #define SPI_MISO (2)
|
||||
// #define SPI_CS (13)
|
||||
|
||||
// #define SDCARD_CS SPI_CS
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
@@ -0,0 +1,46 @@
|
||||
[env:m5stack-unitc6l]
|
||||
custom_meshtastic_hw_model = 111
|
||||
custom_meshtastic_hw_model_slug = M5STACK_C6L
|
||||
custom_meshtastic_architecture = esp32-c6
|
||||
custom_meshtastic_actively_supported = true
|
||||
custom_meshtastic_support_level = 1
|
||||
custom_meshtastic_display_name = M5Stack Unit C6L
|
||||
custom_meshtastic_images = m5_c6l.svg
|
||||
custom_meshtastic_tags = M5Stack
|
||||
|
||||
extends = esp32c6_base
|
||||
board = esp32-c6-devkitc-1
|
||||
board_upload.flash_size = 16MB
|
||||
board_build.partitions = default_16MB.csv
|
||||
;OpenOCD flash method
|
||||
;upload_protocol = esp-builtin
|
||||
;Normal method
|
||||
upload_protocol = esptool
|
||||
;upload_port = /dev/ttyACM2
|
||||
build_unflags =
|
||||
-D HAS_BLUETOOTH
|
||||
-D MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||
-D HAS_WIFI
|
||||
lib_deps =
|
||||
${esp32c6_base.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=NeoPixel packageName=adafruit/library/Adafruit NeoPixel
|
||||
adafruit/Adafruit NeoPixel@1.15.4
|
||||
# renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino
|
||||
h2zero/NimBLE-Arduino@2.3.7
|
||||
build_flags =
|
||||
${esp32c6_base.build_flags}
|
||||
-D M5STACK_UNITC6L
|
||||
-I variants/esp32c6/m5stack_unitc6l
|
||||
-DMESHTASTIC_EXCLUDE_PAXCOUNTER=1
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-D HAS_BLUETOOTH=1
|
||||
-DCONFIG_BT_NIMBLE_EXT_ADV=1
|
||||
-DCONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=2
|
||||
-D NIMBLE_TWO
|
||||
monitor_speed=115200
|
||||
lib_ignore =
|
||||
NonBlockingRTTTL
|
||||
libpax
|
||||
build_src_filter =
|
||||
${esp32c6_base.build_src_filter} +<../variants/esp32c6/m5stack_unitc6l>
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "driver/gpio.h"
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
// I2C device addr
|
||||
#define PI4IO_M_ADDR 0x43
|
||||
|
||||
// PI4IO registers
|
||||
#define PI4IO_REG_CHIP_RESET 0x01
|
||||
#define PI4IO_REG_IO_DIR 0x03
|
||||
#define PI4IO_REG_OUT_SET 0x05
|
||||
#define PI4IO_REG_OUT_H_IM 0x07
|
||||
#define PI4IO_REG_IN_DEF_STA 0x09
|
||||
#define PI4IO_REG_PULL_EN 0x0B
|
||||
#define PI4IO_REG_PULL_SEL 0x0D
|
||||
#define PI4IO_REG_IN_STA 0x0F
|
||||
#define PI4IO_REG_INT_MASK 0x11
|
||||
#define PI4IO_REG_IRQ_STA 0x13
|
||||
// PI4IO
|
||||
|
||||
#define setbit(x, y) x |= (0x01 << y)
|
||||
#define clrbit(x, y) x &= ~(0x01 << y)
|
||||
#define reversebit(x, y) x ^= (0x01 << y)
|
||||
#define getbit(x, y) ((x) >> (y)&0x01)
|
||||
|
||||
void i2c_read_byte(uint8_t addr, uint8_t reg, uint8_t *value)
|
||||
{
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(reg);
|
||||
Wire.endTransmission();
|
||||
Wire.requestFrom(addr, 1);
|
||||
*value = Wire.read();
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
void i2c_write_byte(uint8_t addr, uint8_t reg, uint8_t value)
|
||||
{
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(reg);
|
||||
Wire.write(value);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
/*******************************************************************/
|
||||
void c6l_init()
|
||||
{
|
||||
// P7 LoRa Reset
|
||||
// P6 RF Switch
|
||||
// P5 LNA Enable
|
||||
|
||||
printf("pi4io_init\n");
|
||||
uint8_t in_data;
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_CHIP_RESET, 0xFF);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_read_byte(PI4IO_M_ADDR, PI4IO_REG_CHIP_RESET, &in_data);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_IO_DIR, 0b11000000); // 0: input 1: output
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_OUT_H_IM, 0b00111100); // 使用到的引脚关闭High-Impedance
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_PULL_SEL, 0b11000011); // pull up/down select, 0 down, 1 up
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_PULL_EN, 0b11000011); // pull up/down enable, 0 disable, 1 enable
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_IN_DEF_STA, 0b00000011); // P0 P1 默认高电平, 按键按下触发中断
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_INT_MASK, 0b11111100); // P0 P1 中断使能 0 enable, 1 disable
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_OUT_SET, 0b10000000); // 默认输出为0
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
i2c_read_byte(PI4IO_M_ADDR, PI4IO_REG_IRQ_STA, &in_data); // 读取IRQ_STA清除标志
|
||||
|
||||
i2c_read_byte(PI4IO_M_ADDR, PI4IO_REG_OUT_SET, &in_data);
|
||||
setbit(in_data, 6); // HIGH
|
||||
i2c_write_byte(PI4IO_M_ADDR, PI4IO_REG_OUT_SET, in_data);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
void c6l_init();
|
||||
|
||||
#define HAS_GPS 1
|
||||
#define GPS_RX_PIN 4
|
||||
#define GPS_TX_PIN 5
|
||||
|
||||
#define I2C_SDA 10
|
||||
#define I2C_SCL 8
|
||||
|
||||
#define PIN_BUZZER 11
|
||||
|
||||
#define HAS_NEOPIXEL // Enable the use of neopixels
|
||||
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
|
||||
#define NEOPIXEL_DATA 2 // gpio pin used to send data to the neopixels
|
||||
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
|
||||
#define ENABLE_AMBIENTLIGHTING // Turn on Ambient Lighting
|
||||
|
||||
// #define BUTTON_PIN 9
|
||||
#define BUTTON_EXTENDER
|
||||
|
||||
#undef LORA_SCK
|
||||
#undef LORA_MISO
|
||||
#undef LORA_MOSI
|
||||
#undef LORA_CS
|
||||
|
||||
// WaveShare Core1262-868M OK
|
||||
// https://www.waveshare.com/wiki/Core1262-868M
|
||||
#define USE_SX1262
|
||||
|
||||
#define LORA_MISO 22
|
||||
#define LORA_SCK 20
|
||||
#define LORA_MOSI 21
|
||||
#define LORA_CS 23
|
||||
#define LORA_RESET RADIOLIB_NC
|
||||
#define LORA_DIO1 7
|
||||
#define LORA_BUSY 19
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY LORA_BUSY
|
||||
#define SX126X_RESET LORA_RESET
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 3.0
|
||||
|
||||
#define USE_SPISSD1306
|
||||
#ifdef USE_SPISSD1306
|
||||
#define SSD1306_NSS 6 // CS
|
||||
#define SSD1306_RS 18 // DC
|
||||
#define SSD1306_RESET 15
|
||||
// #define OLED_DG 1
|
||||
#endif
|
||||
#define SCREEN_TRANSITION_FRAMERATE 10
|
||||
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
|
||||
|
||||
#define SERIAL_PRINT_PORT 1
|
||||
@@ -0,0 +1,11 @@
|
||||
[env:tlora-c6]
|
||||
extends = esp32c6_base
|
||||
board = esp32-c6-devkitm-1
|
||||
board_level = pr
|
||||
build_flags =
|
||||
${esp32c6_base.build_flags}
|
||||
-D TLORA_C6
|
||||
-I variants/esp32c6/tlora_c6
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-ULED_BUILTIN
|
||||
@@ -0,0 +1,23 @@
|
||||
#define I2C_SDA 8 // I2C pins for this board
|
||||
#define I2C_SCL 9
|
||||
|
||||
#define LED_POWER 7 // If defined we will blink this LED
|
||||
#define LED_STATE_ON 0 // State when LED is lit
|
||||
|
||||
#define USE_SX1262
|
||||
#define LORA_SCK 6
|
||||
#define LORA_MISO 1
|
||||
#define LORA_MOSI 0
|
||||
#define LORA_CS 18
|
||||
#define LORA_RESET 21
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_DIO1 23
|
||||
#define SX126X_DIO2 20
|
||||
#define SX126X_BUSY 22
|
||||
#define SX126X_RESET LORA_RESET
|
||||
#define SX126X_RXEN 15
|
||||
#define SX126X_TXEN 14
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
|
||||
#define SERIAL_PRINT_PORT 1
|
||||
Reference in New Issue
Block a user