diff --git a/esphome/components/max6921/display.cpp b/esphome/components/max6921/display.cpp index e5830feee7..30064d30c4 100644 --- a/esphome/components/max6921/display.cpp +++ b/esphome/components/max6921/display.cpp @@ -1,5 +1,6 @@ #ifdef USE_ESP32_FRAMEWORK_ARDUINO +#include #include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" diff --git a/esphome/components/max6921/max6921.cpp b/esphome/components/max6921/max6921.cpp index 7ef71885c0..c17068eb49 100644 --- a/esphome/components/max6921/max6921.cpp +++ b/esphome/components/max6921/max6921.cpp @@ -3,6 +3,7 @@ #ifdef USE_ESP32_FRAMEWORK_ARDUINO #include +#include #include "display.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" diff --git a/esphome/components/max6921/max6921.h b/esphome/components/max6921/max6921.h index 0684560c5c..7d78a7abf8 100644 --- a/esphome/components/max6921/max6921.h +++ b/esphome/components/max6921/max6921.h @@ -2,7 +2,6 @@ #ifdef USE_ESP32_FRAMEWORK_ARDUINO -#include #include #include "esphome/core/automation.h" #include "esphome/core/component.h" diff --git a/tests/components/max6921/test.esp32-ard.yaml b/tests/components/max6921/test.esp32-ard.yaml new file mode 100644 index 0000000000..7e9e6ec3a7 --- /dev/null +++ b/tests/components/max6921/test.esp32-ard.yaml @@ -0,0 +1,31 @@ +spi: + - id: spi_max6921 + clk_pin: 16 + mosi_pin: 17 + +display: + - platform: max6921 + load_pin: 12 + blank_pin: 14 + out_pin_mapping: + seg_to_out_map: + seg_a_pin: 0 + seg_b_pin: 2 + seg_c_pin: 5 + seg_d_pin: 6 + seg_e_pin: 4 + seg_f_pin: 1 + seg_g_pin: 3 + seg_p_pin: 7 + pos_to_out_map: + # IV18 positions starts at the right side! + pos_0_pin: 15 + pos_1_pin: 14 + pos_2_pin: 13 + pos_3_pin: 16 + pos_4_pin: 12 + pos_5_pin: 17 + pos_6_pin: 11 + pos_7_pin: 18 + lambda: |- + it.print("01234567"); diff --git a/tests/components/max6921/test.esp32-c3-ard.yaml b/tests/components/max6921/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..586f9ad22a --- /dev/null +++ b/tests/components/max6921/test.esp32-c3-ard.yaml @@ -0,0 +1,31 @@ +spi: + - id: spi_max6921 + clk_pin: 6 + mosi_pin: 7 + +display: + - platform: max6921 + load_pin: 8 + blank_pin: 9 + out_pin_mapping: + seg_to_out_map: + seg_a_pin: 0 + seg_b_pin: 2 + seg_c_pin: 5 + seg_d_pin: 6 + seg_e_pin: 4 + seg_f_pin: 1 + seg_g_pin: 3 + seg_p_pin: 7 + pos_to_out_map: + # IV18 positions starts at the right side! + pos_0_pin: 15 + pos_1_pin: 14 + pos_2_pin: 13 + pos_3_pin: 16 + pos_4_pin: 12 + pos_5_pin: 17 + pos_6_pin: 11 + pos_7_pin: 18 + lambda: |- + it.print("01234567");