Skip to content

Rename i2c structure again#543

Merged
krwq merged 15 commits intodotnet:masterfrom
shaggygi:rename-i2c-structure-again
Jul 1, 2019
Merged

Rename i2c structure again#543
krwq merged 15 commits intodotnet:masterfrom
shaggygi:rename-i2c-structure-again

Conversation

@shaggygi
Copy link
Contributor

@shaggygi shaggygi commented Jul 1, 2019

This addresses the I2C portion of #534

@krwq
Copy link
Member

krwq commented Jul 1, 2019

what you have overall looks good. I remember there are couple of XML docs which mention WIndows/LinuxI2c/Spi which we should fix since they are internal now

using System;
using System.Device.Gpio;
using System.Device.I2c;
using System.Device.I2c.Devices;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much nicer now, two namespaces were kinda confusing

@shaggygi
Copy link
Contributor Author

shaggygi commented Jul 1, 2019

what you have overall looks good. I remember there are couple of XML docs which mention WIndows/LinuxI2c/Spi which we should fix since they are internal now

Good point. Working on it now.

@shaggygi
Copy link
Contributor Author

shaggygi commented Jul 1, 2019

@krwq I think this finishes up here. I'll have a PR for SPI soon.

Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for >> in the xml docs LGTM

@shaggygi
Copy link
Contributor Author

shaggygi commented Jul 1, 2019

@krwq ok. one more time 😄 I found a few others along the way.

@krwq
Copy link
Member

krwq commented Jul 1, 2019

@shaggygi we will need to fix the build as part of this PR so if needed you'll need to do SPI as well

@joperezr
Copy link
Member

joperezr commented Jul 1, 2019

@shaggygi we will need to fix the build as part of this PR so if needed you'll need to do SPI as well

The build is not failing because of SPI. It is failing because the bindings package references the live build version of GPIO, I will point out which changes are required in order to fix the CI Build

/// Represents an I2C communication channel running on Unix.
/// </summary>
public class UnixI2cDevice : I2cDevice
internal class UnixI2cDevice : I2cDevice
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need an internal class here. Instead what we need is simply to move all of this code under I2CDevice.Linux.cs. Sorry if that didn't make sense before. Ideally what we want is not to need to have extra internal classes to shell out to, instead we just want to have one I2CDevice class, which in Linux has the copied implementation from the previous UnixI2CDevice, and in windows it uses what used to be Windows10I2cDevice. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Lemme review. Man, y'all are making sweat here 🏃 😓

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaggygi don't do anything yet, we're talking offline about this right now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shaggygi sorry for randomizing you, So I think we want to talk a bit more about the comment I gave and maybe have a small API review for it. In the meantime, I'm fine with taking this as is, except that we should fix the CI Build, I'll let you know how to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joperezr no prob. i was expecting some tap dancing with this breaking change 😄 i'll check back in a few.

@joperezr
Copy link
Member

joperezr commented Jul 1, 2019

What you will want to change in order to fix the BuildPackages build, you will need to change these lines:

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.6.0-preview4.19164.7" />
<ProjectReference Include="$(MSBuildThisFileDirectory)../System.Device.Gpio/System.Device.Gpio.csproj">
<AdditionalProperties>RuntimeIdentifier=linux</AdditionalProperties>
</ProjectReference>
</ItemGroup>

to instead look like:

  <ItemGroup>
    <PackageReference Include="System.Drawing.Common" Version="4.6.0-preview4.19164.7" />
    <PackageReference Include="System.Device.Gpio" Version="$(SystemDeviceGpioPackageVersion)" />
  </ItemGroup>

As for the other build breaks that you started getting, seems like you want to remove readonly from some of the changes that you updated for the Dispose method. In fact, I'd be fine if you want to just remove e941613 entirely from your PR so that we only deal with the namespace change here.

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me now. This is ready to go assuming CI is green. Thanks a lot for fixing this @shaggygi and sorry for the confusion, I missed the part of the issue where the Create method was agreed upon and the other devices were supposed to be made internal.

@shaggygi
Copy link
Contributor Author

shaggygi commented Jul 1, 2019

@joperezr No problem and was actually fun. If CI is green the SPI PR is a few seconds away 👍

@krwq krwq merged commit 9b56694 into dotnet:master Jul 1, 2019
@shaggygi shaggygi deleted the rename-i2c-structure-again branch July 1, 2019 23:41
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants