Skip to content
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

Made improvements to polling i2c driver #102

Merged
merged 1 commit into from
May 27, 2020

Commits on May 10, 2020

  1. Made improvements to polling i2c driver

    3 improvements made to driver:
    
    write_read embedded_hal implementation was not properly performing
    a repeated start between the write and read phases of the
    transaction. This was because write_read was implemented in terms of
    write() and read() traits. This has been refactored so that the
    write_read trait is smart enough to do a repeated start, and skip the
    write and read sections of the transaction if their corresponding
    slice arguments are empty (length zero). write() and read() are now
    also implemented in terms of the write_read() trait.
    
    Currently, there is no checking for error conditions while the i2c
    driver is waiting for access to the bus or available space in transmit
    buffers. This causes problems since if a bus error occurs while a
    transaction is occuring the hardware I2C device will abort the current
    transaction. This means that it is possble to wait forever for a
    transmit buffer to be empty while there are no transactions going
    on. This was fixed by updating all of the polling loops to check for
    i2c errors and abort if a problem occurs.
    
    If the address byte of the i2c transaction is NACKed, then the I2C
    peripheral will abort the transaction while there is still data in the
    transmit buffer. This means that future i2c transactions will use this
    "old" data as the first byte of there new transaction. This was fixed
    by flushing the tx buffers before a new transaction starts.
    apgoetz committed May 10, 2020
    Configuration menu
    Copy the full SHA
    b9018f2 View commit details
    Browse the repository at this point in the history