unosquare / wiringpi-dotnet

Provides complete managed access to the popular wiringpi C library
MIT License
68 stars 13 forks source link

IGpioPin does not allow access to PWM functions #30

Open BryanCrotaz opened 4 years ago

BryanCrotaz commented 4 years ago

IGpioPin does not give access to all PWM functions.

In Workbench, the Servo demo should take an IGpioPin in the constructor, not a GpioPin.

Alternatively explain in docs how to get a GpioPin instance from Pi.Gpio[bcmPinNumber]

wezzix commented 3 years ago

Try a cast. The readme gives the following example:

   var range = 100;
   var pin = (GpioPin)Pi.Gpio[BcmPin.Gpio24];
   pin.PinMode = GpioPinDriveMode.Output;
   pin.StartSoftPwm(0, range);
BryanCrotaz commented 3 years ago

Oh that's soooo dodgy! Assuming that the implementation of an interface is an exact class is ripe with error potential.

wezzix commented 3 years ago

Yes. I don't know why the maintainers designed it so. Maybe they'd like to chip in?

BryanCrotaz commented 3 years ago

I've submitted a few improvement PRs but they're withering on the vine

geoperez commented 3 years ago

We are looking for maintainers, you can apply at https://adoptoposs.org/p/67b02bee-a00e-446a-a321-c1a6449014bc