BAT_ADC (GPIO4) sits between two 100k resistors on the switched supply rail, so it reads the cell on battery and ~4.4 V on USB; above 4.25 V is reported as USB power. On battery the caption shows a glyph + percentage from a LiPo OCV table; the menu shows voltage and source. Menu lists now wrap at both ends.
33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// Pin map for the two LilyGO T-Embed variants, taken from LilyGO's own
|
|
// examples/factory/pin_config.h (2022 board) and examples/utilities.h (CC1101).
|
|
typedef enum { BOARD_TEMBED = 0, BOARD_TEMBED_CC1101 = 1 } board_variant_t;
|
|
|
|
typedef struct {
|
|
board_variant_t variant;
|
|
const char *name;
|
|
int pwr_en; // must be driven high or the board powers down on battery
|
|
// 1.9" ST7789 170x320, SPI
|
|
int lcd_mosi, lcd_miso, lcd_sclk, lcd_cs, lcd_dc, lcd_rst, lcd_bl;
|
|
bool lcd_bgr; // colour order the panel wants (TFT_eSPI setups differ per variant)
|
|
// rotary encoder + its push button (GPIO0), optional extra key
|
|
int enc_a, enc_b, enc_btn, user_key;
|
|
// LED ring: APA102 (SPI, clk+data) on the original, WS2812 (one wire) on the CC1101
|
|
bool led_ws2812;
|
|
int led_clk, led_data, led_count;
|
|
// battery voltage divider (original board only; -1 = none)
|
|
int bat_adc;
|
|
// I2C, used only to tell the two boards apart
|
|
int i2c_sda, i2c_scl;
|
|
// chip selects sharing the LCD SPI bus on the CC1101 board; parked high
|
|
int spi_other_cs[3];
|
|
} board_t;
|
|
|
|
extern const board_t *board;
|
|
|
|
// Latches power, picks the variant (probe or Kconfig) and parks unused chip selects.
|
|
void board_init(void);
|