Skip to content

Commit f85db18

Browse files
refactor: use macro from ttgo repo for readability
1 parent 955b732 commit f85db18

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

variants/lilygo_techo_lite/variant.h

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
////////////////////////////////////////////////////////////////////////////////
2222
// Power
2323

24-
#define PIN_PWR_EN (30) // RT9080_EN
24+
#define PIN_PWR_EN _PINNUM(0, 30) // RT9080_EN
2525

26-
#define BATTERY_PIN (0 + 2)
26+
#define BATTERY_PIN _PINNUM(0, 2)
2727
#define ADC_MULTIPLIER (4.90F)
2828

2929
#define ADC_RESOLUTION (14)
@@ -47,38 +47,38 @@
4747
////////////////////////////////////////////////////////////////////////////////
4848
// I2C pin definition
4949

50-
#define PIN_WIRE_SDA (4) // (SDA)
51-
#define PIN_WIRE_SCL (2) // (SCL)
50+
#define PIN_WIRE_SDA _PINNUM(0, 4) // (SDA)
51+
#define PIN_WIRE_SCL _PINNUM(0, 2) // (SCL)
5252

5353
////////////////////////////////////////////////////////////////////////////////
5454
// SPI pin definition
5555

56-
#define SPI_INTERFACES_COUNT (2)
56+
#define SPI_INTERFACES_COUNT _PINNUM(0, 2)
5757

58-
#define PIN_SPI_MISO (17) // (MISO)
59-
#define PIN_SPI_MOSI (15) // (MOSI)
60-
#define PIN_SPI_SCK (13) // (SCK)
58+
#define PIN_SPI_MISO _PINNUM(0, 17) // (MISO)
59+
#define PIN_SPI_MOSI _PINNUM(0, 15) // (MOSI)
60+
#define PIN_SPI_SCK _PINNUM(0, 13) // (SCK)
6161
#define PIN_SPI_NSS (-1)
6262

6363
////////////////////////////////////////////////////////////////////////////////
6464
// QSPI FLASH
6565

66-
#define PIN_QSPI_SCK (4)
67-
#define PIN_QSPI_CS (12)
68-
#define PIN_QSPI_IO0 (6)
69-
#define PIN_QSPI_IO1 (8)
70-
#define PIN_QSPI_IO2 (32 + 9)
71-
#define PIN_QSPI_IO3 (26)
66+
#define PIN_QSPI_SCK _PINNUM(0, 4)
67+
#define PIN_QSPI_CS _PINNUM(0, 12)
68+
#define PIN_QSPI_IO0 _PINNUM(0, 6)
69+
#define PIN_QSPI_IO1 _PINNUM(0, 8)
70+
#define PIN_QSPI_IO2 _PINNUM(1, 9)
71+
#define PIN_QSPI_IO3 _PINNUM(0, 26)
7272

7373
#define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR
7474
#define EXTERNAL_FLASH_USE_QSPI
7575

7676
////////////////////////////////////////////////////////////////////////////////
7777
// Builtin LEDs
7878

79-
#define LED_RED (32 + 14) // LED_3
80-
#define LED_BLUE (32 + 5) // LED_2
81-
#define LED_GREEN (32 + 7) // LED_1
79+
#define LED_RED _PINNUM(1, 14) // LED_3
80+
#define LED_BLUE _PINNUM(1, 5) // LED_2
81+
#define LED_GREEN _PINNUM(1, 7) // LED_1
8282

8383
//#define PIN_STATUS_LED LED_BLUE
8484
#define LED_BUILTIN (-1)
@@ -88,11 +88,11 @@
8888
////////////////////////////////////////////////////////////////////////////////
8989
// Builtin buttons
9090

91-
#define PIN_BUTTON1 (24) // BOOT
91+
#define PIN_BUTTON1 _PINNUM(0, 24) // BOOT
9292
#define BUTTON_PIN PIN_BUTTON1
9393
#define PIN_USER_BTN BUTTON_PIN
9494

95-
#define PIN_BUTTON2 (18)
95+
#define PIN_BUTTON2 _PINNUM(0, 18)
9696
#define BUTTON_PIN2 PIN_BUTTON2
9797

9898
#define EXTERNAL_FLASH_DEVICES MX25R1635F
@@ -102,20 +102,20 @@
102102
// Lora
103103

104104
#define USE_SX1262
105-
#define LORA_CS (11)
106-
#define SX126X_POWER_EN (30)
107-
#define SX126X_DIO1 (32 + 8)
108-
#define SX126X_BUSY (14)
109-
#define SX126X_RESET (7)
110-
#define SX126X_RF_VC1 (27)
111-
#define SX126X_RF_VC2 (33)
105+
#define LORA_CS _PINNUM(0, 11)
106+
#define SX126X_POWER_EN _PINNUM(0, 30)
107+
#define SX126X_DIO1 _PINNUM(1, 8)
108+
#define SX126X_BUSY _PINNUM(0, 14)
109+
#define SX126X_RESET _PINNUM(0, 7)
110+
#define SX126X_RF_VC1 _PINNUM(0, 27)
111+
#define SX126X_RF_VC2 _PINNUM(0, 33)
112112

113113
////////////////////////////////////////////////////////////////////////////////
114114
// SPI1
115115

116116
#define PIN_SPI1_MISO (-1)
117-
#define PIN_SPI1_MOSI (20)
118-
#define PIN_SPI1_SCK (19)
117+
#define PIN_SPI1_MOSI _PINNUM(0, 20)
118+
#define PIN_SPI1_SCK _PINNUM(0, 19)
119119

120120
// GxEPD2 needs that for a panel that is not even used !
121121
extern const int MISO;
@@ -126,13 +126,13 @@ extern const int SCK;
126126
// Display
127127

128128
// #define DISP_MISO (-1)
129-
#define DISP_MOSI (20)
130-
#define DISP_SCLK (19)
131-
#define DISP_CS (22)
132-
#define DISP_DC (21)
133-
#define DISP_RST (28)
134-
#define DISP_BUSY (3)
135-
#define DISP_POWER (32 + 12)
129+
#define DISP_MOSI _PINNUM(0, 20)
130+
#define DISP_SCLK _PINNUM(0, 19)
131+
#define DISP_CS _PINNUM(0, 22)
132+
#define DISP_DC _PINNUM(0, 21)
133+
#define DISP_RST _PINNUM(0, 28)
134+
#define DISP_BUSY _PINNUM(0, 3)
135+
#define DISP_POWER _PINNUM(1, 12)
136136
// #define DISP_BACKLIGHT (-1)
137137

138138
#define PIN_DISPLAY_CS DISP_CS
@@ -143,8 +143,8 @@ extern const int SCK;
143143
////////////////////////////////////////////////////////////////////////////////
144144
// GPS
145145

146-
#define PIN_GPS_RX (32 + 13) // RXD
147-
#define PIN_GPS_TX (32 + 15) // TXD
148-
#define GPS_EN (32 + 11) // POWER_RT9080_EN
149-
#define PIN_GPS_STANDBY (32 + 10)
150-
#define PIN_GPS_PPS (29) // 1PPS
146+
#define PIN_GPS_RX _PINNUM(1, 13) // RXD
147+
#define PIN_GPS_TX _PINNUM(1, 15) // TXD
148+
#define GPS_EN _PINNUM(1, 11) // POWER_RT9080_EN
149+
#define PIN_GPS_STANDBY _PINNUM(1, 10)
150+
#define PIN_GPS_PPS _PINNUM(0, 29) // 1PPS

0 commit comments

Comments
 (0)