Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rouing committed Dec 18, 2024
1 parent 1d09214 commit 0820bf6
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 228 deletions.
4 changes: 2 additions & 2 deletions ports/lilygo-t-embed-cc1101/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void _setup_gpio() {
#ifdef T_EMBED_1101
// T-Embed CC1101 has a antenna circuit optimized to each frequency band, controlled by SW0 and SW1
//Set antenna frequency settings
pinMode(BOARD_LORA_SW1, OUTPUT);
pinMode(BOARD_LORA_SW0, OUTPUT);
pinMode(CC1101_SW1_PIN, OUTPUT);
pinMode(CC1101_SW0_PIN, OUTPUT);

// Chip Select CC1101 to HIGH State
pinMode(CC1101_SS_PIN, OUTPUT);
Expand Down
198 changes: 198 additions & 0 deletions ports/lilygo-t-embed-cc1101/pinmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#include <FastLED.h>
/**
* SD Card
* CS 13
* SCLK 11
* MOSI 09
* MISO 10
*
* QWIIC 1
* SDA 8
* SCL 18
*
* QWIIC 2
* TX 43
* RX 44
*
* IR
* EN 02
* RX 01
*
* LORA
* CS 12
* SCLK 11
* MOSI 9
* MISO 10
* GDO0 3
* GDO2 38
* SW1 47
* SW0 48
*
* LCD
* BL 21
* DC 16
* CS 41
* SCLK 11
* MOSI 9
* RES 40
*
* RGB LED
* DATA 14
*
* Encoder
* A 4
* B 5
* BUTTON 0 (BOOT)
*
* Mic
* DATA 42
* CLK 49
*
* PN532
* SCL 18
* SDA 8
* IRQ 17
* RF_RES 45
*
* Speaker
* BCLK 46
* WCLK 40
* DOUT 7
*/
// Lite Version
// #define LITE_VERSION 1

// Main I2C Bus
#define SPI_SS_PIN 8
#define SPI_MOSI_PIN 9
#define SPI_MISO_PIN 10
#define SPI_SCK_PIN 11

// Set Main I2C Bus
#define GROVE_SDA 8
#define GROVE_SCL 18

// TFT_eSPI display
#define ST7789_DRIVER 1
#define USER_SETUP_LOADED
#define USE_HSPI_PORT
#define SMOOTH_FONT
#define TFT_INVERSION_ON
#define TFT_WIDTH 170
#define TFT_HEIGHT 320
#define TFT_BL 21
#define TFT_MISO SPI_MISO_PIN
#define TFT_MOSI SPI_MOSI_PIN
#define TFT_SCLK SPI_SCK_PIN
#define TFT_CS 41
#define TFT_DC 16
#define TFT_RST -1
#define TOUCH_CS -1
#define SPI_FREQUENCY 80000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000

// Display Setup
#define HAS_SCREEN
#define ROTATION 3
#define WIDTH TFT_HEIGHT
#define HEIGHT TFT_WIDTH
#define BACKLIGHT TFT_BL
#define MINBRIGHT 1
#define PIN_POWER_ON 15

// Font Sizes
#define FP 1
#define FM 2
#define FG 3

// SD Card
#define SDCARD_CS 13
#define SDCARD_MISO SPI_MISO_PIN
#define SDCARD_MOSI SPI_MOSI_PIN
#define SDCARD_SCK SPI_SCK_PIN

// NRF24 - Over QWIIC Port #2
#define USE_NRF24_VIA_SPI
#define NRF24_CE_PIN 43
#define NRF24_SS_PIN 44
#define NRF24_MOSI_PIN SDCARD_MOSI
#define NRF24_SCK_PIN SDCARD_SCK
#define NRF24_MISO_PIN SDCARD_MISO

// CC1101
#define USE_CC1101_VIA_SPI
#define CC1101_GDO0_PIN 3
#define CC1101_GDO2_PIN 38
#define CC1101_SW1_PIN 47
#define CC1101_SW0_PIN 48
#define CC1101_SS_PIN 12
#define CC1101_MISO_PIN SPI_MISO_PIN
#define CC1101_MOSI_PIN SPI_MOSI_PIN
#define CC1101_SCK_PIN SPI_SCK_PIN

//PN532
#define PN532_RF_REST 45
#define PN532_IRQ 17

// Mic
#define MIC_SPM1423
#define PIN_CLK 39
#define PIN_DATA 42

// Speaker
#define HAS_NS4168_SPKR
#define BCLK 46
#define WCLK 40
#define DOUT 7
#define MCLK PIN_CLK

// Serial
#define SERIAL_TX 43
#define SERIAL_RX 44

// Fuel Gauge
#define USE_BQ27220_VIA_I2C
#define BQ27220_I2C_ADDRESS 0x55
#define BQ27220_I2C_SDA GROVE_SDA
#define BQ27220_I2C_SCL GROVE_SCL

// Encoder
#define ENCODER_INA 4
#define ENCODER_INB 5
#define ENCODER_KEY 0
#define HAS_BTN 1
#define BTN_ALIAS '"Mid"'
#define SEL_BTN ENCODER_KEY
#define UP_BTN -1
#define DW_BTN -1
#define BK_BTN 6
#define BTN_ACT LOW

// IR
#define IR_TX_PINS '{{"Default", 2}, {"Pin 43", 43}, {"Pin 44", 44}}'
#define IR_RX_PINS '{{"Default", 1}, {"Pin 43", 43}, {"Pin 44", 44}}'
#define LED 2
#define RXLED 1
#define LED_ON HIGH
#define LED_OFF LOW

// RF Module
#define RF_TX_PINS '{{"Pin 43", 43}, {"Pin 44", 44}}'
#define RF_RX_PINS '{{"Pin 43", 43}, {"Pin 44", 44}}'

// FM
// #define FM_SI4713
// #define FM_RSTPIN 40

// RTC
// #define HAS_RTC

// RGB LED
// #define HAS_RGB_LED
// #define RGB_LED=21

// BadUSB
#define USB_as_HID=1
// #define BAD_TX=GROVE_SDA
//#define BAD_RX=GROVE_SCL
151 changes: 5 additions & 146 deletions ports/lilygo-t-embed-cc1101/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0
board = lilygo-t-display-s3
framework = arduino
board_build.partitions = custom_16Mb.csv
build_src_filter =${env.build_src_filter} +<../ports/lilygo-t-embed-cc1101>
build_src_filter = ${env.build_src_filter} +<../ports/lilygo-t-embed-cc1101>
build_flags =
${env.build_flags}
-Iports/lilygo-t-embed-cc1101
Expand All @@ -31,162 +31,21 @@ build_flags =
;settings.cpp: need map brighness control
;main.cpp: need set startup
;serialcmds.cpp: need set power off command
-DBOARD_LORA_SW1=47
-DBOARD_LORA_SW0=48

# Config to use IRQ and RST pins of PN532, if needed
-DPN532_RF_REST=45
-DPN532_IRQ=17

;Features Enabled
;FM Radio
;-DFM_SI4713=1 ;Uncomment to activate FM Radio using Adafruit Si4713
-DFM_RSTPIN=40
;-DLITE_VERSION=1 ;limits some features to save space for M5Launcher Compatibility
;Microphone
-DMIC_SPM1423=1 ;uncomment to enable Applicable for SPM1423 device
-DPIN_CLK=39
-DI2S_SCLK_PIN=39
-DI2S_DATA_PIN=42
-DPIN_DATA=42

;RGB LED runned by xylopyrographer/LiteLED@^1.2.0 library
;-DHAS_RGB_LED=1 ;uncomment to enable
-DRGB_LED=21

;Have RTC Chip
;-DHAS_RTC=1

; SERIAL (GPS) dedicated pins
-DSERIAL_TX=43 ;may be wrong
-DSERIAL_RX=44

;Speaker to run music, compatible with NS4168
-DHAS_NS4168_SPKR=1 ;uncomment to enable
-DBCLK=46
-DWCLK=40
-DDOUT=7
-DMCLK=39 # Microphone CLK

;Can run USB as HID
-DUSB_as_HID=1 ;uncomment to enable
;-DBAD_TX=GROVE_SDA
;-DBAD_RX=GROVE_SCL

;Battery ADC read pin
;-DBAT_PIN=10

;BQ27220 Fuel Gauge
-DBQ27220_I2C_ADDRESS=0x55
-DBQ27220_I2C_SDA=GROVE_SDA
-DBQ27220_I2C_SCL=GROVE_SCL

;Buttons configuration
-DHAS_BTN=1
-DBTN_ALIAS='"Mid"'
-DSEL_BTN=0
-DUP_BTN=-1 ;Dont have btns, use a encoder
-DDW_BTN=-1 ;Dont have btns, use a encoder
-DBK_BTN=6
-DBTN_ACT=LOW

-DENCODER_INA=4
-DENCODER_INB=5
-DENCODER_KEY=0

;-DALLOW_ALL_GPIO_FOR_IR_RF=1 ; Set this option to make use of all GPIOs, from 1 to 44 to be chosen, except TFT and SD pins

;Infrared Led default pin and state
-DIR_TX_PINS='{{"Default", 2}, {"Pin 43", 43}, {"Pin 44", 44}}'
-DIR_RX_PINS='{{"Default", 1}, {"Pin 43", 43}, {"Pin 44", 44}}'
-DLED=2 ;NEED TO SET SOMETHING HERE, at least -1
-DRXLED=1
-DLED_ON=HIGH
-DLED_OFF=LOW

;Radio Frequency (one pin modules) pin setting
-DRF_TX_PINS='{{"Pin 43", 43}, {"Pin 44", 44}}'
-DRF_RX_PINS='{{"Pin 43", 43}, {"Pin 44", 44}}'

;CC1101 SPI connection pins
; best connection pins for higher speed https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/spi_master.html#gpio-matrix-and-io-mux
-DUSE_CC1101_VIA_SPI
-DCC1101_GDO0_PIN=3 ; or 38, or 47 or 48?
-DCC1101_SS_PIN=12
-DCC1101_MOSI_PIN=SPI_MOSI_PIN
-DCC1101_SCK_PIN=SPI_SCK_PIN
-DCC1101_MISO_PIN=SPI_MISO_PIN
-DCC1101_GDO2_PIN=38 ; optional

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=43 ; left Grove
-DNRF24_SS_PIN=44 ; chip select
-DNRF24_MOSI_PIN=SDCARD_MOSI
-DNRF24_SCK_PIN=SDCARD_SCK
-DNRF24_MISO_PIN=SDCARD_MISO

;Font sizes, depending on device
-DFP=1
-DFM=2
-DFG=3

;Screen Setup
-DHAS_SCREEN=1
-DROTATION=3
-DWIDTH=320
-DHEIGHT=170
-DBACKLIGHT=TFT_BL
-DMINBRIGHT=1
-DPIN_POWER_ON=15

;TFT_eSPI display
-DUSER_SETUP_LOADED=1
-DUSE_HSPI_PORT=1
-DST7789_DRIVER=1
-DTFT_WIDTH=170
-DTFT_HEIGHT=320
-DTFT_INVERSION_ON
-DTFT_BL=21
-DTFT_MISO=SPI_MISO_PIN
-DTFT_MOSI=SPI_MOSI_PIN
-DTFT_SCLK=SPI_SCK_PIN
-DTFT_CS=41
-DTFT_DC=16
-DTFT_RST=-1
-DTOUCH_CS=-1
-DSMOOTH_FONT=1
-DSPI_FREQUENCY=80000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

;SD Card Setup pins
-DSDCARD_CS=13
-DSDCARD_SCK=SPI_SCK_PIN
-DSDCARD_MISO=SPI_MISO_PIN
-DSDCARD_MOSI=SPI_MOSI_PIN

;Default I2C port
-DGROVE_SDA=8
-DGROVE_SCL=18

-DSPI_SCK_PIN=11
-DSPI_MOSI_PIN=9
-DSPI_MISO_PIN=10
-DSPI_SS_PIN=8

lib_deps =
${env.lib_deps}
lewisxhe/XPowersLib @0.2.6
mathertel/RotaryEncoder @1.5.3


######################################################################################################
######################################################################################################
######################################################################################################
[env:lilygo-t-embed]
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = lilygo-t-display-s3
framework = arduino
board_build.partitions = custom_16Mb.csv
build_src_filter =${env.build_src_filter} +<../ports/lilygo-t-embed-cc1101>
build_src_filter =${env.build_src_filter}
build_flags =
${env.build_flags}
-Iports/lilygo-t-embed-cc1101
Expand Down
Loading

0 comments on commit 0820bf6

Please sign in to comment.