mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-10 16:59:52 +01:00
Change datatype for display pins from uint8_t to gpio_num_t
This also changes the behavior of undefined pins... They are now introduced as -1 (255 is still compatible)
This commit is contained in:
@@ -45,10 +45,10 @@ struct PinMapping_t {
|
||||
#endif
|
||||
|
||||
uint8_t display_type;
|
||||
uint8_t display_data;
|
||||
uint8_t display_clk;
|
||||
uint8_t display_cs;
|
||||
uint8_t display_reset;
|
||||
gpio_num_t display_data;
|
||||
gpio_num_t display_clk;
|
||||
gpio_num_t display_cs;
|
||||
gpio_num_t display_reset;
|
||||
|
||||
gpio_num_t led[PINMAPPING_LED_COUNT];
|
||||
};
|
||||
|
||||
@@ -53,7 +53,11 @@ void DisplayGraphicClass::init(Scheduler& scheduler)
|
||||
_display_type = static_cast<DisplayType_t>(pin.display_type);
|
||||
if (isValidDisplay()) {
|
||||
auto constructor = display_types[_display_type];
|
||||
_display = constructor(pin.display_reset, pin.display_clk, pin.display_data, pin.display_cs);
|
||||
_display = constructor(
|
||||
pin.display_reset == GPIO_NUM_NC ? 255U : static_cast<uint8_t>(pin.display_reset),
|
||||
pin.display_clk == GPIO_NUM_NC ? 255U : static_cast<uint8_t>(pin.display_clk),
|
||||
pin.display_data == GPIO_NUM_NC ? 255U : static_cast<uint8_t>(pin.display_data),
|
||||
pin.display_cs == GPIO_NUM_NC ? 255U : static_cast<uint8_t>(pin.display_cs));
|
||||
if (_display_type == DisplayType_t::ST7567_GM12864I_59N) {
|
||||
_display->setI2CAddress(0x3F << 1);
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_DATA
|
||||
#define DISPLAY_DATA 255U
|
||||
#define DISPLAY_DATA GPIO_NUM_NC
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_CLK
|
||||
#define DISPLAY_CLK 255U
|
||||
#define DISPLAY_CLK GPIO_NUM_NC
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_CS
|
||||
#define DISPLAY_CS 255U
|
||||
#define DISPLAY_CS GPIO_NUM_NC
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_RESET
|
||||
#define DISPLAY_RESET 255U
|
||||
#define DISPLAY_RESET GPIO_NUM_NC
|
||||
#endif
|
||||
|
||||
#ifndef LED0
|
||||
|
||||
Reference in New Issue
Block a user