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

Board: Improve I²C device management to avoid null reference exceptions #2032

Merged
merged 25 commits into from
Feb 15, 2023

Commits on Feb 7, 2023

  1. I2cBusExtensions.PerformBusScan() cleanup

    Remove devices after creating them while scanning the I2C bus. Resolves dotnet#2031
    swharden committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    11b5d35 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2023

  1. Revert "I2cBusExtensions.PerformBusScan() cleanup"

    This reverts commit 11b5d35.
    swharden committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    5d1f7e5 View commit details
    Browse the repository at this point in the history
  2. Ft232HI2c: dispose without nulling the I²C bus

    see discussion in dotnet#2032
    
    resolves dotnet#2031
    swharden committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    a3d98bb View commit details
    Browse the repository at this point in the history
  3. Ft232HI2c: simplify code comment

    This commit is also an opportunity to re-run tests in the CI pipeline
    swharden committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    85856b7 View commit details
    Browse the repository at this point in the history
  4. Ft232H sample: I2C bus scan

    This commit demonstrates how to scan the I2C bus for addresses devices acknowledge.
    
    Before the fix discussed in dotnet#2032, this scan would leave the i2c bus in a bad state such that reading/writing to devices after the scan would throw null reference exceptions.
    swharden committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    7b4f08e View commit details
    Browse the repository at this point in the history
  5. Ft232HI2c: null settings in destructor

    This reduces load on the garbage collector. Note that `_i2cBus` should not be set to null at this time, as per discussion in dotnet#2032
    swharden committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    cb1c639 View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2023

  1. Revert "Ft232H sample: I2C bus scan"

    This reverts commit 7b4f08e.
    swharden committed Feb 11, 2023
    Configuration menu
    Copy the full SHA
    7157c5b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0432fe5 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2023

  1. Ft232HI2cBus: add/remove device NoCheck

    adds CreateDeviceNoCheck() and RemoveDeviceNoCheck() to mimic behaviors found in UnixI2cBus.cs
    
    Also creates a new used address hash set when CreateDevice() is called (not when the bus is instantiated), consistent with how the Unix I2C bus does it
    
    https://github.com/dotnet/iot/blob/main/src/System.Device.Gpio/System/Device/I2c/UnixI2cBus.cs
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    a507d62 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0f39615 View commit details
    Browse the repository at this point in the history
  3. Ft232h sample: opening and closing i2c devices

    currently demonstrates the issue described by dotnet#2031 and dotnet#2032
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    72e2ea0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e35b187 View commit details
    Browse the repository at this point in the history
  5. ProtocolTests: repeat creation of the same I2C device

    expected to fail with a null reference exception due to a bug described by dotnet#2031 and dotnet#2032
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    e38addd View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7d435a1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0abc40e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3e4d18f View commit details
    Browse the repository at this point in the history
  9. BoardTest: dispose and recreate I2C device

    fails, demonstrating issue discussed in dotnet#2031 and dotnet#2032
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    6cef0f2 View commit details
    Browse the repository at this point in the history
  10. Revert "Ft232h sample: opening and closing i2c devices"

    This reverts commit 72e2ea0.
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    ef2c62f View commit details
    Browse the repository at this point in the history
  11. disable Board I2cBusManager device caching

    fixes issues described in dotnet#2031 and dotnet#2032
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    4c679a0 View commit details
    Browse the repository at this point in the history
  12. Ft232HI2c → Ft232HI2cDevice

    suggested by pgrawehr in dotnet#2032
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    3dfa427 View commit details
    Browse the repository at this point in the history
  13. mark Ft232HI2c obsolete

    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    ad7bc86 View commit details
    Browse the repository at this point in the history
  14. Ft232HI2c: inherit from I2cDevice

    so Microsoft.NET.ApiCompat.ValidatePackage.targets will pass after 3dfa427
    swharden committed Feb 12, 2023
    Configuration menu
    Copy the full SHA
    a1a30d3 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2023

  1. delete Ft232HI2c

    it has been replaced by Ft232HI2cDevice
    swharden committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    c28125c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8cb4e2c View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2023

  1. Configuration menu
    Copy the full SHA
    a22bd02 View commit details
    Browse the repository at this point in the history