Skip to content

Commit

Permalink
SPI: Make some validation failures give more useful messages. (esphom…
Browse files Browse the repository at this point in the history
  • Loading branch information
clydebarrow authored Mar 21, 2024
1 parent 1d6f245 commit d0ced34
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 24 deletions.
9 changes: 9 additions & 0 deletions esphome/components/spi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ def get_spi_interface(index):
*sum(get_hw_interface_list(), ["software", "hardware", "any"]),
lower=True,
),
cv.Optional(CONF_DATA_PINS): cv.invalid(
"'data_pins' should be used with 'type: quad' only"
),
}
),
cv.has_at_least_one_key(CONF_MISO_PIN, CONF_MOSI_PIN),
Expand All @@ -287,6 +290,12 @@ def get_spi_interface(index):
*sum(get_hw_interface_list(), ["hardware"]),
lower=True,
),
cv.Optional(CONF_MISO_PIN): cv.invalid(
"'miso_pin' should not be used with quad SPI"
),
cv.Optional(CONF_MOSI_PIN): cv.invalid(
"'mosi_pin' should not be used with quad SPI"
),
}
),
cv.only_on([PLATFORM_ESP32]),
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.esp32-c3-idf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.esp32-c3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.esp32-idf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.esp8266.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down
9 changes: 5 additions & 4 deletions tests/components/xpt2046/test.rp2040.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ touchscreen:
display: xpt_display
update_interval: 50ms
threshold: 400
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
calibration:
x_min: 3860
x_max: 280
y_min: 340
y_max: 3860
on_touch:
- logger.log:
format: Touch at (%d, %d)
Expand Down

0 comments on commit d0ced34

Please sign in to comment.