-
Notifications
You must be signed in to change notification settings - Fork 616
Description
This proposal is a collection of different modifications and grouped here as there are many breaking changes being proposed. The intent is to review, decide and update (if needed) namespaces, class names and file locations in a consistent structure between the different types of interfaces within System.Device.Gpio API.
This seems to fit with @terrajobst comments during this design review, as well.
Rationale and Usage
Since System.Device.Gpio is in early previews, it seems like the opportune time to review and decide how to structure the core components. This will reduce breaking changes in the future.
Examples
- GPIO and PWM have abstract classes based on Drivers and are located under the *.Drivers folder. This includes RaspberryPi3Driver, UnixDriver.Linux.cs, etc.. Gpio is not in the file names where I2C/Pwm/SPI are included in the file names.
- I2C and SPI are based on Devices. However, there are implementations under the *.Drivers folders.
Proposed Changes
The proposed changes are to rename and move files as shown in the folder structure below. To simplify, this attempts to point out only the changes for the files being modified.
GPIO Folder
- TODO
- Drivers and related classes renamed to include "Gpio".
- GpioDriver.cs moved to Drivers folder.
Device
Gpio
Drivers
GpioDriver.cs
HummingBoardGpioDriver.cs
HummingBoardGpioDriver.Linux.cs
HummingBoardGpioDriver.Windows.cs
RaspberryPi3GpioDriver.cs
RaspberryPi3GpioDriver.Linux.cs
RaspberryPi3GpioDriver.Windows.cs
UnixGpioDriver.Linux.cs
UnixGpioDriver.Windows.cs
UnixGpioDriverPin.Linux.cs // Also simplified by removing Device
Windows10GpioDriver.Linux.cs
Windows10GpioDriver.Windows.cs
Windows10GpioDriverPin.Windows.cs
GpioPinChangeEventHandler.cs
GpioPinEventTypes.cs
GpioPinMode.cs
GpioPinNumberingScheme.cs
GpioPinValue.cs
GpioPinValueChangedEventArgs.cs
I2C Folder
- Completed in Rename i2c structure again #543
- Folder renamed from "Drivers" to "Devices".
- Namespaces be renamed from "System.Device.I2c.Drivers" to "System.Device.I2c"
- I2cDevice.cs moved to Devices folder.
See #118 and #534 for related details
Device
I2c
Devices
I2cDevice.cs
I2cDevice.Linux.cs
I2cDevice.Windows.cs
[other devices here that were not moved or renamed]
I2cConnectionSettings.cs (didn't change; showing for location purposes)
PWM Folder
- Completed in Better abstraction for PWM: PwmChannel #576
- PwmDriver.cs moved to Drivers folder.
See #204 for related details
Device
Pwm
Drivers
PwmDriver.cs
SPI Folder
- Completed in Rename SPI Structure #545
- Folder renamed from "Drivers" to "Devices".
- Namespaces be renamed from "System.Device.Spi.Drivers" to "System.Device.Spi"
- SpiDevice.cs moved to Devices folder.
See #119 and #534 for related details
Device
Spi
Devices
SpiDevice.cs
SpiDevice.Linux.cs
SpiDevice.Windows.cs
[other devices here that were not moved or renamed]
SpiConnectionSettings.cs (didn't change; showing for location purposes)
Open Questions
- It seems a little redundant to have the interface in the file name. For example, GpioPinMode. Is this too redundant knowing it is under the Gpio folder/namespace? It seems like differentiating would be okay, especially when mixing different pin types in code files (e.g. Bindings with a mixture of digital, analog and PWM pins). This would help when adding "usings" or typing entire namespace out.