PowerShell-IoT icon indicating copy to clipboard operation
PowerShell-IoT copied to clipboard

Allow the registering of change events

Open TylerLeonhardt opened this issue 7 years ago • 6 comments

It would look something like this:

Register-GpioPinChangeEvent -Type LowToHigh -ScriptBlock {
    Write-Host "do the thing"
}

# and

Register-GpioPinChangeEvent -Type HighToLow -ScriptPath foo.ps1

Under the hood it could use Register-ObjectEvent to allow the script execution to be in the same runspace.

Unosquare docs here: https://github.com/unosquare/raspberryio#interrupts-and-callbacks

TylerLeonhardt avatar Apr 16 '18 22:04 TylerLeonhardt

Really useful to handle I2C devices that use interrupts pins !

jnury avatar Apr 18 '18 15:04 jnury

Changed the title so it doesn't only apply to GPIO :)

TylerLeonhardt avatar Apr 18 '18 16:04 TylerLeonhardt

@TylerLeonhardt Would this make it possible to detect button being pressed?

matswi avatar Jun 16 '20 13:06 matswi

That's the idea, yes

TylerLeonhardt avatar Jun 16 '20 14:06 TylerLeonhardt

That's the idea, yes

That would be really nice! :) I'm afraid I don't have the skills to make it but would be happy to help with testing it. Is there any plan on moving forward with it?

matswi avatar Jun 16 '20 14:06 matswi

@matswi we are currently migrating to .NET IoT library. The closest that we will have so far (I think) "out of the box" will be the possibility to register an event for changes https://github.com/dotnet/iot/blob/master/src/System.Device.Gpio/System/Device/Gpio/GpioController.cs#L281-L296 There's no ETA I'm afraid

DanielSSilva avatar Jun 16 '20 14:06 DanielSSilva