-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2C driver cleanup #21273
I2C driver cleanup #21273
Conversation
No code review as yet, but tested against #19997 and I2C OLEDs still work fine (with appropriate no-ops for comms start/stop). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review (did not really look at all that expander code that should not exist in so many copies scattered around).
Also |
Thank you for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infinityis thanks for tackling this long standing inconsistency in i2c driver api, IMHO this is the right way forward.
I've tested the changes with a cirque trackpad and RP2040 mcu and everything works just like before. There are some minor remarks but from my side this is good to go. There are some conflicts with the develop
branch due to the removal of user spaces from main repo that would need to be resolved though.
@infinityis #22905 got merged before your PR, could you rebase once more? |
* remove i2c_start and i2c_stop from i2c drivers * remove static i2c_address variable from chibios i2c driver
QMK's ARM and AVR I2C drivers currently expose i2c_start() and i2c_stop() which are lower level functions used in the I2C protocol. These functions should not be called outside of the driver because their misuse can introduce errors to I2C bus communications. This main focus of this PR is to remove those functions from the ARM and AVR I2C driver interface.
Description
i2c_start()
andi2c_stop()
has been rewritten to use the applicable I2C functions instead.i2c_write()
,i2c_read_ack()
,i2c_read_nack()
have been eliminated from the AVR I2C driver interface for the same reason. These were only exposed in the AVR I2C driver (without documentation); they did not exist in the ARM driver interface.i2c_transmit_P()
has been added to the AVR driver, and is now used by the legacy OLED driveri2c_ping_address()
has been added to the AVR and ARM drivers (as a weakly defined function to compensate for the limitations of the ARM implementation)I2C_ADDR_WRITE
andI2C_ADDR_READ
have had those definitions removed in favor of keeping onlyI2C_ADDR
I was only able to test on one keyboard with an OLED (EVO70) and it worked with no issues, which indicates that
i2c_transmit_P
has been tested. All the affected keyboards successfully compiled for me, but I did not have hardware to test them on.List of affected keyboards:
There are a few keyboards that defined their own lower-level I2C functions. Because they don't use the QMK drivers, they were outside of the scope for this PR, but they are good candidates for future improvement (to retool them to use QMK's I2C drivers instead). These keyboards are:
Types of Changes
Issues Fixed or Closed by This PR
#19997 (comment)
*
Checklist