From 14054b22dec028d4ce323b04e87b5f144042c35f Mon Sep 17 00:00:00 2001 From: mcuw <112967559+mcuw@users.noreply.github.com> Date: Fri, 21 Aug 2026 20:40:37 +0200 Subject: [PATCH] chore: typed pins for crowpanel 2.1 inch and updated --- .../esp32_s3_crowpanel_2_1/pins_arduino.h | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/variants/esp32_s3_crowpanel_2_1/pins_arduino.h b/variants/esp32_s3_crowpanel_2_1/pins_arduino.h index 3bc3d25..504f688 100644 --- a/variants/esp32_s3_crowpanel_2_1/pins_arduino.h +++ b/variants/esp32_s3_crowpanel_2_1/pins_arduino.h @@ -2,34 +2,37 @@ #define Pins_Arduino_h #include +#include "hal/gpio_types.h" #define ESP32_S3_CROWPANEL_2_1 -static const uint8_t SDA = 38; -static const uint8_t SCL = 39; +static const gpio_num_t SDA = GPIO_NUM_38; +static const gpio_num_t SCL = GPIO_NUM_39; -static const uint8_t SCK = 2; -static const uint8_t SS = 16; -static const uint8_t MOSI = 0; // not used, but defined for compatibility with libraries that use SPI.h -static const uint8_t MISO = 0; // not used, but defined for compatibility with libraries that use SPI.h +static const gpio_num_t SCK = GPIO_NUM_2; +static const gpio_num_t SS = GPIO_NUM_16; // CS +static const gpio_num_t MOSI = GPIO_NUM_0; // not used, but defined for compatibility with libraries that use SPI.h +static const gpio_num_t MISO = GPIO_NUM_0; // not used, but defined for compatibility with libraries that use SPI.h -static const uint8_t ENCODER_A_PIN = 42; -static const uint8_t ENCODER_B_PIN = 4; +static const gpio_num_t ENCODER_CLK_PIN = GPIO_NUM_42; // CLK to detect CW if same value or CCW if different value (ENCODER_A_PIN) +static const gpio_num_t ENCODER_DT_PIN = GPIO_NUM_4; // interrupt trigger (ENCODER_B_PIN) -static const uint8_t BREATH_LED_PIN = 43; - -static const uint8_t RX = 50; -static const uint8_t TX = 49; - -static const uint8_t BACKLIGHT_LED_PIN = 6; +static const gpio_num_t RX = GPIO_NUM_44; +static const gpio_num_t TX = GPIO_NUM_43; // PCF8574 Extended IO static const uint8_t I2C_IO_EXPANDER_ADDRESS = 0x21; // pcf8574 -static const uint8_t I2C_TOUCH_ADDR = 0x15; // often but not always 0x15! -static const uint8_t TOUCHSCREEN_RESET_PIN = 0; -static const uint8_t TOUCHSCREEN_INTERRUPT_PIN = 2; -static const uint8_t LCD_POWER_PIN = 3; -static const uint8_t LCD_RESET_PIN = 4; -static const uint8_t ENCODER_BUTTON_PIN = 5; - -#endif /* Pins_Arduino_h */ +static const uint8_t I2C_TOUCH_ADDRESS = 0x15; // often but not always 0x15! +static const uint8_t I2C_SCREEN_ADDRESS = 0x3C; +static const gpio_num_t TOUCHSCREEN_RESET_PIN = GPIO_NUM_0; +static const gpio_num_t TOUCHSCREEN_INTERRUPT_PIN = GPIO_NUM_2; +static const gpio_num_t LCD_POWER_PIN = GPIO_NUM_3; +static const gpio_num_t LCD_RESET_PIN = GPIO_NUM_4; +static const gpio_num_t ENCODER_BUTTON_PIN = GPIO_NUM_5; + +// Screen +static const uint16_t SCREEN_HEIGHT = 480; +static const uint16_t SCREEN_WIDTH = 480; +static const gpio_num_t SCREEN_BACKLIGHT_PIN = GPIO_NUM_6; + +#endif \ No newline at end of file