IO Expander that works with SW SPI #5248
-
I have been working on getting the T-RGB screen up and running within ESP Home. I first added support for the XL9535 IO Expander and now I have got the touchscreen working and am now testing the screen - however, I have come up at a bit of a hurdle. I am looking to see what the best way to approach the problem is before I finalise the programming of it all. I require 9-bit SW SPI to configure the screen on start-up which is done via the XL9535 expander (this is hardwired in on the ESP32-S3 T-RGB Round Display), so this requires some custom methods to get it all to work correctly. display:
- platform: st7701
width: 480
height: 480
backlight_pin:
number: 46
hsync_pin:
number: 47
vsync_pin:
number: 41
de_pin:
number: 45
pclk_pin:
number: 42
power_enable_pin:
xl9535: xl9535_hub
number: 2
reset_pin:
xl9535: xl9535_hub
number: 6
data_pins:
- number: 21 # Pin 1
- number: 18 # Pin 2
- number: 17 # Pin 3
- number: 16 # Pin 4
- number: 15 # Pin 5
- number: 14 # Pin 6
- number: 13 # Pin 7
- number: 12 # Pin 8
- number: 11 # Pin 9
- number: 10 # Pin 10
- number: 9 # Pin 11
# Pin 12
- number: 7 # Pin 13
- number: 6 # Pin 14
- number: 5 # Pin 15
- number: 3 # Pin 16
- number: 2 # Pin 17
cs_pin:
xl9535: xl9535_hub
number: 3
sda_pin:
xl9535: xl9535_hub
number: 4
clk_pin:
xl9535: xl9535_hub
number: 5 I am wondering if there is a better way, maybe to be able to create a XL9535 SPI platform? So you can use both regular SPI for your usual devices, then you can have a second SW SPI bus using (the XL9535 SPI) method - this would allow the code to be able to be used again when people attach their own SPI devices to the XL9535. A little example of this can be found in the Arduino GFX Library - where it has its own custom XL9535 IO Expander SPI methods. spi:
- platform: xl9535
mosi_pin:
xl9535: xl9535_hub
number: 4
clk_pin:
xl9535: xl9535_hub
number: 5
display:
- platform: st7701
width: 480
height: 480
backlight_pin:
number: 46
hsync_pin:
number: 47
vsync_pin:
number: 41
de_pin:
number: 45
pclk_pin:
number: 42
power_enable_pin:
xl9535: xl9535_hub
number: 2
reset_pin:
xl9535: xl9535_hub
number: 6
data_pins:
- number: 21 # Pin 1
- number: 18 # Pin 2
- number: 17 # Pin 3
- number: 16 # Pin 4
- number: 15 # Pin 5
- number: 14 # Pin 6
- number: 13 # Pin 7
- number: 12 # Pin 8
- number: 11 # Pin 9
- number: 10 # Pin 10
- number: 9 # Pin 11
# Pin 12
- number: 7 # Pin 13
- number: 6 # Pin 14
- number: 5 # Pin 15
- number: 3 # Pin 16
- number: 2 # Pin 17 Without the I'd love to hear your opinions on the matter! (I might be massively overcomplicating this!). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@jesserockz if possible, I'd like to hear your opinion on this, what do you think? Would it be best to just encapsulate the custom SPI method's used for the XL9535 IO Expander all under the ST7701 display component or is there a better way? |
Beta Was this translation helpful? Give feedback.
-
This is something that would be better to ask in the devs discord channel. Create a thread there to discuss it. |
Beta Was this translation helpful? Give feedback.
This is something that would be better to ask in the devs discord channel. Create a thread there to discuss it.