PowerShell / PowerShell-IoT

Interact with I2C, SPI & GPIO devices using PowerShell Core!
https://www.powershellgallery.com/packages/Microsoft.PowerShell.IoT
MIT License
130 stars 28 forks source link

restructured the project to have each interface in one folder. #45

Closed DanielSSilva closed 4 years ago

DanielSSilva commented 5 years ago

This PR suggests a new file structure. Essentially what I did was to separate each interface in their own folder, where each folder has the interface object and subfolders with the Verbs of the cmdlets. e.g: image In my opinion, this seems more organized and easier to understand/search for code, especially for newcomers. Also, this follows the file structure of the dotnet/iot repo

NOTE: I'm currently trying to understand the test setup and still have to test if everything is working, even though the project compiled. For that reason, this should not be merged yet.

anmenaga commented 4 years ago

@DanielSSilva have you seen such PlatformNotSupportedException? System.Device.I2c.* operations seem to work fine when run from a simple C# test app on raspberry pi; but as soon as they are called from pwsh they fail with this:

System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Device.I2c.I2cConnectionSettings..ctor(Int32 busId, Int32 deviceAddress)
at hello_netcore3.GetI2CDevice.ProcessRecord()
DanielSSilva commented 4 years ago

Yap I've seen it. IIRC you have to build with -r linux-arm. Let me search the issue

DanielSSilva commented 4 years ago

https://github.com/dotnet/iot/issues/863 Here. It's the same case?

anmenaga commented 4 years ago

Yes; with dotnet publish -r linux-arm this works; thank you.

I think we need to merge this so that we can work on smaller items based on this major refactoring work.

DanielSSilva commented 4 years ago

Agreed. I2C is working as expected (as far as I could test). Last time I've picked this, I've opened a bug/question to the dotnet iot team. Haven't had the time to get back to this https://github.com/dotnet/iot/issues/939