Some largish changes comming soon!! #427
kdschlosser
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
OK so there is a user that is going to be the first to use the i2c bus drivers and these drivers have not yet been tested. after looking at the driver to see if things were done properly I realized that the i2c driver was going to be facing the same issue as the SPI driver once did which was the bus was not going to be able to be shared with other devices other than the display. That is not acceptable to me as the I2C bus is supposed to be able to have more than one device attached to it.
And there I went and set out on a mission. Now this mission turned into a more complicated matter because in order to have the I2C bus work the way it needed to I was going to have to get rid of the wrapper classes I wrote in Python. This complicated things a bit further because of how MicroPython is written to use a centralized set of function that act as the methods for the I2C driver class. The reason why this is an issue is because I needed to override the behavior of the factory I2C classes so a device address only needed to be passed a single time and I wanted to also provide the functionality of being able to set the register size only a single time.
Because the touch drivers are agnostic to what bus is being used I would need to add additional methods that had a shared API with the SPI drivers and how they worked. The memory registers being passed are the same if the driver IC is the same and the bus connection is the only different thing. So instead of adding additional methods to the I2C driver I decided to add some methods to the SPI driver instead. The methods that are going to be added are
writeto_mem
,readfrom_mem_into
,readfrom_mem
. Because I changed the handling of both the I2C driver and the SPI driver so they are broken into 2 sections one part represents the bus and the second represents the device both have very similar abilities, things like supporting devices that have different transfer speeds. This is good to have. SPI identifies a device by using a CS line and I2C uses an address. So the I2C device needs to have an address passed to it just like a CS pin needs to be passed to the SPI device driver.Since I had gone this far I wanted to remove the use of having to pass the
BITS
constant for the I2C driver. Well I wanted to remove the user having to set it. So the device classes for both the SPI and the I2C driver have an added method to set that which is now going to be done in the touch driver. It is something that is optional and it doesn't have to be used.Because you can set the number of bits used for a register address you will no longer need to pass it to the
writeto_mem
,readfrom_mem_into
andreadfrom_mem
functions. The methods that are in the original MicroPython I2C driver that took the address of a device no longer needs to have the address passed to the method used in the device class. The original methods are available for use in the bus class and they take all the original parameters. I did this for backwards compatibility.To put that little proverbial cherry on top I have also written the I2C driver for the RP2 MCU as well as the STM32 and while I was there I also added the I2C Bus driver for displays as well as the SPI bus driver for displays for both the RP2 and the STM32. The SPI drivers for both the RP2 and the STM32 also support DMA memory transfers so they will be able to get the best in terms of performance.
I also added a bit bang I8080 driver to both the RP2 and STM32 as well.
There is going to be some hiccups I am sure that will need to be ironed out. Please be patient while I am getting the bugs out. If you are having a problem PLEASE open an issue, DO NOT use discussions to report crashes, compile errors or things generally not working properly.
I am going to be committing and pushing the changes in the next couple of days.
Beta Was this translation helpful? Give feedback.
All reactions