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

Better abstraction for PWM: PwmChannel #576

Merged
merged 7 commits into from
Jul 17, 2019
Merged

Better abstraction for PWM: PwmChannel #576

merged 7 commits into from
Jul 17, 2019

Conversation

shaggygi
Copy link
Contributor

@shaggygi shaggygi commented Jul 7, 2019

Fixes #204

This PR is based on the new PwmChannel concept. See #204 for more details.

cc: @krwq @joperezr This only includes the code for Linux. I wanted to make sure the feature fits what was expected before adding files for Windows. I started some review comments to point out a few thoughts/issues found along the way.

@shaggygi
Copy link
Contributor Author

shaggygi commented Jul 8, 2019

@krwq @joperezr I'm trying to reinstall Win10 IoT on one of my RPi 3B+ and not having any luck. You have any narrowed down steps on what to download, install, and copy to SD card? Thx

@joperezr
Copy link
Member

Build is failing because of the chicken an egg problem again. To fix it, you could either do the temporary fix that we did in SPI and I2C with making the bindings package use a package reference to the main library like here:

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

Or alternatively you could have the projects of the bindings that are failing to use the live version of System.Device.Gpio, and fix all the namespace/class issues upfront.

@shaggygi
Copy link
Contributor Author

I will be off the grid most of the next 2 weeks. I'll try to check in every now and then if time allows.

If you can send me some docs on how to prepare and install the lastest Win10 IoT for RPi 3B+, I will try to at least prepare the device to work on the Windows10PwmChannel for when I return.
For some reason I'm having troubles getting mine configured and have not been able to troubleshoot the issue. I've had no problems setting up the Linux flavor.

@krwq
Copy link
Member

krwq commented Jul 11, 2019

@joperezr do you have instructions for Win10 IoT Core? I've only used Raspbian/Ubuntu with RPi.

@shaggygi did you try https://docs.microsoft.com/en-us/windows/iot-core/downloads ? What errors are you seeing? Do you need anyone to pick up this PR?

@joperezr
Copy link
Member

If that's ok with you @shaggygi I will finish this PR since we do want to take it in sooner rather than later :). As to instructions on how to set up Windows IoT core, I have usually just downloaded the Windows IoT Core Dashboard and follow the steps from that in order to flash my SD card.

@shaggygi
Copy link
Contributor Author

@joperezr that is fine. Sorry on delay

1 similar comment
@shaggygi
Copy link
Contributor Author

@joperezr that is fine. Sorry on delay

@joperezr
Copy link
Member

Sorry on delay

@shaggygi no worries at all, it wasn't a delay, you got us in a very great place with a head start 😉. We just want to finish this in less than two weeks and don't want to interfere at all with your plans 😄

@joperezr
Copy link
Member

Code is ready after my last change, I just want to run some more tests to make sure everything is behaving as expected in both Unix and Windows.

@krwq krwq changed the title [WIP] Added new PwmChannel Better abstraction for PWM: PwmChannel Jul 17, 2019
int chip,
int channel,
int frequency = 400,
double dutyCyclePercentage = 0.5) =>
Copy link
Member

Choose a reason for hiding this comment

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

I think we should have Create and CreateInternal, Create should have defaults and CreateInternal should be explicit so that we don't accidentally have different defaults on both platforms

Copy link
Member

Choose a reason for hiding this comment

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

I think having Create is fine for now since that is what we have in other similar APIs (like I2cDevice.Create or how the GpioController picks a driver), I'll keep it as is and we can discuss later if we want to change to CreateInternal

src/devices/SoftPwm/README.md Outdated Show resolved Hide resolved
@joperezr joperezr merged commit de70d68 into dotnet:master Jul 17, 2019
@joperezr
Copy link
Member

Thanks @krwq and @shaggygi for the group effort on this 😄

@shaggygi
Copy link
Contributor Author

@joperezr @krwq thanks for finishing this up while I was on vacation. I have a few devices on order and will try to tinker/test around with results when time allows. 👍

@microhobby
Copy link
Contributor

microhobby commented Aug 8, 2019

Great work guys, by the way this solve a multi channel access issue that was in the old code ... thanks

https://github.com/dotnet/iot/blob/1.0-preview6/src/System.Device.Gpio/System/Device/Pwm/Drivers/UnixPwmDriver.Linux.cs#L118

@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.

PwmController/PwmDevice should be bound to specific pin
5 participants