From 6062b3da993af63e977375525f99d4554de3c59e Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Mon, 24 Apr 2023 22:41:52 -0700 Subject: [PATCH 1/5] Add ISpiPeripheral and II2cPeripheral abstractions --- .../Driver/Tea5767.Enums.cs | 2 +- .../Audio.Radio.Tea5767/Driver/Tea5767.cs | 7 +- .../Displays.Ch1115/Driver/Ch1115.cs | 2 +- .../Driver/CharacterDisplay.cs | 2 +- .../Driver/GroveCharacterDisplay.cs | 2 +- .../Driver/I2cCharacterDisplay.Enums.cs | 4 +- .../Driver/I2cCharacterDisplay.cs | 9 +- .../CharacterDisplay_Sample/MeadowApp.cs | 4 +- .../Driver/FourDigitSevenSegment.cs | 3 +- .../Displays.Max7219/Driver/Max7219.cs | 2 +- .../Displays.Pcd8544/Driver/Pcd8544.cs | 2 +- .../Displays.Sh110x/Driver/Sh110x.Enums.cs | 2 +- .../Displays.Sh110x/Driver/Sh110x.cs | 7 +- .../Samples/Sh1107_Sample/MeadowApp.cs | 2 +- .../Driver/Drivers/Ssd1306.cs | 2 +- .../Driver/Drivers/Ssd1309.cs | 2 +- .../Driver/SSd130xBase.Enums.cs | 2 +- .../Displays.Ssd130x/Driver/Ssd130xBase.cs | 7 +- .../Displays.Ssd1327/Driver/Ssd1327.cs | 2 +- .../Displays.St7565/Driver/St7565.cs | 2 +- .../Displays.TftSpi/Driver/TftSpiBase.cs | 2 +- .../Displays.ePaper/Driver/ePaperBase.cs | 2 +- .../Driver/Ads1x15Base.Enums.cs | 4 +- .../ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs | 9 +- .../ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs | 2 +- .../ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs | 2 +- .../Samples/Ads1015_Sample/MeadowApp.cs | 2 +- .../Samples/Ads1115_Sample/MeadowApp.cs | 2 +- .../Driver/At24Cxx.Enums.cs | 2 +- .../ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs | 7 +- .../Driver/Emc2101.Enums.cs | 6 +- .../Driver/Emc2101.cs | 8 +- .../Driver/As1115.Enums.cs | 4 +- .../ICs.IOExpanders.As1115/Driver/As1115.cs | 9 +- .../Driver/Ds3502.Enums.cs | 4 +- .../ICs.IOExpanders.Ds3502/Driver/Ds3502.cs | 9 +- .../Driver/Ht16k33.Enums.cs | 4 +- .../ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs | 9 +- .../Driver/Is31fl3731.Enums.cs | 4 +- .../Driver/Is31fl3731.cs | 17 ++-- .../Driver/Mcp23xxx.Enums.cs | 2 +- .../Driver/Mcp23xxx.cs | 9 +- .../Mcp23x08_Input_Sample/MeadowApp.cs | 26 +++--- .../Mcp23x17_Input_Sample/MeadowApp.cs | 26 +++--- .../Driver/Pca9685.Enums.cs | 4 +- .../ICs.IOExpanders.Pca9685/Driver/Pca9685.cs | 10 +- .../Samples/Pca9685_Sample/MeadowApp.cs | 3 +- .../Driver/SerialWombatBase.Enums.cs | 2 +- .../Driver/SerialWombatBase.cs | 53 ++++++----- .../Driver/Tca9548A.Addresses.cs | 2 +- .../Driver/ICs.IOExpanders.x74595.csproj | 2 +- .../Driver/x74595.Enums.cs | 9 -- .../Driver/x74595.PinDefinitions.cs | 3 + .../ICs.IOExpanders.x74595/Driver/x74595.cs | 6 +- .../Leds.Apa102/Driver/Apa102.Enums.cs | 2 +- .../Leds.Apa102/Driver/Apa102.cs | 5 +- .../Driver/SparkFunQwiicLEDStick.Enums.cs | 4 +- .../Driver/SparkFunQwiicLEDStick.cs | 2 +- .../Leds.Pca9633/Driver/Pca9633.Enums.cs | 4 +- .../Leds.Pca9633/Driver/Pca9633.cs | 9 +- .../Driver/Motors.Tb67h420ftg.csproj | 9 +- .../RTCs.Ds1307/Driver/Ds1307.Enums.cs | 2 +- .../RTCs.Ds1307/Driver/Ds1307.cs | 51 +++++----- .../RTCs.Ds323x/Driver/Ds3231.Enums.cs | 20 ---- .../RTCs.Ds323x/Driver/Ds3231.cs | 5 +- .../RTCs.Ds323x/Driver/Ds323x.Enums.cs | 15 +++ .../RTCs.Ds323x/Driver/Ds323x.Registers.cs | 31 +++++++ .../RTCs.Ds323x/Driver/Ds323x.cs | 27 +----- .../Driver/AdafruitMPRLS.Enums.cs | 6 +- .../Driver/AdafruitMPRLS.cs | 29 +++--- .../Driver/Bh1900Nux.Address.cs | 2 +- .../Driver/Bh1900Nux.cs | 7 +- ...{Bme280.Addresses.cs => Bme280.Address.cs} | 4 +- .../Driver/Bme280.cs | 29 ++---- .../Samples/Bme280_Sample/MeadowApp.cs | 2 +- .../Driver/Bme68x.Enums.cs | 4 +- .../Driver/Bme68x.cs | 23 +++-- .../Driver/Drivers/Bme680.cs | 2 +- .../Driver/Drivers/Bme688.cs | 2 +- .../Samples/Bme680_Sample/MeadowApp.cs | 10 +- .../Samples/Bme688_Sample/MeadowApp.cs | 8 +- .../Driver/Bmp085.Enums.cs | 4 +- .../Driver/Bmp085.cs | 92 +++++++------------ .../Driver/Sensors.Atmospheric.Bmp085.csproj | 7 +- .../Driver/Bmp180.Enums.cs | 4 +- .../Driver/Bmp180.cs | 44 +++------ .../Driver/Ccs811.Enums.cs | 4 +- .../Driver/Ccs811.cs | 9 +- .../Samples/Ccs811_Sample/MeadowApp.cs | 4 +- .../Driver/DhtBase.Enums.cs | 4 +- .../Driver/DhtBase.cs | 50 +++++----- .../Driver/Drivers/Dht10.cs | 12 +-- .../Driver/Drivers/Dht12.cs | 9 +- .../Driver/Hih6130.Enums.cs | 4 +- .../Driver/Hih6130.cs | 29 +++--- .../Driver/Drivers/Extras/Htu31d.Enums.cs | 4 +- .../Driver/Drivers/Htu21d.cs | 2 +- .../Driver/Drivers/Htu31d.cs | 2 +- .../Driver/Htux1dBase.cs | 15 ++- .../Driver/Mpl3115a2.Addresses.cs | 4 +- .../Driver/Mpl3115a2.cs | 9 +- .../Driver/Ms5611.Enums.cs | 12 ++- .../Driver/Ms5611.cs | 46 +++++++--- .../Driver/Ms5611Base.cs | 25 ----- .../Driver/Ms5611I2c.cs | 44 --------- .../Driver/Ms5611Spi.cs | 42 --------- .../Driver/Sgp40.Enums.cs | 2 +- .../Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs | 40 ++++---- .../Driver/Sht31d.Enums.cs | 4 +- .../Driver/Sht31d.cs | 29 +++--- .../Driver/Sht4x.Enums.cs | 4 +- .../Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs | 24 ++--- .../Driver/Si70xx.Enums.cs | 2 +- .../Driver/Si70xx.cs | 16 ++-- .../Driver/Th02.Enums.cs | 4 +- .../Sensors.Atmospheric.Th02/Driver/Th02.cs | 16 ++-- .../Driver/Mlx90640.Enums.cs | 4 +- .../Driver/Mlx90640.cs | 16 ++-- .../Driver/MaxBotix.I2c.cs | 15 ++- .../Driver/MaxBotix.enums.cs | 4 +- .../Driver/Vl53l0x.Enums.cs | 4 +- .../Driver/Vl53l0x.cs | 20 ++-- .../Samples/Vl53l0x_Sample/MeadowApp.cs | 12 +-- .../Driver/Ags01Db.Enums.cs | 4 +- .../Driver/Ags01Db.cs | 14 ++- .../Driver/Ens160.Enums.cs | 2 +- .../Driver/Ens160.cs | 9 +- .../Samples/Ens160_Sample/MeadowApp.cs | 14 +-- .../Sensors.Environmental.NextPm.csproj | 2 +- .../Driver/Pmsa003i.Enums.cs | 2 +- .../Driver/Pmsa003i.cs | 11 ++- .../Driver/Scd4xBase.Enums.cs | 2 +- .../Driver/Scd4xBase.cs | 9 +- .../Driver/Sensors.Gnss.Mt3339.csproj | 7 +- .../Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs | 4 +- .../Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs | 11 ++- .../Sensors.Gnss.NeoM8/Driver/NeoM8.Spi.cs | 2 +- .../Sensors.Hid.As5013/Driver/As5013.Enums.cs | 4 +- .../Sensors.Hid.As5013/Driver/As5013.cs | 2 +- .../Driver/BBQ10Keyboard.Enums.cs | 4 +- .../Driver/BBQ10Keyboard.cs | 2 +- .../Sensors.Hid.Mpr121/Driver/Mpr121.cs | 2 +- .../Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs | 4 +- .../Driver/Tsc2004.Enums.cs | 4 +- .../Sensors.Hid.Tsc2004/Driver/Tsc2004.cs | 2 +- .../Driver/Drivers/NesClassicController.cs | 2 +- .../Driver/Drivers/SnesClassicController.cs | 2 +- .../Driver/Drivers/WiiClassicController.cs | 2 +- .../Driver/Drivers/WiiClassicControllerPro.cs | 2 +- .../Driver/Drivers/WiiNunchuck.cs | 2 +- .../WiiExtensionControllerBase.Enums.cs | 4 +- .../Driver/Bh1745.Addresses.cs | 4 +- .../Sensors.Light.Bh1745/Driver/Bh1745.cs | 2 +- .../Driver/Bh1750.Addresses.cs | 4 +- .../Sensors.Light.Bh1750/Driver/Bh1750.cs | 2 +- .../Driver/Max44009.Enums.cs | 4 +- .../Sensors.Light.Max44009/Driver/Max44009.cs | 2 +- .../Driver/Si1145.Addresses.cs | 4 +- .../Sensors.Light.Si1145/Driver/Si1145.cs | 2 +- .../Driver/Tsl2591.Enums.cs | 4 +- .../Sensors.Light.Tsl2591/Driver/Tsl2591.cs | 2 +- .../Driver/Veml7700.Addresses.cs | 4 +- .../Sensors.Light.Veml7700/Driver/Veml7700.cs | 2 +- .../Driver/Nau7802.Enums.cs | 4 +- .../Driver/Nau7802.cs | 8 +- .../Driver/Drivers/Adxl345.cs | 2 +- .../Adxl345_Extras/Adxl345.Addresses.cs | 4 +- .../Driver/Drivers/Adxl362.cs | 2 +- .../Driver/Apds9960.Addresses.cs | 4 +- .../Driver/Apds9960.cs | 2 +- .../Driver/Bmi270.Enums.cs | 2 +- .../Sensors.Motion.Bmi270/Driver/Bmi270.cs | 2 +- .../Driver/Bno055.Enums.cs | 4 +- .../Sensors.Motion.Bno055/Driver/Bno055.cs | 2 +- .../Driver/Hmc5883.Addresses.cs | 4 +- .../Sensors.Motion.Hmc5883/Driver/Hmc5883.cs | 2 +- .../Sensors.Motion.Hmc5883/Driver/Qmc5883.cs | 2 +- .../Driver/Lis2Mdl.Enums.cs | 2 +- .../Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs | 2 +- .../Driver/Lsm303agr.Enums.cs | 2 +- .../Driver/Lsm303agr.cs | 4 +- .../Driver/Mag3110.Addresses.cs | 4 +- .../Sensors.Motion.Mag3110/Driver/Mag3110.cs | 2 +- .../Driver/Mma7660fc.Addresses.cs | 4 +- .../Driver/Mma7660fc.cs | 2 +- .../Driver/Mmc5603.Addresses.cs | 2 +- .../Sensors.Motion.Mmc5603/Driver/Mmc5603.cs | 2 +- .../Driver/Mpu6050.Addresses.cs | 4 +- .../Sensors.Motion.Mpu6050/Driver/Mpu6050.cs | 2 +- .../Driver/Ina260.Enums.cs | 4 +- .../Sensors.Power.Ina260/Driver/Ina260.cs | 6 +- .../Driver/Lm75.Addresses.cs | 4 +- .../Sensors.Temperature.Lm75/Driver/Lm75.cs | 2 +- .../Driver/Drivers/Mcp9600.cs | 2 +- .../Driver/Drivers/Mcp9601.cs | 2 +- .../Driver/Mcp960x.Enums.cs | 4 +- .../Driver/Mcp9808.Enums.cs | 4 +- .../Driver/Mcp9808.cs | 2 +- .../Driver/Tmp102.Addresses.cs | 4 +- .../Driver/Tmp102.cs | 2 +- Source/Meadow.Foundation.sln | 3 - 201 files changed, 792 insertions(+), 833 deletions(-) delete mode 100644 Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.Enums.cs delete mode 100644 Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.Enums.cs create mode 100644 Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Registers.cs rename Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/{Bme280.Addresses.cs => Bme280.Address.cs} (86%) delete mode 100644 Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Base.cs delete mode 100644 Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611I2c.cs delete mode 100644 Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Spi.cs diff --git a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs index 8e5481dc86..b9f3022b6c 100644 --- a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs @@ -3,7 +3,7 @@ public partial class Tea5767 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs index 91b763409d..25a0f3b42e 100644 --- a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs +++ b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs @@ -9,7 +9,7 @@ namespace Meadow.Foundation.Audio.Radio /// /// Represents a TEA5767 radio /// - public partial class Tea5767 + public partial class Tea5767 : II2cPeripheral { /// /// I2C Communication bus used to communicate with the peripheral @@ -25,6 +25,11 @@ public partial class Tea5767 /// public bool IsMuted { get; set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new TEA5767 object using the default parameters /// diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ch1115/Driver/Ch1115.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ch1115/Driver/Ch1115.cs index 5e2d4649f7..3384dba39a 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ch1115/Driver/Ch1115.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ch1115/Driver/Ch1115.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Displays /// /// Provide an interface to the Ch1115 family of displays /// - public partial class Ch1115 : IGraphicsDisplay, ISpiDevice + public partial class Ch1115 : IGraphicsDisplay, ISpiPeripheral { /// /// The display color mode - 1 bit per pixel monochrome diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs index 22516d5426..7b0d0ea84f 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs @@ -120,7 +120,7 @@ public CharacterDisplay( /// The number of character columns /// True if this is a Seeed Studio Grove display (default is false) public CharacterDisplay(II2cBus i2cBus, - byte address = (byte)I2cCharacterDisplay.Addresses.Default, + byte address = (byte)I2cCharacterDisplay.Address.Default, byte rows = 4, byte columns = 20, bool isGroveDisplay = false) { diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs index 0d45c569a8..4e866e909a 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs @@ -16,7 +16,7 @@ public class GroveCharacterDisplay : I2cCharacterDisplay /// The number of character rows /// The number of character columns public GroveCharacterDisplay(II2cBus i2cBus, - byte address = (byte)Addresses.Address_0x3E, + byte address = (byte)Address.Address_0x3E, byte rows = 2, byte columns = 16) : base(i2cBus, address, rows, columns) { diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs index 6fe29f48d5..cef498f95a 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs @@ -3,9 +3,9 @@ public partial class I2cCharacterDisplay { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x27 diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs index b69124be20..7bfd85b652 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.Displays.Lcd /// /// Represents a character display using I2C /// - public partial class I2cCharacterDisplay : ICharacterDisplay + public partial class I2cCharacterDisplay : ICharacterDisplay, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -121,7 +126,7 @@ protected enum I2CCommands /// I2C address /// Number of character rows /// Number of character columns - public I2cCharacterDisplay(II2cBus i2cBus, byte address = (byte)Addresses.Default, byte rows = 4, byte columns = 20) + public I2cCharacterDisplay(II2cBus i2cBus, byte address = (byte)Address.Default, byte rows = 4, byte columns = 20) { i2cComms = new I2cCommunications(i2cBus, address); DisplayConfig = new TextDisplayConfig() { Width = columns, Height = rows }; diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs index 5f1df27532..c21c1dd024 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs @@ -63,7 +63,7 @@ void InitI2c() display = new CharacterDisplay ( i2cBus: Device.CreateI2cBus(I2cBusSpeed.Standard), - address: (byte)I2cCharacterDisplay.Addresses.Default, + address: (byte)I2cCharacterDisplay.Address.Default, rows: 4, columns: 20 ); } @@ -75,7 +75,7 @@ void InitGrove() display = new CharacterDisplay ( i2cBus: Device.CreateI2cBus(I2cBusSpeed.Standard), - address: (byte)I2cCharacterDisplay.Addresses.Grove, + address: (byte)I2cCharacterDisplay.Address.Grove, rows: 2, columns: 16, isGroveDisplay: true ); diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Led.FourDigitSevenSegment/Driver/FourDigitSevenSegment.cs b/Source/Meadow.Foundation.Peripherals/Displays.Led.FourDigitSevenSegment/Driver/FourDigitSevenSegment.cs index 0a8807da19..7df8edc0ae 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Led.FourDigitSevenSegment/Driver/FourDigitSevenSegment.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Led.FourDigitSevenSegment/Driver/FourDigitSevenSegment.cs @@ -12,8 +12,7 @@ public class FourDigitSevenSegment CancellationTokenSource cts = null; readonly IDigitalOutputPort[] digits; - - SevenSegment[] sevenSegments; + readonly SevenSegment[] sevenSegments; /// /// Creates a SevenSegment connected to the especified IPins to a IODevice diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Max7219/Driver/Max7219.cs b/Source/Meadow.Foundation.Peripherals/Displays.Max7219/Driver/Max7219.cs index 3a6f5b8cd9..30c7219e88 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Max7219/Driver/Max7219.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Max7219/Driver/Max7219.cs @@ -8,7 +8,7 @@ namespace Meadow.Foundation.Displays /// /// Max7219 LED matrix driver /// - public partial class Max7219 : ISpiDevice + public partial class Max7219 : ISpiPeripheral { /// /// Number of digits per Module diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Pcd8544/Driver/Pcd8544.cs b/Source/Meadow.Foundation.Peripherals/Displays.Pcd8544/Driver/Pcd8544.cs index 26d6d72040..154a509ad9 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Pcd8544/Driver/Pcd8544.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Pcd8544/Driver/Pcd8544.cs @@ -9,7 +9,7 @@ namespace Meadow.Foundation.Displays /// /// Represents a Pcd8544 monochrome display /// - public class Pcd8544 : IGraphicsDisplay, ISpiDevice + public class Pcd8544 : IGraphicsDisplay, ISpiPeripheral { /// /// Display color mode diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs index 343c145196..d7b51feabe 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs @@ -66,7 +66,7 @@ internal enum DisplayCommand : byte /// /// Valid I2C addresses for the display /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x3C diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs index 42d7ebef21..37df60e8f8 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Displays /// /// Provide an interface to the Sh110x family of displays /// - public abstract partial class Sh110x : IGraphicsDisplay, ISpiDevice + public abstract partial class Sh110x : IGraphicsDisplay, ISpiPeripheral, II2cPeripheral { /// /// The display color mode - 1 bit per pixel monochrome @@ -60,6 +60,11 @@ public SpiClockConfiguration.Mode SpiBusMode set => spiComms.BusMode = value; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// The connection type (I2C or SPI) /// diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs index ae107cdbc0..886038ec61 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs @@ -20,7 +20,7 @@ public override Task Initialize() var sh1107 = new Sh1107 ( i2cBus: Device.CreateI2cBus(), - address: (byte)Addresses.Address_0x3C, + address: (byte)Address.Address_0x3C, width: 128, height: 128 ); diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs index 7e2646d664..1452b0081f 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs @@ -54,7 +54,7 @@ public Ssd1306(ISpiBus spiBus, /// Address of the bus on the I2C display. /// Type of SSD1306 display (default = 128x64 pixel display). public Ssd1306(II2cBus i2cBus, - byte address = (byte)Addresses.Default, + byte address = (byte)Address.Default, DisplayType displayType = DisplayType.OLED128x64) { this.displayType = displayType; diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs index 05e69772c8..bc2b3c1675 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs @@ -36,7 +36,7 @@ public Ssd1309(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutput /// /// I2cBus connected to display /// Address of the bus on the I2C display. - public Ssd1309(II2cBus i2cBus, byte address = (byte)Addresses.Default) : + public Ssd1309(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, DisplayType.OLED128x64) { } diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs index 61e5002b9b..df6e4ccfc2 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs @@ -5,7 +5,7 @@ public abstract partial class Ssd130xBase /// /// Valid I2C addresses for the display /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x3C diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs index e43fc7b346..87f92d6c5f 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs @@ -9,7 +9,7 @@ namespace Meadow.Foundation.Displays /// /// Represents the SSD130x family of OLED displays /// - public abstract partial class Ssd130xBase : IGraphicsDisplay, ISpiDevice + public abstract partial class Ssd130xBase : IGraphicsDisplay, ISpiPeripheral, II2cPeripheral { /// /// The display color mode @@ -50,6 +50,11 @@ public Frequency SpiBusSpeed set => spiComms.BusSpeed = value; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// The default SPI bus mode for the device /// diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd1327/Driver/Ssd1327.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd1327/Driver/Ssd1327.cs index fcf2be5ef0..8749a93282 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd1327/Driver/Ssd1327.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd1327/Driver/Ssd1327.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Displays /// /// Provides an interface to the Ssd1327 greyscale OLED display /// - public partial class Ssd1327 : IGraphicsDisplay, ISpiDevice + public partial class Ssd1327 : IGraphicsDisplay, ISpiPeripheral { /// /// The display color mode (4 bit per pixel grayscale) diff --git a/Source/Meadow.Foundation.Peripherals/Displays.St7565/Driver/St7565.cs b/Source/Meadow.Foundation.Peripherals/Displays.St7565/Driver/St7565.cs index e3ab5da622..59314c9e72 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.St7565/Driver/St7565.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.St7565/Driver/St7565.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Displays /// /// Provide an interface to the ST7565 family of displays /// - public partial class St7565 : IGraphicsDisplay, ISpiDevice + public partial class St7565 : IGraphicsDisplay, ISpiPeripheral { /// /// The display color mode - 1 bit per pixel monochrome diff --git a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs index 8a84819ef8..4f52203684 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs @@ -7,7 +7,7 @@ namespace Meadow.Foundation.Displays { - public abstract partial class TftSpiBase : IGraphicsDisplay, ISpiDevice + public abstract partial class TftSpiBase : IGraphicsDisplay, ISpiPeripheral { //these displays typically support 16 & 18 bit, some also include 8, 9, 12 and/or 24 bit color diff --git a/Source/Meadow.Foundation.Peripherals/Displays.ePaper/Driver/ePaperBase.cs b/Source/Meadow.Foundation.Peripherals/Displays.ePaper/Driver/ePaperBase.cs index be73046883..f07678cb18 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.ePaper/Driver/ePaperBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.ePaper/Driver/ePaperBase.cs @@ -7,7 +7,7 @@ namespace Meadow.Foundation.Displays /// /// Represents a base ePaper display driver /// - public abstract class EPaperBase : ISpiDevice + public abstract class EPaperBase : ISpiPeripheral { /// /// The default SPI bus speed for the device diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs index 112545c7f0..9582fa3e17 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs @@ -3,9 +3,9 @@ public abstract partial class Ads1x15Base { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs index cbed8c4296..29220bf38b 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.ICs.ADC /// /// Encapsulation for ADCs based upon the Ads1x1x family of chips. /// - public abstract partial class Ads1x15Base : PollingSensorBase + public abstract partial class Ads1x15Base : PollingSensorBase, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -39,7 +44,7 @@ public abstract partial class Ads1x15Base : PollingSensorBase /// /// protected Ads1x15Base(II2cBus i2cBus, - Addresses address, + Address address, MeasureMode mode, ChannelSetting channel) { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs index d3849baddc..741c0adff1 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs @@ -65,7 +65,7 @@ public SampleRateSetting SampleRate /// Create a new ADS1015 object /// public Ads1015(II2cBus i2cBus, - Addresses address = Addresses.Default, + Address address = Address.Default, MeasureMode mode = MeasureMode.OneShot, ChannelSetting channel = ChannelSetting.A0A1Differential, SampleRateSetting sampleRate = SampleRateSetting.Sps1600) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs index de7efba83d..309bb5c367 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs @@ -64,7 +64,7 @@ public SampleRateSetting SampleRate /// Create a new ADS1115 object /// public Ads1115(II2cBus i2cBus, - Addresses address = Addresses.Default, + Address address = Address.Default, MeasureMode mode = MeasureMode.OneShot, ChannelSetting channel = ChannelSetting.A0A1Differential, SampleRateSetting sampleRate = SampleRateSetting.Sps128) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs index 9f3bd1e77a..5d8d9987cd 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs @@ -18,7 +18,7 @@ public override async Task Initialize() adc = new Ads1015( Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.FastPlus), - Ads1x15Base.Addresses.Default, + Ads1x15Base.Address.Default, Ads1x15Base.MeasureMode.Continuous, Ads1x15Base.ChannelSetting.A0SingleEnded, Ads1015.SampleRateSetting.Sps3300); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs index f85f76cec8..1d64320625 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs @@ -18,7 +18,7 @@ public override async Task Initialize() adc = new Ads1115( Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.FastPlus), - Ads1x15Base.Addresses.Default, + Ads1x15Base.Address.Default, Ads1x15Base.MeasureMode.Continuous, Ads1x15Base.ChannelSetting.A0SingleEnded, Ads1115.SampleRateSetting.Sps128); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs index 740aace3e1..af7249c858 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs @@ -3,7 +3,7 @@ public partial class At24Cxx { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs index 9ecb3c001c..ad7dde192a 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.ICs.EEPROM /// /// Encapsulation for EEPROMs based upon the AT24Cxx family of chips /// - public partial class At24Cxx + public partial class At24Cxx : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs index b0afc11f2b..d5255c21f1 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs @@ -131,11 +131,11 @@ public enum DataRate : byte /// /// 32hz /// - _32hz, + _32hz, } /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// public enum Address : byte { @@ -188,4 +188,4 @@ public enum LutIndex : byte Index7, } } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs index 1ccee0403c..aec5e2af8f 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs @@ -10,7 +10,8 @@ namespace Meadow.Foundation.ICs.FanControllers /// Represents an EMC2101 fan controller and temperature monitor /// public partial class Emc2101 : - PollingSensorBase<(Temperature? InternalTemperature, Temperature? ExternalTemperature, AngularVelocity? FanSpeed)> + PollingSensorBase<(Temperature? InternalTemperature, Temperature? ExternalTemperature, AngularVelocity? FanSpeed)>, + II2cPeripheral { /// /// Internal Temperature changed event @@ -42,6 +43,11 @@ public partial class Emc2101 : /// public AngularVelocity? FanSpeed => Conditions.FanSpeed; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Get/Set the minimum fan speed for the currently connected fan /// diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs index dfdd1a420c..6b1ed4301b 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs @@ -3,9 +3,9 @@ public partial class As1115 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x00 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs index 785bea59f5..be521facc8 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs @@ -11,7 +11,7 @@ namespace Meadow.Foundation.ICs.IOExpanders /// /// Represents an As1115 led driver and key scanner /// - public partial class As1115 : IGraphicsDisplay, IDisposable + public partial class As1115 : IGraphicsDisplay, II2cPeripheral, IDisposable { /// /// Event raised when any key scan button is pressed @@ -45,6 +45,11 @@ public partial class As1115 : IGraphicsDisplay, IDisposable /// protected readonly II2cCommunications i2cComms; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// The display color mode (1 bit per pixel) /// @@ -95,7 +100,7 @@ public partial class As1115 : IGraphicsDisplay, IDisposable /// Interrupt pin /// Address of the bus on the I2C display. public As1115(II2cBus i2cBus, IPin buttonInterruptPin, - byte address = (byte)Addresses.Default) + byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs index cf544ca5dd..63ac3ffe32 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs @@ -3,10 +3,10 @@ public partial class Ds3502 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// Controlled by pulling A0 and A1 high or low /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x28 (A0 low, A1 low) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs index 7a674efdc5..2d2d997da1 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.ICs.IOExpanders /// /// Represents a DS3502 digital potentiometer /// - public partial class Ds3502 + public partial class Ds3502 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Default I2C bus speed /// @@ -24,7 +29,7 @@ public partial class Ds3502 /// /// Address of the bus on the I2C display /// I2C bus instance - public Ds3502(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Ds3502(II2cBus i2cBus, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs index 1798ad84e4..8b644dad3e 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs @@ -5,9 +5,9 @@ public partial class Ht16k33 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x70 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs index 65bfb103ed..e574db66de 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs @@ -6,8 +6,13 @@ namespace Meadow.Foundation.ICs.IOExpanders /// /// Represents an Ht16k33 128 led driver and 39 key scanner /// - public partial class Ht16k33 + public partial class Ht16k33 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -28,7 +33,7 @@ public partial class Ht16k33 /// /// Address of the bus on the I2C display /// I2C bus instance - public Ht16k33(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Ht16k33(II2cBus i2cBus, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address, 8, 17); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs index 9eb0011ac7..ca73c3baad 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs @@ -3,9 +3,9 @@ public partial class Is31fl3731 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x74 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs index 056eaa2f6d..0e59c5f8e3 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs @@ -9,24 +9,23 @@ namespace Meadow.Foundation.ICs.IOExpanders /// The Is31fl3731 is a compact LED driver for 144 single LEDs /// /// Based on https://github.com/adafruit/Adafruit_IS31FL3731 - public partial class Is31fl3731 + public partial class Is31fl3731 : II2cPeripheral { const byte RegConfig = 0x00; const byte RegConfigPictureMode = 0x00; - //const byte RegConfigAutoPlayMode = 0x08; - //const byte RegConfigAudioPlayMode = 0x18; - //const byte ConfPictureMode = 0x00; - //const byte ConfAutoFrameMode = 0x04; - //const byte ConfAudioMode = 0x08; const byte DisplayOptionRegister = 0x05; const byte PictureFrameReg = 0x01; const byte RegShutdown = 0x0A; - //const byte RegAudioSync = 0x06; const byte CommandRegister = 0xFD; - const byte CommandFunctionReg = 0x0B; //'page nine' + const byte CommandFunctionReg = 0x0B; + + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -43,7 +42,7 @@ public partial class Is31fl3731 /// /// The I2C bus /// The I2C address - public Is31fl3731(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Is31fl3731(II2cBus i2cBus, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); Frame = 0; diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs index 972ef67f6a..7ae7a2e874 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs @@ -5,7 +5,7 @@ public partial class Mcp23xxx /// /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x20 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs index efe0dcdf66..906c2830d8 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.ICs.IOExpanders /// /// Provide an interface to connect to a MCP2xxx port expander /// - abstract partial class Mcp23xxx : IDigitalInputOutputController, ISpiDevice + abstract partial class Mcp23xxx : IDigitalInputOutputController, ISpiPeripheral, II2cPeripheral { /// /// Raised when the value of any pin configured for input interrupts changes @@ -52,8 +52,12 @@ public SpiClockConfiguration.Mode SpiBusMode set => (mcpDevice as ISpiCommunications).BusMode = value; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + private readonly IByteCommunications mcpDevice; - private IDigitalInputPort interruptPort; private IDigitalOutputPort resetPort; private IDictionary inputPorts; @@ -108,7 +112,6 @@ void Initialize(IDigitalInputPort interruptPort = null, // raise an exception if not. also, doc in constructor what we expect from an interrupt port if (interruptPort != null) { - this.interruptPort = interruptPort; interruptPort.Changed += InterruptPortChanged; } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs index 844eeafbf5..922c56bbc4 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs @@ -20,18 +20,18 @@ public override Task Initialize() { Resolver.Log.Info("Initializing..."); - + IDigitalInputPort interruptPort = Device.CreateDigitalInputPort(Device.Pins.D00, InterruptMode.EdgeBoth, ResistorMode.InternalPullDown); IDigitalOutputPort resetPort = Device.CreateDigitalOutputPort(Device.Pins.D01); - mcp = new Mcp23008(Device.CreateI2cBus(), (byte)Addresses.Address_0x20, interruptPort, resetPort); + mcp = new Mcp23008(Device.CreateI2cBus(), (byte)Address.Address_0x20, interruptPort, resetPort); return base.Initialize(); } - + public override Task Run() { - // TestInterrupts(); + // TestInterrupts(); return TestDigitalInputPorts(1000); @@ -40,19 +40,19 @@ public override Task Run() void TestBulkPinReads(int loopCount) { - for (int l = 0; l < loopCount; l++) + for (int l = 0; l < loopCount; l++) { byte mask = mcp.ReadFromPorts(); var bits = new BitArray(new byte[] { mask }); var bitsString = new StringBuilder(); - - foreach (var bit in bits) + + foreach (var bit in bits) { - bitsString.Append((bool)bit ? "1":"0"); + bitsString.Append((bool)bit ? "1" : "0"); } - Resolver.Log.Info($"Port Values, raw:{mask:X}, bits: { bitsString}"); + Resolver.Log.Info($"Port Values, raw:{mask:X}, bits: {bitsString}"); Thread.Sleep(100); } @@ -69,7 +69,7 @@ async Task TestDigitalInputPorts(int loopCount) var in06 = mcp.CreateDigitalInputPort(mcp.Pins.GP6, InterruptMode.EdgeFalling, ResistorMode.InternalPullUp); var in07 = mcp.CreateDigitalInputPort(mcp.Pins.GP7, InterruptMode.EdgeFalling, ResistorMode.InternalPullUp); - var inputPorts = new List() + var inputPorts = new List() { in00, in01, in02, in03, in04, in05, in06, in07 }; @@ -77,11 +77,11 @@ async Task TestDigitalInputPorts(int loopCount) string output; // read all the ports, sleep for 100ms and repeat a few times. - for (int l = 0; l < loopCount; l++) + for (int l = 0; l < loopCount; l++) { output = string.Empty; - foreach (var inputPort in inputPorts) + foreach (var inputPort in inputPorts) { //Resolver.Log.Info($"InputPort {inputPort.Pin.Name} Read: {inputPort.State}"); output += $"{(inputPort.State ? 1 : 0)}"; @@ -91,7 +91,7 @@ async Task TestDigitalInputPorts(int loopCount) } // cleanup - for (int i = 0; i < inputPorts.Count; i++) + for (int i = 0; i < inputPorts.Count; i++) { inputPorts[i].Dispose(); } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs index 0946c28f13..5c534cde33 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs @@ -23,7 +23,7 @@ public override Task Initialize() IDigitalInputPort interruptPort = Device.CreateDigitalInputPort(Device.Pins.D00, InterruptMode.EdgeBoth, ResistorMode.InternalPullDown); IDigitalOutputPort resetPort = Device.CreateDigitalOutputPort(Device.Pins.D01); - mcp = new Mcp23017(Device.CreateI2cBus(), (byte)Addresses.Address_0x20, interruptPort, resetPort); + mcp = new Mcp23017(Device.CreateI2cBus(), (byte)Address.Address_0x20, interruptPort, resetPort); mcp.InputChanged += Mcp_InputChanged; @@ -39,26 +39,26 @@ public override Task Run() { TestInterrupts(); - // return TestDigitalInputPorts(1000); + // return TestDigitalInputPorts(1000); return base.Run(); } void TestBulkPinReads(int loopCount) { - for (int l = 0; l < loopCount; l++) + for (int l = 0; l < loopCount; l++) { byte mask = mcp.ReadFromPorts(); var bits = new BitArray(new byte[] { mask }); var bitsString = new StringBuilder(); - - foreach (var bit in bits) + + foreach (var bit in bits) { - bitsString.Append((bool)bit ? "1":"0"); + bitsString.Append((bool)bit ? "1" : "0"); } - Resolver.Log.Info($"Port Values, raw:{mask:X}, bits: { bitsString}"); + Resolver.Log.Info($"Port Values, raw:{mask:X}, bits: {bitsString}"); Thread.Sleep(100); } @@ -84,20 +84,20 @@ async Task TestDigitalInputPorts(int loopCount) var in14 = mcp.CreateDigitalInputPort(mcp.Pins.GPB6, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp); var in15 = mcp.CreateDigitalInputPort(mcp.Pins.GPB7, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp); - var inputPorts = new List() + var inputPorts = new List() { - in00, in01, in02, in03, in04, in05, in06, in07, + in00, in01, in02, in03, in04, in05, in06, in07, in08, in09, in10, in11, in12, in13, in14, in15, }; string output; // read all the ports, sleep for 100ms and repeat a few times. - for (int l = 0; l < loopCount; l++) + for (int l = 0; l < loopCount; l++) { output = string.Empty; - foreach (var inputPort in inputPorts) + foreach (var inputPort in inputPorts) { //Resolver.Log.Info($"InputPort {inputPort.Pin.Name} Read: {inputPort.State}"); output += $"{(inputPort.State ? 1 : 0)}"; @@ -107,7 +107,7 @@ async Task TestDigitalInputPorts(int loopCount) } // cleanup - for (int i = 0; i < inputPorts.Count; i++) + for (int i = 0; i < inputPorts.Count; i++) { inputPorts[i].Dispose(); } @@ -127,7 +127,7 @@ void TestInterrupts() var inputPort05 = mcp.CreateDigitalInputPort(mcp.Pins.GPA5, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); var inputPort06 = mcp.CreateDigitalInputPort(mcp.Pins.GPA6, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); var inputPort07 = mcp.CreateDigitalInputPort(mcp.Pins.GPA7, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); - + var inputPort08 = mcp.CreateDigitalInputPort(mcp.Pins.GPB0, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); var inputPort09 = mcp.CreateDigitalInputPort(mcp.Pins.GPB1, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); var inputPort10 = mcp.CreateDigitalInputPort(mcp.Pins.GPB2, InterruptMode.EdgeBoth, ResistorMode.InternalPullUp, debounceTime); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs index 93911d8870..7565486850 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs @@ -3,9 +3,9 @@ public partial class Pca9685 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs index c0af6687ac..58389192cc 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs @@ -11,6 +11,11 @@ namespace Meadow.Foundation.ICs.IOExpanders /// All PWM channels run at the same Frequency public partial class Pca9685 { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -18,7 +23,6 @@ public partial class Pca9685 private readonly Frequency frequency; - //# Registers/etc. const byte Mode1 = 0x00; const byte Mode2 = 0x01; const byte SubAdr1 = 0x02; @@ -55,7 +59,7 @@ public partial class Pca9685 /// The I2C bus connected to the peripheral /// The frequency /// The I2C address - public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Addresses.Default) + public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Address.Default) { i2CBus = i2cBus; this.address = address; @@ -68,7 +72,7 @@ public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Address /// /// The I2C bus connected to the peripheral /// The I2C address - public Pca9685(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Pca9685(II2cBus i2cBus, byte address = (byte)Address.Default) : this(i2cBus, new Frequency(IPwmOutputController.DefaultPwmFrequency, Frequency.UnitType.Hertz), address) { } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs index 38500ce0f9..4949a83f2f 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs @@ -2,7 +2,6 @@ using Meadow.Devices; using Meadow.Foundation.ICs.IOExpanders; using Meadow.Hardware; -using System; using System.Threading.Tasks; namespace ICs.IOExpanders.Pca9685_Sample @@ -18,7 +17,7 @@ public override Task Initialize() Resolver.Log.Info("Initialize..."); var i2CBus = Device.CreateI2cBus(I2cBusSpeed.FastPlus); - pca9685 = new Pca9685(i2CBus, new Meadow.Units.Frequency(50, Meadow.Units.Frequency.UnitType.Hertz), (byte)Pca9685.Addresses.Default); + pca9685 = new Pca9685(i2CBus, new Meadow.Units.Frequency(50, Meadow.Units.Frequency.UnitType.Hertz), (byte)Pca9685.Address.Default); pca9685.Initialize(); return base.Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs index e47849fa27..3099d7df41 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs @@ -6,7 +6,7 @@ public partial class SerialWombatBase { /// - /// Valid addresses for the Chip. + /// Valid I2C addresses for the device /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs index 5da3fcac57..e24ed96e8c 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs @@ -9,17 +9,23 @@ namespace Meadow.Foundation.ICs.IOExpanders { - public abstract partial class SerialWombatBase : IDigitalInputOutputController, IPwmOutputController, IAnalogInputController + public abstract partial class SerialWombatBase : IDigitalInputOutputController, IPwmOutputController, + IAnalogInputController, II2cPeripheral { - private II2cBus _bus; // TODO: add uart support - private WombatVersion _version = null!; - private WombatInfo? _info; - private Guid? _uuid; + private readonly II2cBus i2cBus; + private WombatVersion version = null!; + private WombatInfo? wombatInfo; + private Guid? uuid; /// - /// The I2C address + /// The default I2C address for the peripheral /// - public Address _address { get; } + public byte I2cDefaultAddress => (byte)Address.Default; + + /// + /// The current I2C address for the peripheral + /// + public Address I2cAddress { get; } /// /// The sync root object @@ -34,11 +40,10 @@ public abstract partial class SerialWombatBase : IDigitalInputOutputController, /// /// Create SerialWombatBase object /// - protected SerialWombatBase(II2cBus bus, Address address = SerialWombatBase.Address.Default, Logger? logger = null) + protected SerialWombatBase(II2cBus bus, Address address = Address.Default, Logger? logger = null) { Pins = new PinDefinitions(this); - _bus = bus; - _address = address; + i2cBus = bus; Logger = logger; } @@ -52,7 +57,7 @@ protected SerialWombatBase(II2cBus bus, Address address = SerialWombatBase.Addre /// protected void SendPacket(Span tx, Span rx) { - _bus.Exchange((byte)_address, tx, rx); + i2cBus.Exchange((byte)I2cAddress, tx, rx); } /// @@ -62,12 +67,12 @@ public WombatVersion Version { get { - if (_version == null) // lazy load + if (version == null) // lazy load { try { var response = SendCommand(Commands.GetVersion); - _version = new WombatVersion(Encoding.ASCII.GetString(response)); + version = new WombatVersion(Encoding.ASCII.GetString(response)); } catch (Exception ex) { @@ -75,7 +80,7 @@ public WombatVersion Version } } - return _version ?? new WombatVersion("0"); + return version ?? new WombatVersion("0"); } } @@ -86,13 +91,13 @@ public WombatInfo Info { get { - if (_info == null) // lazy load + if (wombatInfo == null) // lazy load { try { var id = (ushort)ReadFlash(FlashRegister18.DeviceID); var rev = (ushort)(ReadFlash(FlashRegister18.DeviceRevision) & 0xf); - _info = new WombatInfo(id, rev); + wombatInfo = new WombatInfo(id, rev); } catch (Exception ex) { @@ -100,7 +105,7 @@ public WombatInfo Info } } - return _info ?? new WombatInfo(0, 0); + return wombatInfo ?? new WombatInfo(0, 0); } } @@ -111,7 +116,7 @@ public Guid Uuid { get { - if (_uuid == null) // lazy load + if (uuid == null) // lazy load { var address = FlashRegister18.DeviceUuid; @@ -126,10 +131,10 @@ public Guid Uuid bytes[index++] = (byte)(data & 0xff >> 16); } - _uuid = new Guid(bytes); + uuid = new Guid(bytes); } - return _uuid.Value; + return uuid.Value; } } @@ -141,7 +146,7 @@ protected byte[] SendCommand(in Span command) lock (SyncRoot) { var rx = new byte[8] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - _bus.Exchange((byte)_address, command, rx); + i2cBus.Exchange((byte)I2cAddress, command, rx); Logger?.Trace($"SW: TX {BitConverter.ToString(command.ToArray())}"); Logger?.Trace($"SW: RX {BitConverter.ToString(rx)}"); @@ -447,7 +452,7 @@ public IPwmPort CreatePwmPort(IPin pin, Frequency frequency, float dutyCycle = 0 { var channel = pin.SupportedChannels.OfType().FirstOrDefault(); - if (channel == null) throw new NotSupportedException($"Pin {pin.Name} Does not support PWM"); + if (channel == null) { throw new NotSupportedException($"Pin {pin.Name} Does not support PWM"); } return new PwmPort(this, pin, channel); } @@ -457,7 +462,7 @@ public IPwmPort CreatePwmPort(IPin pin, Frequency frequency, float dutyCycle = 0 /// public IAnalogInputPort CreateAnalogInputPort(IPin pin, int sampleCount = 64) { - return CreateAnalogInputPort((IPin)pin, sampleCount, TimeSpan.FromSeconds(1), new Voltage(0)); + return CreateAnalogInputPort(pin, sampleCount, TimeSpan.FromSeconds(1), new Voltage(0)); } /// @@ -467,7 +472,7 @@ public IAnalogInputPort CreateAnalogInputPort(IPin pin, int sampleCount, TimeSpa { var channel = pin.SupportedChannels.OfType().FirstOrDefault(); - if (channel == null) throw new NotSupportedException($"Pin {pin.Name} Does not support ADC"); + if (channel == null) { throw new NotSupportedException($"Pin {pin.Name} Does not support ADC"); } return new AnalogInputPort(this, pin, channel, sampleCount); } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.TCA9548A/Driver/Tca9548A.Addresses.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.TCA9548A/Driver/Tca9548A.Addresses.cs index a76df3502e..cb0512005f 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.TCA9548A/Driver/Tca9548A.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.TCA9548A/Driver/Tca9548A.Addresses.cs @@ -3,7 +3,7 @@ public partial class Tca9548a { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// public enum Addresses : byte { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/ICs.IOExpanders.x74595.csproj b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/ICs.IOExpanders.x74595.csproj index 84ccaa18b7..1624a49a57 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/ICs.IOExpanders.x74595.csproj +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/ICs.IOExpanders.x74595.csproj @@ -13,7 +13,7 @@ Meadow.Foundation, IOExpanders, x74595 0.1.52 true - x74595 I2C shift register digital output expander + x74595 SPI shift register digital output expander diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.Enums.cs deleted file mode 100644 index 957a8ac305..0000000000 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.Enums.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Meadow.Foundation.ICs.IOExpanders -{ - public partial class x74595 - { - - } -} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.PinDefinitions.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.PinDefinitions.cs index a9eb18b06f..f074d4e064 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.PinDefinitions.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.PinDefinitions.cs @@ -11,6 +11,9 @@ public partial class x74595 /// public class PinDefinitions : IPinDefinitions { + /// + /// The controller for the pin definitions + /// public IPinController Controller { get; set; } /// diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.cs index cc80b97026..b7c9f76aca 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.x74595/Driver/x74595.cs @@ -7,13 +7,13 @@ namespace Meadow.Foundation.ICs.IOExpanders { /// - /// Provide an interface to connect to a 74595 shift register. + /// Provide an interface to connect to a 74595 shift register /// /// /// Control the outputs from a 74595 shift register (or a chain of shift registers) - /// using a SPI interface. + /// using a SPI interface /// - public partial class x74595 : IDigitalOutputController, ISpiDevice + public partial class x74595 : IDigitalOutputController, ISpiPeripheral { /// /// The pin definitions diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.Enums.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.Enums.cs index c1e4ceadd7..f7d595d8d5 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.Enums.cs @@ -33,4 +33,4 @@ public enum PixelOrder BGR } } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.cs index e0b8b8cf6f..5a67cf5016 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/Apa102.cs @@ -5,10 +5,9 @@ namespace Meadow.Foundation.Leds { /// - /// Represents APA102/Dotstar Led(s). + /// Represents APA102/Dotstar Led(s) /// - /// Based on logic from https://github.com/adafruit/Adafruit_CircuitPython_DotStar/blob/master/adafruit_dotstar.py - public partial class Apa102 : IApa102, ISpiDevice + public partial class Apa102 : IApa102, ISpiPeripheral { /// /// The default SPI bus speed for the device diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs index 331f90738b..fb96c2533c 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs @@ -3,9 +3,9 @@ public partial class SparkFunQwiicLEDStick { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x22 diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs index a805fe621b..db08a83977 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs @@ -24,7 +24,7 @@ public partial class SparkFunQwiicLEDStick : I2cCommunications, IApa102 /// The I2C bus /// The I2C address public SparkFunQwiicLEDStick(II2cBus i2cbus, - byte address = (byte)Addresses.Default) + byte address = (byte)Address.Default) : base(i2cbus, address, 1, 16) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs index a027732ae4..d6b342173b 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs @@ -3,9 +3,9 @@ public partial class Pca9633 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x62 diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs index 5e105799f8..c3584898f3 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs @@ -7,6 +7,11 @@ namespace Meadow.Foundation.Leds /// public partial class Pca9633 { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -40,7 +45,7 @@ public bool IsOn /// /// i2c bus /// i2c address - public Pca9633(II2cBus i2cBus, Addresses address) + public Pca9633(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } @@ -50,7 +55,7 @@ public Pca9633(II2cBus i2cBus, Addresses address) /// /// i2c bus /// i2c address - public Pca9633(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Pca9633(II2cBus i2cBus, byte address) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Motors.Tb67h420ftg/Driver/Motors.Tb67h420ftg.csproj b/Source/Meadow.Foundation.Peripherals/Motors.Tb67h420ftg/Driver/Motors.Tb67h420ftg.csproj index ea7a9c28d0..64353463a9 100644 --- a/Source/Meadow.Foundation.Peripherals/Motors.Tb67h420ftg/Driver/Motors.Tb67h420ftg.csproj +++ b/Source/Meadow.Foundation.Peripherals/Motors.Tb67h420ftg/Driver/Motors.Tb67h420ftg.csproj @@ -10,16 +10,13 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Motors.Tb67h420ftg https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Motor, HBridge, Tb67h420ftg + Meadow,Meadow.Foundation,Motor,HBridge,Tb67h420ftg 0.1.22 true Tb67h420ftg digital input motor controller - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs index f14a713c14..860efd6aaf 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs @@ -3,7 +3,7 @@ public partial class Ds1307 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs index 01ce3fd1ab..acbbc09c19 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.RTCs /// /// Represents a DS1307 real-time clock /// - public partial class Ds1307 + public partial class Ds1307 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + const int OriginYear = 1980; readonly II2cBus i2cBus; @@ -76,8 +81,7 @@ public DateTime GetTime() /// The new time public void SetTime(DateTime time) { - var data = new List(); - data.Add(0); + var data = new List { 0 }; data.AddRange(ToRTCTime(time)); i2cBus.Write((byte)Address.Default, data.ToArray()); @@ -90,7 +94,7 @@ public void SetTime(DateTime time) /// The number of bytes to read public byte[] ReadRAM(int offset, int count) { - var data = new byte[count]; + var data = new byte[count]; i2cBus.Write((byte)Address.Default, new byte[] { (byte)(0x08 + offset) }); i2cBus.Read((byte)Address.Default, data); return data; @@ -104,8 +108,10 @@ public byte[] ReadRAM(int offset, int count) /// public void WriteRAM(int offset, params byte[] data) { - var d = new List(); - d.Add((byte)(0x08 + offset)); // target start register offset + var d = new List + { + (byte)(0x08 + offset) // target start register offset + }; d.AddRange(data); i2cBus.Write((byte)Address.Default, d.ToArray()); @@ -118,31 +124,16 @@ public void WriteRAM(int offset, params byte[] data) /// Throw if invalid frequency is selected public void SquareWaveOutput(SquareWaveFrequency freq) { - byte registerData; - - switch (freq) + var registerData = freq switch { - case SquareWaveFrequency.Wave_1000Hz: - registerData = (1 << 4); - break; - case SquareWaveFrequency.Wave_4096Hz: - registerData = (1 << 4) | (1 << 0); - break; - case SquareWaveFrequency.Wave_8192Hz: - registerData = (1 << 4) | (1 << 1); - break; - case SquareWaveFrequency.Wave_32768Hz: - registerData = (1 << 4) | (1 << 0) | (1 << 1); - break; - case SquareWaveFrequency.Wave_Low: - registerData = 0; - break; - case SquareWaveFrequency.Wave_High: - registerData = (1 << 7); - break; - default: - throw new NotSupportedException(); - } + SquareWaveFrequency.Wave_1000Hz => (byte)(1 << 4), + SquareWaveFrequency.Wave_4096Hz => (byte)((1 << 4) | (1 << 0)), + SquareWaveFrequency.Wave_8192Hz => (byte)((1 << 4) | (1 << 1)), + SquareWaveFrequency.Wave_32768Hz => (byte)((1 << 4) | (1 << 0) | (1 << 1)), + SquareWaveFrequency.Wave_Low => (byte)0, + SquareWaveFrequency.Wave_High => (byte)(1 << 7), + _ => throw new NotSupportedException(), + }; // control register is at 0x07 i2cBus.Write((byte)Address.Default, new byte[] { 0x07, registerData }); //register and value diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.Enums.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.Enums.cs deleted file mode 100644 index 1273ab15c6..0000000000 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.Enums.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Meadow.Foundation.RTCs -{ - public partial class Ds3231 : Ds323x - { - /// - /// Valid addresses for the sensor. - /// - public enum Address : byte - { - /// - /// Bus address 0x68 - /// - Address_0x68 = 0x68, - /// - /// Default bus address - /// - Default = Address_0x68 - } - } -} diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs index 6b7b7dfeee..0f04cc3894 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs @@ -13,10 +13,7 @@ public partial class Ds3231 : Ds323x /// Digital pin connected to the alarm interrupt pin on the RTC. /// The I2C Bus the peripheral is connected to /// I2C Bus address of the peripheral - public Ds3231( - II2cBus i2cBus, - IPin interruptPin = null, - byte address = (byte)Address.Default) + public Ds3231(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Address.Default) : base(new I2cCommunications(i2cBus, address), interruptPin) { } diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs index 878ba0d47f..c71faca891 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs @@ -2,6 +2,21 @@ { public partial class Ds323x { + /// + /// Valid I2C addresses for the sensor + /// + public enum Address : byte + { + /// + /// Bus address 0x68 + /// + Address_0x68 = 0x68, + /// + /// Default bus address + /// + Default = Address_0x68 + } + /// /// Possible values for the alarm that can be set or alarm that has been raised /// diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Registers.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Registers.cs new file mode 100644 index 0000000000..bd95f825ab --- /dev/null +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Registers.cs @@ -0,0 +1,31 @@ +namespace Meadow.Foundation.RTCs +{ + public partial class Ds323x + { + /// + /// Register addresses in the sensor + /// + static class Registers + { + public static readonly byte Seconds = 0x00; + public static readonly byte Minutes = 0x01; + public static readonly byte Hours = 0x02; + public static readonly byte Day = 0x03; + public static readonly byte Date = 0x04; + public static readonly byte Month = 0x05; + public static readonly byte Year = 0x06; + public static readonly byte Alarm1Seconds = 0x07; + public static readonly byte Alarm1Minutes = 0x08; + public static readonly byte Alarm1Hours = 0x09; + public static readonly byte Alarm1DayDate = 0x0a; + public static readonly byte Alarm2Minutes = 0x0b; + public static readonly byte Alarm2Hours = 0x0c; + public static readonly byte Alarm2DayDate = 0x0d; + public static readonly byte Control = 0x0e; + public static readonly byte ControlStatus = 0x0f; + public static readonly byte AgingOffset = 0x10; + public static readonly byte TemperatureMSB = 0x11; + public static readonly byte TemperatureLSB = 0x12; + } + } +} diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs index e66bc4d8a5..125762c13e 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs @@ -7,33 +7,12 @@ namespace Meadow.Foundation.RTCs /// /// DS323X real-time clock /// - public partial class Ds323x : IDisposable + public partial class Ds323x : II2cPeripheral, IDisposable { /// - /// Register addresses in the sensor + /// The default I2C address for the peripheral /// - static class Registers - { - public static readonly byte Seconds = 0x00; - public static readonly byte Minutes = 0x01; - public static readonly byte Hours = 0x02; - public static readonly byte Day = 0x03; - public static readonly byte Date = 0x04; - public static readonly byte Month = 0x05; - public static readonly byte Year = 0x06; - public static readonly byte Alarm1Seconds = 0x07; - public static readonly byte Alarm1Minutes = 0x08; - public static readonly byte Alarm1Hours = 0x09; - public static readonly byte Alarm1DayDate = 0x0a; - public static readonly byte Alarm2Minutes = 0x0b; - public static readonly byte Alarm2Hours = 0x0c; - public static readonly byte Alarm2DayDate = 0x0d; - public static readonly byte Control = 0x0e; - public static readonly byte ControlStatus = 0x0f; - public static readonly byte AgingOffset = 0x10; - public static readonly byte TemperatureMSB = 0x11; - public static readonly byte TemperatureLSB = 0x12; - } + public byte I2cDefaultAddress => (byte)Address.Default; /// /// Number of registers that hold the date and time information. diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs index 48fab5431f..938279f327 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs @@ -3,9 +3,9 @@ public partial class AdafruitMPRLS { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x18 @@ -17,4 +17,4 @@ public enum Addresses : byte Default = Address_0x18 } } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs index 057b7ee51d..ee53e52cbe 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs @@ -10,17 +10,15 @@ namespace Meadow.Foundation.Sensors.Atmospheric { /// /// Device driver for the Adafruit MPRLS Ported Pressure Sensor Breakout - /// https://www.adafruit.com/product/3965 - /// Device datasheets also available here: https://sensing.honeywell.com/micropressure-mpr-series /// - public partial class AdafruitMPRLS - : ByteCommsSensorBase<(Pressure? Pressure, Pressure? RawPsiMeasurement)>, IBarometricPressureSensor + public partial class AdafruitMPRLS : + ByteCommsSensorBase<(Pressure? Pressure, Pressure? RawPsiMeasurement)>, + II2cPeripheral, IBarometricPressureSensor { - //Defined in section 6.6.1 of the datasheet. - private readonly byte[] mprlsMeasurementCommand = { 0xAA, 0x00, 0x00 }; - - private const int MINIMUM_PSI = 0; - private const int MAXIMUM_PSI = 25; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; /// /// Raised when a new reading has been made. Events will only be raised @@ -59,12 +57,17 @@ public partial class AdafruitMPRLS /// public bool InternalMathSaturated { get; set; } + private readonly byte[] mprlsMeasurementCommand = { 0xAA, 0x00, 0x00 }; + + private const int MINIMUM_PSI = 0; + private const int MAXIMUM_PSI = 25; + /// /// Represents an Adafruit MPRLS Ported Pressure Sensor /// /// I2Cbus connected to the sensor public AdafruitMPRLS(II2cBus i2cbus) - : base(i2cbus, (byte)Addresses.Default) + : base(i2cbus, (byte)Address.Default) { } /// @@ -88,17 +91,14 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Pressure? Pressure, { return Task.Run(() => { - //Send the command to the sensor to tell it to do the thing. BusComms.Write(mprlsMeasurementCommand); - //Datasheet says wait 5ms Thread.Sleep(5); while (true) { BusComms.Read(ReadBuffer.Span[0..1]); - //From section 6.5 of the datasheet IsDevicePowered = BitHelpers.GetBitValue(ReadBuffer.Span[0], 6); IsDeviceBusy = BitHelpers.GetBitValue(ReadBuffer.Span[0], 5); HasMemoryIntegrityFailed = BitHelpers.GetBitValue(ReadBuffer.Span[0], 2); @@ -108,12 +108,10 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Pressure? Pressure, { throw new InvalidOperationException("Sensor pressure has exceeded max value!"); } - if (HasMemoryIntegrityFailed) { throw new InvalidOperationException("Sensor internal memory integrity check failed!"); } - if (!IsDeviceBusy) { break; @@ -124,7 +122,6 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Pressure? Pressure, var rawPSIMeasurement = (ReadBuffer.Span[1] << 16) | (ReadBuffer.Span[2] << 8) | ReadBuffer.Span[3]; - //From Section 8.0 of the datasheet. var calculatedPSIMeasurement = (rawPSIMeasurement - 1677722) * (MAXIMUM_PSI - MINIMUM_PSI); calculatedPSIMeasurement /= 15099494 - 1677722; calculatedPSIMeasurement += MINIMUM_PSI; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs index 73108a76ca..39c753e429 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs @@ -56,7 +56,7 @@ public enum MeasurementModes } /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs index 29f0e00b36..f94f5f200c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs @@ -8,7 +8,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// /// Represents a Bh1900Nux temperature sensor /// - public partial class Bh1900Nux : ByteCommsSensorBase, ITemperatureSensor + public partial class Bh1900Nux : ByteCommsSensorBase, ITemperatureSensor, II2cPeripheral { /// /// Raised when the temperature value changes @@ -20,6 +20,11 @@ public partial class Bh1900Nux : ByteCommsSensorBase, ITemper /// public Units.Temperature? Temperature => Conditions; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Bh1900Nux object /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs similarity index 86% rename from Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Addresses.cs rename to Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs index 29136e0326..697ca6d99b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs @@ -3,9 +3,9 @@ public partial class Bme280 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x76 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs index 2053d0ed4a..227a1e3e9e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs @@ -9,24 +9,6 @@ namespace Meadow.Foundation.Sensors.Atmospheric { - // TODO: for standby durations of 1,000ms and less, the sensor - // will actually handle the reading loop. you put it into `Normal` - // mode and set it to one of the known `StandbyDuration`s. - // - // So perhaps this should be an option. From a method signature - // standpoint, i think that we would add an overload that took - // a known `StandbyDuration` instead of an int. - // - // With that said, however, as far as I can tell, the sensor won't - // send an interrupt when a new reading is taken, so i'm not sure - // how we would synchronize with it, since the time that each read - // takes is determined by the samples, filter, etc. -b - // - // TODO: for longer standby durations, we should put the sensor into - // Modes.Sleep to save power. Need to figure out what the stanby - // duration threshold is for that. i'm guessing 5 seconds might be a - // good value. - /// /// BME280 Temperature, Pressure and Humidity Sensor /// @@ -36,7 +18,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Bme280 : PollingSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure)>, - ITemperatureSensor, IHumiditySensor, IBarometricPressureSensor, ISpiDevice + ITemperatureSensor, IHumiditySensor, IBarometricPressureSensor, ISpiPeripheral, II2cPeripheral { /// /// Temperature changed event @@ -137,12 +119,17 @@ public SpiClockConfiguration.Mode SpiBusMode set => ((ISpiCommunications)bme280Comms).BusMode = value; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Initializes a new instance of the BME280 class /// /// I2C Bus to use for communicating with the sensor /// I2C address of the sensor (default = 0x77) - public Bme280(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Bme280(II2cBus i2cBus, byte address = (byte)Address.Default) { bme280Comms = new I2cCommunications(i2cBus, address); configuration = new Configuration(); // here to avoid the warning @@ -278,7 +265,7 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T v_x1_u32r = v_x1_u32r < 0 ? 0 : v_x1_u32r; v_x1_u32r = v_x1_u32r > 419430400 ? 419430400 : v_x1_u32r; - // + conditions.Humidity = new RelativeHumidity((v_x1_u32r >> 12) / 1024, HU.Percent); return conditions; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs index 5aea2e58a6..1d769b5619 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs @@ -75,7 +75,7 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME280 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme280(i2c, (byte)Bme280.Addresses.Default); // SDA pulled up + sensor = new Bme280(i2c, (byte)Bme280.Address.Default); // SDA pulled up } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs index 6ac6f928e5..6d52a1dfc9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs @@ -3,9 +3,9 @@ partial class Bme68x { /// - /// Valid addresses for the busComms + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x77 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs index f113d89d5f..7310c72984 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs @@ -21,7 +21,7 @@ public abstract partial class Bme68x : RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, - ITemperatureSensor, IHumiditySensor, IBarometricPressureSensor, ISpiDevice + ITemperatureSensor, IHumiditySensor, IBarometricPressureSensor, ISpiPeripheral, II2cPeripheral { /// /// Raised when the temperature value changes @@ -120,7 +120,7 @@ public FilteringMode FilterMode FilteringMode filterMode; /// - /// Enable / disable the busComms heater + /// Enable / disable the sensor heater /// public bool HeaterIsEnabled { @@ -184,7 +184,12 @@ public SpiClockConfiguration.Mode SpiBusMode } /// - /// Communication bus used to read and write to the BME68x busComms + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + + /// + /// Communication bus used to read and write to the BME68x sensor /// readonly IByteCommunications busComms; @@ -211,7 +216,7 @@ public SpiClockConfiguration.Mode SpiBusMode readonly Configuration configuration; /// - /// Calibration data for the busComms + /// Calibration data for the sensor /// internal Calibration? calibration; @@ -229,7 +234,7 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// I2C Bus to use for communicating with the sensor /// I2C address - protected Bme68x(II2cBus i2cBus, byte address = (byte)Addresses.Default) + protected Bme68x(II2cBus i2cBus, byte address = (byte)Address.Default) { configuration = new Configuration(); busComms = new I2cCommunications(i2cBus, address); @@ -264,7 +269,7 @@ protected Bme68x(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, Configuratio } /// - /// Initialize the busComms + /// Initialize the sensor /// protected void Initialize() { @@ -384,7 +389,7 @@ public TimeSpan GetMeasurementDuration(HeaterProfileType profile) /// /// Raise events for subcribers and notify of value changes /// - /// The updated busComms data + /// The updated sensor data protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> changeResult) { if (changeResult.New.Temperature is { } temp) @@ -407,9 +412,9 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T } /// - /// Reads data from the busComms + /// Reads data from the sensor /// - /// The latest busComms reading + /// The latest sensor reading protected override Task<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> ReadSensor() { configuration.TemperatureOversample = TemperatureOversampleMode; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs index 5024dc58e4..8b353ab26b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs @@ -15,7 +15,7 @@ public partial class Bme680 : Bme68x /// /// I2C Bus to use for communicating with the busComms /// I2C address of the busComms - public Bme680(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) + public Bme680(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs index 388dc6e385..7c951f29c2 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs @@ -15,7 +15,7 @@ public partial class Bme688 : Bme68x /// /// I2C Bus to use for communicating with the busComms /// I2C address of the busComms - public Bme688(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) + public Bme688(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs index 8348ce5884..56c21b7bdb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs @@ -32,7 +32,7 @@ public override Task Initialize() //c# 8 pattern match syntax. checks for !null and assigns var. if (result.Old?.Temperature is { } oldTemp && result.Old?.Humidity is { } oldHumidity && - result.New.Temperature is { } newTemp && + result.New.Temperature is { } newTemp && result.New.Humidity is { } newHumidity) { return ((newTemp - oldTemp).Abs().Celsius > 0.5 && @@ -44,7 +44,7 @@ result.New.Temperature is { } newTemp && sensor?.Subscribe(consumer); - if(sensor != null) + if (sensor != null) { sensor.Updated += (sender, result) => { @@ -67,7 +67,7 @@ result.New.Temperature is { } newTemp && void EnableGasHeater() { - if(sensor != null) + if (sensor != null) { sensor.GasConversionIsEnabled = true; sensor.HeaterIsEnabled = true; @@ -89,12 +89,12 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME680 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme680(i2c, (byte)Bme688.Addresses.Address_0x76); + sensor = new Bme680(i2c, (byte)Bme688.Address.Address_0x76); } async Task ReadConditions() { - if(sensor == null) { return; } + if (sensor == null) { return; } var (Temperature, Humidity, Pressure, Resistance) = await sensor.Read(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs index 2ad5b80e25..7981d2de9b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs @@ -33,7 +33,7 @@ public override Task Initialize() //c# 8 pattern match syntax. checks for !null and assigns var. if (result.Old?.Temperature is { } oldTemp && result.Old?.Humidity is { } oldHumidity && - result.New.Temperature is { } newTemp && + result.New.Temperature is { } newTemp && result.New.Humidity is { } newHumidity) { return ((newTemp - oldTemp).Abs().Celsius > 0.5 && @@ -45,7 +45,7 @@ result.New.Temperature is { } newTemp && sensor?.Subscribe(consumer); - if(sensor != null) + if (sensor != null) { sensor.Updated += (sender, result) => { @@ -90,12 +90,12 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME688 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme688(i2c, (byte)Bme688.Addresses.Address_0x76); + sensor = new Bme688(i2c, (byte)Bme688.Address.Address_0x76); } async Task ReadConditions() { - if(sensor == null) { return; } + if (sensor == null) { return; } var (Temperature, Humidity, Pressure, Resistance) = await sensor.Read(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs index 7d5e91e036..0c65e8b5e1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs @@ -3,9 +3,9 @@ public partial class Bmp085 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x77 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs index 9d69ac4025..493cb678a3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs @@ -1,9 +1,9 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Peripherals.Sensors; using Meadow.Units; +using System; +using System.Threading; +using System.Threading.Tasks; namespace Meadow.Foundation.Sensors.Atmospheric { @@ -12,23 +12,28 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Bmp085 : ByteCommsSensorBase<(Units.Temperature? Temperature, Pressure? Pressure)>, - ITemperatureSensor, IBarometricPressureSensor + ITemperatureSensor, IBarometricPressureSensor, II2cPeripheral { /// /// Raised when the temperature value changes /// public event EventHandler> TemperatureUpdated = delegate { }; - + /// /// Raised when the pressure value changes /// public event EventHandler> PressureUpdated = delegate { }; - // Oversampling for measurements. Please see the datasheet for this sensor for more information. - byte oversamplingSetting; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + + readonly byte oversamplingSetting; - // These wait times correspond to the oversampling settings. - // Please see the datasheet for this sensor for more information. + /// + /// These wait times correspond to the oversampling settings + /// readonly byte[] pressureWaitTime = { 5, 8, 14, 26 }; // Calibration data backing stores @@ -45,12 +50,12 @@ public partial class Bmp085 : private short _md; /// - /// Last value read from the Pressure sensor. + /// Last value read from the Pressure sensor /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// Last value read from the Pressure sensor. + /// Last value read from the Pressure sensor /// public Pressure? Pressure => Conditions.Pressure; @@ -60,7 +65,7 @@ public partial class Bmp085 : /// The I2C bus /// The I2C address /// The device mode - public Bmp085(II2cBus i2cBus, byte address = (byte)Addresses.Default, + public Bmp085(II2cBus i2cBus, byte address = (byte)Address.Default, DeviceMode deviceMode = DeviceMode.Standard) : base(i2cBus, address) { @@ -87,13 +92,13 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T } /// - /// Calculates the compensated pressure and temperature. + /// Calculates the compensated pressure and temperature /// protected override Task<(Units.Temperature? Temperature, Pressure? Pressure)> ReadSensor() { (Units.Temperature? Temperature, Pressure? Pressure) conditions; - long x1, x2, x3, b3, b4, b5, b6, b7, p; + long x1, x2, x3, b4, b5, b6, b7, p; long ut = ReadUncompensatedTemperature(); @@ -111,24 +116,15 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T x1 = (_b2 * (b6 * b6 >> 12)) >> 11; x2 = _ac2 * b6 >> 11; x3 = x1 + x2; - - switch (oversamplingSetting) + var b3 = oversamplingSetting switch { - case 0: - b3 = ((_ac1 * 4 + x3) + 2) >> 2; - break; - case 1: - b3 = ((_ac1 * 4 + x3) + 2) >> 1; - break; - case 2: - b3 = ((_ac1 * 4 + x3) + 2); - break; - case 3: - b3 = ((_ac1 * 4 + x3) + 2) << 1; - break; - default: - throw new Exception("Oversampling setting must be 0-3"); - } + 0 => (_ac1 * 4 + x3 + 2) >> 2, + 1 => (_ac1 * 4 + x3 + 2) >> 1, + 2 => (_ac1 * 4 + x3 + 2), + 3 => (_ac1 * 4 + x3 + 2) << 1, + _ => throw new Exception("Oversampling setting must be 0-3"), + }; + x1 = _ac3 * b6 >> 13; x2 = (_b1 * (b6 * b6 >> 12)) >> 16; x3 = ((x1 + x2) + 2) >> 2; @@ -148,53 +144,34 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T private long ReadUncompensatedTemperature() { - // write register address - // TODO: delete after validating - //BusComms.WriteBytes(new byte[] { 0xF4, 0x2E }); WriteBuffer.Span[0] = 0xf4; WriteBuffer.Span[1] = 0x2e; BusComms?.Write(WriteBuffer.Span[0..2]); - // Required as per datasheet. Thread.Sleep(5); - // write register address - // TODO: Delete after validating - //BusComms.WriteBytes(new byte[] { 0xF6 }); WriteBuffer.Span[0] = 0xf6; BusComms?.Write(WriteBuffer.Span[0]); - // get MSB and LSB result - // TODO: Delete after validating - //byte[] data = new byte[2]; - //data = BusComms.ReadBytes(2); BusComms?.Read(ReadBuffer.Span[0..2]); - return ((ReadBuffer.Span[0] << 8) | ReadBuffer.Span[1]); + return (ReadBuffer.Span[0] << 8) | ReadBuffer.Span[1]; } private long ReadUncompensatedPressure() { - // write register address - // TODO: Delete after validating - //BusComms.WriteBytes(new byte[] { 0xF4, (byte)(0x34 + (oversamplingSetting << 6)) }); WriteBuffer.Span[0] = 0xf4; WriteBuffer.Span[1] = (byte)(0x34 + (oversamplingSetting << 6)); - // insert pressure waittime using oversampling setting as index. Thread.Sleep(pressureWaitTime[oversamplingSetting]); - // get MSB and LSB result - // TODO: delete after validating - //byte[] data = new byte[3]; - //data = BusComms.ReadRegisters(0xF6, 3); BusComms?.ReadRegister(0xf6, ReadBuffer.Span[0..3]); return ((ReadBuffer.Span[0] << 16) | (ReadBuffer.Span[1] << 8) | (ReadBuffer.Span[2])) >> (8 - oversamplingSetting); } /// - /// Retrieves the factory calibration data stored in the sensor. + /// Retrieves the factory calibration data stored in the sensor /// private void GetCalibrationData() { @@ -213,13 +190,6 @@ private void GetCalibrationData() private short ReadShort(byte address) { - // TODO: i think we already have a method that does this. I'm just not sure - // which endian it is. not sure what the last statement here is dooing - - // get MSB and LSB result - // TODO: delete after validating - //byte[] data = new byte[2]; - //data = BusComms.ReadRegisters(address, 2); BusComms?.ReadRegister(address, ReadBuffer.Span[0..2]); return (short)((ReadBuffer.Span[0] << 8) | ReadBuffer.Span[1]); @@ -231,4 +201,4 @@ private short ReadShort(byte address) async Task ISensor.Read() => (await Read()).Pressure.Value; } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Sensors.Atmospheric.Bmp085.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Sensors.Atmospheric.Bmp085.csproj index b2dd441771..295379a480 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Sensors.Atmospheric.Bmp085.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Sensors.Atmospheric.Bmp085.csproj @@ -16,11 +16,8 @@ Bosch BMP085 I2C barometric pressure sensor enable - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs index 5e165926b6..f082b80018 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs @@ -3,9 +3,9 @@ public partial class Bmp180 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x77 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs index 58a414553b..b8709a5a66 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs @@ -12,7 +12,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Bmp180 : ByteCommsSensorBase<(Units.Temperature? Temperature, Pressure? Pressure)>, - ITemperatureSensor, IBarometricPressureSensor + ITemperatureSensor, IBarometricPressureSensor, II2cPeripheral { /// /// Raised when the temperature value changes @@ -24,10 +24,14 @@ public partial class Bmp180 : /// public event EventHandler> PressureUpdated = delegate { }; - // Oversampling for measurements + /// + /// Oversampling for measurements + /// private readonly byte oversamplingSetting; - // These wait times correspond to the oversampling settings + /// + /// These wait times correspond to the oversampling settings + /// private readonly byte[] pressureWaitTime = { 5, 8, 14, 26 }; // Calibration data backing stores @@ -54,9 +58,9 @@ public partial class Bmp180 : public Pressure? Pressure => Conditions.Pressure; /// - /// Default SPI bus speed + /// The default I2C address for the peripheral /// - public static Frequency DEFAULT_SPEED = new Frequency(40000, Frequency.UnitType.Kilohertz); + public byte I2cDefaultAddress => (byte)Address.Default; /// /// Create a new BMP180 object @@ -64,7 +68,7 @@ public partial class Bmp180 : /// The I2C bus /// The I2C address /// The device mode - public Bmp180(II2cBus i2cBus, byte address = (byte)Addresses.Default, + public Bmp180(II2cBus i2cBus, byte address = (byte)Address.Default, DeviceMode deviceMode = DeviceMode.Standard) : base(i2cBus, address) { @@ -140,26 +144,15 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T private long ReadUncompensatedTemperature() { - // write register address - // TODO: delete after validating - //BusComms.WriteBytes(new byte[] { 0xF4, 0x2E }); WriteBuffer.Span[0] = 0xf4; WriteBuffer.Span[1] = 0x2e; BusComms?.Write(WriteBuffer.Span[0..2]); - // Required as per datasheet. Thread.Sleep(5); - // write register address - // TODO: Delete after validating - //BusComms.WriteBytes(new byte[] { 0xF6 }); WriteBuffer.Span[0] = 0xf6; BusComms?.Write(WriteBuffer.Span[0]); - // get MSB and LSB result - // TODO: Delete after validating - //byte[] data = new byte[2]; - //data = BusComms.ReadBytes(2); BusComms?.Read(ReadBuffer.Span[0..2]); return ((ReadBuffer.Span[0] << 8) | ReadBuffer.Span[1]); @@ -167,26 +160,18 @@ private long ReadUncompensatedTemperature() private long ReadUncompensatedPressure() { - // write register address - // TODO: Delete after validating - //BusComms.WriteBytes(new byte[] { 0xF4, (byte)(0x34 + (oversamplingSetting << 6)) }); WriteBuffer.Span[0] = 0xf4; WriteBuffer.Span[1] = (byte)(0x34 + (oversamplingSetting << 6)); - // insert pressure waittime using oversampling setting as index. Thread.Sleep(pressureWaitTime[oversamplingSetting]); - // get MSB and LSB result - // TODO: delete after validating - //byte[] data = new byte[3]; - //data = BusComms.ReadRegisters(0xF6, 3); BusComms?.ReadRegister(0xf6, ReadBuffer.Span[0..3]); return ((ReadBuffer.Span[0] << 16) | (ReadBuffer.Span[1] << 8) | (ReadBuffer.Span[2])) >> (8 - oversamplingSetting); } /// - /// Retrieves the factory calibration data stored in the sensor. + /// Retrieves the factory calibration data stored in the sensor /// private void GetCalibrationData() { @@ -205,13 +190,6 @@ private void GetCalibrationData() private short ReadShort(byte address) { - // TODO: i think we already have a method that does this. I'm just not sure - // which endian it is. not sure what the last statement here is dooing - - // get MSB and LSB result - // TODO: delete after validating - //byte[] data = new byte[2]; - //data = BusComms.ReadRegisters(address, 2); BusComms?.ReadRegister(address, ReadBuffer.Span[0..2]); return (short)((ReadBuffer.Span[0] << 8) | ReadBuffer.Span[1]); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs index 97ad3a3e15..d8949873a0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs @@ -3,9 +3,9 @@ public partial class Ccs811 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x5A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs index 970ea3a6ad..2d6dacef27 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs @@ -12,7 +12,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Ccs811 : ByteCommsSensorBase<(Concentration? Co2, Concentration? Voc)>, - ICo2Sensor, IVocSensor + ICo2Sensor, IVocSensor, II2cPeripheral { private const int ReadBufferSize = 10; private const int WriteBufferSize = 8; @@ -39,12 +39,17 @@ public partial class Ccs811 : /// public Concentration? Voc => Conditions.Voc; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Ccs811 object /// /// The I2C bus /// The I2C address - public Ccs811(II2cBus i2cBus, Addresses address = Addresses.Default) + public Ccs811(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Samples/Ccs811_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Samples/Ccs811_Sample/MeadowApp.cs index 3a261bfe60..c6c29d3add 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Samples/Ccs811_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Samples/Ccs811_Sample/MeadowApp.cs @@ -16,8 +16,8 @@ public override Task Initialize() { Resolver.Log.Info("Initializing..."); - var i2c = Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.Fast); - sensor = new Ccs811(i2c); + var i2cBus = Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.Fast); + sensor = new Ccs811(i2cBus); var consumer = Ccs811.CreateObserver( handler: result => diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs index d7859084cd..a146b53e5a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs @@ -8,9 +8,9 @@ public abstract partial class DhtBase { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x5C diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs index 8f44245853..e8fd10969b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs @@ -1,17 +1,16 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Peripherals.Sensors; using Meadow.Units; +using System; +using System.Threading; +using System.Threading.Tasks; namespace Meadow.Foundation.Sensors.Atmospheric { /// - /// Provide a mechanism for reading the Temperature and Humidity from - /// a DHT temperature and Humidity sensor. + /// Base class for th DHT family Temperature and Humidity sensors /// - public abstract partial class DhtBase : + public abstract partial class DhtBase : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, ITemperatureSensor, IHumiditySensor { @@ -26,29 +25,28 @@ public abstract partial class DhtBase : public event EventHandler> HumidityUpdated = delegate { }; private readonly BusType protocol; - private int lastMeasurement = 0; /// - /// The temperature + /// The current temperature /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// The relative humidity + /// The current relative humidity /// public RelativeHumidity? Humidity => Conditions.Humidity; /// - /// How last read went, true for success, false for failure + /// Was the last sensor read succesful, true for success, false for failure /// public bool WasLastReadSuccessful { get; internal set; } /// - /// Create a DHT sensor through I2C (Only DHT12) + /// Create a DHT sensor through I2C /// /// The I2C bus connected to the sensor /// The I2C address - public DhtBase(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public DhtBase(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, writeBufferSize: 8, readBufferSize: 6) { protocol = BusType.I2C; @@ -62,11 +60,11 @@ public DhtBase(II2cBus i2cBus, byte address = (byte)Addresses.Default) /// internal virtual void ReadData() { - if (protocol == BusType.OneWire) + if (protocol == BusType.OneWire) { ReadDataOneWire(); - } - else + } + else { ReadDataI2c(); } @@ -88,13 +86,11 @@ internal virtual void ReadDataI2c() BusComms?.Write(0x00); BusComms?.Read(ReadBuffer.Span[0..5]); - lastMeasurement = Environment.TickCount; - - if ((ReadBuffer.Span[4] == ((ReadBuffer.Span[0] + ReadBuffer.Span[1] + ReadBuffer.Span[2] + ReadBuffer.Span[3]) & 0xFF))) + if ((ReadBuffer.Span[4] == ((ReadBuffer.Span[0] + ReadBuffer.Span[1] + ReadBuffer.Span[2] + ReadBuffer.Span[3]) & 0xFF))) { WasLastReadSuccessful = (ReadBuffer.Span[0] != 0) || (ReadBuffer.Span[2] != 0); - } - else + } + else { WasLastReadSuccessful = false; } @@ -118,10 +114,12 @@ internal virtual void ReadDataI2c() /// The updated sensor data protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity)> changeResult) { - if (changeResult.New.Temperature is { } temp) { + if (changeResult.New.Temperature is { } temp) + { TemperatureUpdated?.Invoke(this, new ChangeResult(temp, changeResult.Old?.Temperature)); } - if (changeResult.New.Humidity is { } humidity) { + if (changeResult.New.Humidity is { } humidity) + { HumidityUpdated?.Invoke(this, new ChangeResult(humidity, changeResult.Old?.Humidity)); } base.RaiseEventsAndNotify(changeResult); @@ -135,11 +133,11 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T { (Units.Temperature? Temperature, RelativeHumidity? Humidity) conditions; - if (protocol == BusType.I2C) + if (protocol == BusType.I2C) { ReadDataI2c(); - } - else + } + else { ReadDataOneWire(); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs index f5b8c28281..d6547beec9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs @@ -11,18 +11,16 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public class Dht10 : DhtBase { - private const byte CMD_INIT = 0b_1110_0001; - private const byte CMD_START = 0b_1010_1100; - private const byte CMD_SOFTRESET = 0b_1011_1010; - - //private new byte[] _readBuffer = new byte[6]; + private const byte CMD_INIT = 0b_1110_0001; + private const byte CMD_START = 0b_1010_1100; + private const byte CMD_SOFTRESET = 0b_1011_1010; /// /// Create a new Dht10 object. /// /// Address of the Dht12 (default = 0x27). /// I2C bus (default = 100 KHz). - public Dht10(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Dht10(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { BusComms?.Write(CMD_SOFTRESET); @@ -36,7 +34,7 @@ internal override void ReadDataI2c() BusComms?.Write(CMD_START); Thread.Sleep(75); - + //data stored in the read buffer BusComms?.Read(ReadBuffer.Span); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs index 2b6e38a371..2ac93361b9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs @@ -8,14 +8,19 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// 0 - 95% humidity +/- 4% /// Currently only supports I2C /// - public class Dht12 : DhtBase + public class Dht12 : DhtBase, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Dht12 object /// /// Address of the Dht12 (default = 0x27) /// I2C bus (default = 100 KHz) - public Dht12(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Dht12(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs index 9fc95a27e4..67d4e73c41 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs @@ -3,9 +3,9 @@ public partial class Hih6130 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x27 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs index 5c6fe81b3b..6264a7ed4b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs @@ -1,25 +1,23 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Peripherals.Sensors; using Meadow.Units; +using System; +using System.Threading.Tasks; namespace Meadow.Foundation.Sensors.Atmospheric { /// - /// Provide a mechanism for reading the Temperature and Humidity from - /// a HIH6130 temperature and Humidity sensor. + /// Represents an HIH6130 Temperature and Humidity sensor /// public partial class Hih6130 : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Raised when the temperature value changes /// public event EventHandler> TemperatureUpdated = delegate { }; - + /// /// Raised when the humidity value changes /// @@ -35,12 +33,17 @@ public partial class Hih6130 : /// public RelativeHumidity? Humidity => Conditions.Humidity; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new HIH6130 object using the default parameters for the component. /// /// Address of the HIH6130 (default = 0x27). /// I2C bus (default = 100 KHz). - public Hih6130(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Hih6130(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 4, writeBufferSize: 4) { } @@ -51,10 +54,12 @@ public Hih6130(II2cBus i2cBus, byte address = (byte)Addresses.Default) /// protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity)> changeResult) { - if (changeResult.New.Temperature is { } temp) { + if (changeResult.New.Temperature is { } temp) + { TemperatureUpdated?.Invoke(this, new ChangeResult(temp, changeResult.Old?.Temperature)); } - if (changeResult.New.Humidity is { } humidity) { + if (changeResult.New.Humidity is { } humidity) + { HumidityUpdated?.Invoke(this, new ChangeResult(humidity, changeResult.Old?.Humidity)); } base.RaiseEventsAndNotify(changeResult); @@ -82,7 +87,7 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T // Byte 2: T13 T12 T11 T10 T9 T8 T7 T6 // Byte 4: T5 T4 T3 T2 T1 T0 XX XX // - if ((ReadBuffer.Span[0] & 0xc0) != 0) + if ((ReadBuffer.Span[0] & 0xc0) != 0) { throw new Exception("Status indicates readings are invalid."); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs index ded356fe6b..2ee2a25d19 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs @@ -3,9 +3,9 @@ public partial class Htu31d { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs index df61f72e6c..c0275d6735 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs @@ -24,7 +24,7 @@ public partial class Htu21d : Htux1dBase /// Sensor address (default to 0x40) /// I2CBus (default to 100 KHz) /// Update interval, defaults to 1 sec if null - public Htu21d(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) + public Htu21d(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, updateInterval) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs index c8cd0cdd4c..997abfcc08 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs @@ -19,7 +19,7 @@ public partial class Htu31d : Htux1dBase /// Sensor address (default to 0x40). /// I2CBus (default to 100 KHz). /// Update interval, defaults to 1 sec if null - public Htu31d(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) + public Htu31d(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, updateInterval) { SerialNumber = GetSerial(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs index 01b6f6a939..8743e6bb5b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs @@ -7,9 +7,9 @@ namespace Meadow.Foundation.Sensors.Atmospheric { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x40 @@ -26,7 +26,7 @@ public enum Addresses : byte /// public abstract class Htux1dBase : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Temperature changed event @@ -38,6 +38,11 @@ public abstract class Htux1dBase : /// public event EventHandler> HumidityUpdated = delegate { }; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Default I2C bus speed /// @@ -64,13 +69,13 @@ public abstract class Htux1dBase : /// /// /// - public Htux1dBase(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) + public Htux1dBase(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, (int)(updateInterval == null ? 1000 : updateInterval.Value.TotalMilliseconds)) { } /// - /// Inheritance-safe way to raise events and notify observers. + /// Inheritance-safe way to raise events and notify observers /// /// New temperature and humidity values protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity)> changeResult) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs index 0ee5b7501a..6472489bda 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs @@ -3,9 +3,9 @@ public partial class Mpl3115a2 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs index a7bdf5ba1b..55a04c2183 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs @@ -11,7 +11,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Mpl3115a2 : ByteCommsSensorBase<(Units.Temperature? Temperature, Pressure? Pressure)>, - ITemperatureSensor, IBarometricPressureSensor + ITemperatureSensor, IBarometricPressureSensor, II2cPeripheral { /// /// Event raised when temperature value changes @@ -63,12 +63,17 @@ public bool Standby /// public byte Status => BusComms?.ReadRegister(Registers.Status) ?? 0; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new MPL3115A2 object with the default address and speed settings /// /// Address of the sensor (default = 0x60) /// I2cBus (Maximum is 400 kHz) - public Mpl3115a2(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Mpl3115a2(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { if (BusComms?.ReadRegister(Registers.WhoAmI) != 0xc4) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs index f613f650cb..f8741d1775 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs @@ -3,9 +3,9 @@ public partial class Ms5611 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x5C @@ -43,5 +43,13 @@ public enum Resolution /// OSR_4096 = 4 } + + enum Commands : byte + { + Reset = 0x1e, + ConvertD1 = 0x40, + ConvertD2 = 0x50, + ReadADC = 0x00, + } } } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs index ffc41684c1..454f654389 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs @@ -12,7 +12,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Ms5611 : ByteCommsSensorBase<(Units.Temperature? Temperature, Pressure? Pressure)>, - ITemperatureSensor, IBarometricPressureSensor + ITemperatureSensor, IBarometricPressureSensor, II2cPeripheral { /// /// Temperature changed event @@ -25,17 +25,26 @@ public partial class Ms5611 : public event EventHandler> PressureUpdated = delegate { }; /// - /// The temperature, in degrees celsius (°C), from the last reading + /// The current temperature /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// The pressure, in hectopascals (hPa), from the last reading. 1 hPa - /// is equal to one millibar, or 1/10th of a kilopascal (kPa)/centibar + /// The current pressure /// public Pressure? Pressure => Conditions.Pressure; - private Ms5611Base ms5611; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + + /// + /// I2C Communication bus used to communicate with the peripheral + /// + protected readonly II2cCommunications i2cComms; + + readonly Resolution resolution; /// /// Connect to the Ms5611 using I2C @@ -43,9 +52,10 @@ public partial class Ms5611 : /// The I2C bus connected to the device /// I2c address - default is 0x5c /// - public Ms5611(II2cBus i2cBus, byte address = (byte)Addresses.Default, Resolution resolution = Resolution.OSR_1024) + public Ms5611(II2cBus i2cBus, byte address = (byte)Address.Default, Resolution resolution = Resolution.OSR_1024) { - ms5611 = new Ms5611I2c(i2cBus, address, resolution); + i2cComms = new I2cCommunications(i2cBus, address); + this.resolution = resolution; } /// @@ -84,31 +94,37 @@ protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? T /// public void Reset() { - ms5611.Reset(); + var cmd = (byte)Commands.Reset; + + i2cComms.Write(cmd); } private void BeginTempConversion() { - ms5611.BeginTempConversion(); + var cmd = (byte)((byte)Commands.ConvertD2 + 2 * (byte)resolution); + i2cComms.Write(cmd); } private void BeginPressureConversion() { - ms5611.BeginPressureConversion(); + var cmd = (byte)((byte)Commands.ConvertD1 + 2 * (byte)resolution); + i2cComms.Write(cmd); } private byte[] ReadData() { - return ms5611.ReadData(); + var data = new byte[3]; + i2cComms.ReadRegister((byte)Commands.ReadADC, data); + return data; } int ReadTemperature() { - ms5611.BeginTempConversion(); + BeginTempConversion(); Thread.Sleep(10); // 1 + 2 * Resolution // we get back 24 bits (3 bytes), regardless of the resolution we're asking for - var data = ms5611.ReadData(); + var data = ReadData(); var result = data[2] | data[1] << 8 | data[0] << 16; @@ -117,12 +133,12 @@ int ReadTemperature() int ReadPressure() { - ms5611.BeginPressureConversion(); + BeginPressureConversion(); Thread.Sleep(10); // 1 + 2 * Resolution // we get back 24 bits (3 bytes), regardless of the resolution we're asking for - var data = ms5611.ReadData(); + var data = ReadData(); var result = data[2] | data[1] << 8 | data[0] << 16; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Base.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Base.cs deleted file mode 100644 index 09242ad794..0000000000 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Base.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Meadow.Foundation.Sensors.Atmospheric -{ - internal abstract class Ms5611Base - { - protected Ms5611.Resolution Resolution { get; set; } - - public abstract void Reset(); - public abstract void BeginTempConversion(); - public abstract void BeginPressureConversion(); - public abstract byte[] ReadData(); - - protected enum Commands : byte - { - Reset = 0x1e, - ConvertD1 = 0x40, - ConvertD2 = 0x50, - ReadADC = 0x00, - } - - internal Ms5611Base(Ms5611.Resolution resolution) - { - Resolution = resolution; - } - } -} diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611I2c.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611I2c.cs deleted file mode 100644 index 19324e836b..0000000000 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611I2c.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Meadow.Hardware; - -namespace Meadow.Foundation.Sensors.Atmospheric -{ - internal class Ms5611I2c : Ms5611Base - { - /// - /// I2C Communication bus used to communicate with the peripheral - /// - protected readonly II2cCommunications i2cComms; - - internal Ms5611I2c(II2cBus i2cBus, byte address, Ms5611.Resolution resolution) - : base(resolution) - { - i2cComms = new I2cCommunications(i2cBus, address); - } - - public override void Reset() - { - var cmd = (byte)Commands.Reset; - - i2cComms.Write(cmd); - } - - public override void BeginTempConversion() - { - var cmd = (byte)((byte)Commands.ConvertD2 + 2 * (byte)Resolution); - i2cComms.Write(cmd); - } - - public override void BeginPressureConversion() - { - var cmd = (byte)((byte)Commands.ConvertD1 + 2 * (byte)Resolution); - i2cComms.Write(cmd); - } - - public override byte[] ReadData() - { - var data = new byte[3]; - i2cComms.ReadRegister((byte)Commands.ReadADC, data); - return data; - } - } -} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Spi.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Spi.cs deleted file mode 100644 index f289527ec2..0000000000 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611Spi.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Meadow.Hardware; -using System; - -/* -namespace Meadow.Foundation.Sensors.Atmospheric -{ - internal class Ms5611Spi : Ms5611Base - { - private ISpiBus spiBus; - private IPin chipSelect; - - internal Ms5611Spi(ISpiBus spi, IPin chipSelect, Ms5611.Resolution resolution) - : base(resolution) - { - spiBus = spi; - this.chipSelect = chipSelect; - - throw new NotImplementedException(); - } - - public override void BeginPressureConversion() - { - throw new NotImplementedException(); - } - - public override void BeginTempConversion() - { - throw new NotImplementedException(); - } - - public override byte[] ReadData() - { - throw new NotImplementedException(); - } - - public override void Reset() - { - throw new NotImplementedException(); - } - } -} -*/ diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs index 7cfd7dfbb9..2ba15fd25b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs @@ -5,7 +5,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric public partial class Sgp40 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs index 7888f97eeb..bee0b84c53 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs @@ -9,23 +9,28 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// /// Provides access to the Sensiron SGP40 VOC sensor /// - public partial class Sgp40 : ByteCommsSensorBase + public partial class Sgp40 : ByteCommsSensorBase, II2cPeripheral { /// /// public event EventHandler> VocIndexUpdated = delegate { }; /// - /// The VOC Index, from the last reading. + /// The VOC Index, from the last reading /// public int VocIndex => Conditions; /// - /// Serial number of the device. + /// Serial number of the device /// public ulong SerialNumber { get; private set; } - private byte[]? _compensationData = null; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + + private byte[]? compensationData = null; /// /// Creates a new SGP40 VOC sensor. @@ -43,12 +48,9 @@ public Sgp40(II2cBus i2cBus, byte address = (byte)Address.Default) /// protected void Initialize() { - // write buffer for initialization commands only can be two bytes. - Span tx = WriteBuffer.Span[0..2]; - BusComms?.Write(sgp4x_get_serial_number); - Thread.Sleep(1); // per the data sheet + Thread.Sleep(1); BusComms?.Read(ReadBuffer.Span[0..9]); @@ -78,9 +80,9 @@ public bool RunSelfTest() /// The latest sensor reading protected override Task ReadSensor() { - if (_compensationData != null) + if (compensationData != null) { - BusComms?.Write(_compensationData); + BusComms?.Write(compensationData); } else { @@ -122,19 +124,19 @@ public void TurnHeaterOff() /// Temperature compensation public void SetCompensationData(RelativeHumidity humidity, Units.Temperature temperature) { - _compensationData = new byte[8]; + compensationData = new byte[8]; - Array.Copy(sgp40_measure_raw_signal, 0, _compensationData, 0, 2); + Array.Copy(sgp40_measure_raw_signal, 0, compensationData, 0, 2); var rh = BitConverter.GetBytes(System.Net.IPAddress.HostToNetworkOrder((ushort)(humidity.Percent * 65535 / 100))); - _compensationData[2] = rh[0]; - _compensationData[3] = rh[1]; - _compensationData[4] = Crc(rh); + compensationData[2] = rh[0]; + compensationData[3] = rh[1]; + compensationData[4] = Crc(rh); var t = BitConverter.GetBytes(System.Net.IPAddress.HostToNetworkOrder((ushort)(temperature.Celsius * 65535 / 175))); - _compensationData[5] = t[0]; - _compensationData[6] = t[1]; - _compensationData[7] = Crc(t); + compensationData[5] = t[0]; + compensationData[6] = t[1]; + compensationData[7] = Crc(t); } /// @@ -142,7 +144,7 @@ public void SetCompensationData(RelativeHumidity humidity, Units.Temperature tem /// public void ClearCompensationData() { - _compensationData = null; + compensationData = null; } private byte Crc(byte[] data) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs index 3a0967e913..0387718a94 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs @@ -3,9 +3,9 @@ public partial class Sht31d { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs index d334ef05b6..ce8b4aa2c0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs @@ -1,21 +1,17 @@ -using System; -using System.Threading.Tasks; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Peripherals.Sensors; using Meadow.Units; +using System; +using System.Threading.Tasks; namespace Meadow.Foundation.Sensors.Atmospheric { /// - /// Provide a mechanism for reading the temperature and humidity from - /// a SHT31D temperature / humidity sensor. + /// Represents a SHT31 Dtemperature and humidity sensor /// - /// - /// Readings from the sensor are made in Single-shot mode. - /// public partial class Sht31d : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Temperature changed event @@ -28,21 +24,26 @@ public partial class Sht31d : public event EventHandler> HumidityUpdated = delegate { }; /// - /// The temperature, in degrees celsius (°C), from the last reading. + /// The temperature from the last reading /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// The humidity, in percent relative humidity, from the last reading.. + /// The humidity, in percent relative humidity, from the last reading /// public RelativeHumidity? Humidity => Conditions.Humidity; /// - /// Create a new SHT31D object. + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + + /// + /// Create a new SHT31D object /// - /// Sensor address (should be 0x44 or 0x45). + /// Sensor address (should be 0x44 or 0x45) /// I2cBus (0-1000 KHz). - public Sht31d(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Sht31d(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 6, writeBufferSize: 2) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs index d4fc18e4ab..a6fc00ae97 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs @@ -3,9 +3,9 @@ public partial class Sht4x { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs index 765e9feae3..8ce85f97af 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs @@ -8,15 +8,11 @@ namespace Meadow.Foundation.Sensors.Atmospheric { /// - /// Provide a mechanism for reading the temperature and humidity from - /// a SHT4x temperature / humidity sensor (SHT40, SHT41, SHT45, etc.) + /// Represent a SHT4x temperature and humidity sensor (SHT40, SHT41, SHT45, etc.) /// - /// - /// Readings from the sensor are made in Single-shot mode. - /// public partial class Sht4x : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Precision of sensor reading @@ -34,24 +30,28 @@ public partial class Sht4x : public event EventHandler> HumidityUpdated = delegate { }; /// - /// The curren temperature -from the last reading. + /// The current temperature /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// The humidity, in percent relative humidity, from the last reading + /// The current humidity /// public RelativeHumidity? Humidity => Conditions.Humidity; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new SHT4x object /// - /// Sensor address (0x44 or 0x45) + /// Sensor address /// I2cBus - public Sht4x(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Sht4x(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 6, writeBufferSize: 2) - { - } + { } /// /// Raise events for subscribers diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs index a482d5a057..1d513a3a11 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs @@ -3,7 +3,7 @@ public partial class Si70xx { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// public enum Address : byte { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs index a683f99c7a..bd40088925 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs @@ -11,11 +11,11 @@ namespace Meadow.Foundation.Sensors.Atmospheric { /// /// Provide access to the Si70xx series (Si7020, Si7021, and Si7030) - /// temperature and humidity sensors. + /// temperature and humidity sensors /// public partial class Si70xx : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Raised when the temperature value changes @@ -28,12 +28,7 @@ public partial class Si70xx : public event EventHandler> HumidityUpdated = delegate { }; /// - /// Default SPI bus speed - /// - public static Frequency DEFAULT_SPEED = new Frequency(400, Frequency.UnitType.Kilohertz); - - /// - /// The temperature, from the last reading + /// The temperature from the last reading /// public Units.Temperature? Temperature => Conditions.Temperature; @@ -57,6 +52,11 @@ public partial class Si70xx : /// public byte FirmwareRevision { get; private set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new SI7021 temperature and humidity sensor /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs index 4bff8370ec..808cdd67bf 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs @@ -3,9 +3,9 @@ public partial class Th02 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs index 3ed3a5855b..b5c8964c4f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs @@ -13,7 +13,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// public partial class Th02 : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor + ITemperatureSensor, IHumiditySensor, II2cPeripheral { /// /// Event raised when the temperature changes @@ -26,23 +26,27 @@ public partial class Th02 : public event EventHandler> HumidityUpdated = delegate { }; /// - /// Last value read from the Temperature sensor. + /// The current temperatute /// public Units.Temperature? Temperature => Conditions.Temperature; /// - /// Last value read from the Pressure sensor. + /// The current humidity /// public RelativeHumidity? Humidity => Conditions.Humidity; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Provide a mechanism for reading the temperature and humidity from /// a Th02 temperature / humidity sensor /// - public Th02(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Th02(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) - { - } + { } /// /// Raise all change events for subscribers diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs index 4b8b202e1a..7ba82f90ac 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs @@ -3,9 +3,9 @@ public partial class Mlx90640 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x33 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs index 12972797ce..d915d7729f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs @@ -8,7 +8,7 @@ namespace Meadow.Foundation.Sensors.Camera /// Represents the MLX90640 32x24 IR array /// The MLX90640 is a fully calibrated 32x24 pixels thermal IR array /// - public partial class Mlx90640 + public partial class Mlx90640 : II2cPeripheral { /// /// Camera serial number as a string @@ -41,7 +41,7 @@ public float Emissivity /// /// Reflected temperature /// - public Meadow.Units.Temperature ReflectedTemperature { get; set; } + public Units.Temperature ReflectedTemperature { get; set; } /// /// Camera configuration @@ -53,6 +53,11 @@ public float Emissivity const byte OpenAirTaShift = 8; const short DeviceId1Register = 0x2407; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -67,7 +72,7 @@ public float Emissivity /// I2C address /// Emissivity public Mlx90640(II2cBus i2cBus, - byte address = (byte)Addresses.Default, + byte address = (byte)Address.Default, float emissivity = 0.95f) { i2cComms = new I2cCommunications(i2cBus, address); @@ -78,7 +83,7 @@ public Mlx90640(II2cBus i2cBus, } /// - /// Initialize the MLX90640. Read the MLX90640 serial number and EEProm + /// Initialize the MLX90640 and read the MLX90640 serial number and EEProm /// void Initialize() { @@ -166,12 +171,11 @@ public void SetMode(Mode mode) bool GetFrameData(ref ushort[] frameData) { - ushort dataReady = 1; ushort[] controlRegister1 = new ushort[1]; ushort[] statusRegister = new ushort[1]; byte cnt = 0; - dataReady = 0; + ushort dataReady = 0; while (dataReady == 0) { I2CRead(0x8000, 1, ref statusRegister); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs index a310b68055..11b70f3160 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs @@ -1,19 +1,24 @@ -using System.Threading; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Units; +using System.Threading; namespace Meadow.Foundation.Sensors.Distance { - public partial class MaxBotix + public partial class MaxBotix : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Creates a new MaxBotix object communicating over I2C /// /// The I2C bus /// The distance sensor type /// The I2C address - public MaxBotix(II2cBus i2cBus, SensorType sensor, byte address = (byte)Addresses.Default) - :base(i2cBus, address) + public MaxBotix(II2cBus i2cBus, SensorType sensor, byte address = (byte)Address.Default) + : base(i2cBus, address) { sensorType = sensor; communication = CommunicationType.I2C; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs index 8b31aa0a42..c207c68e9e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs @@ -3,9 +3,9 @@ public partial class MaxBotix { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x70 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs index bc308765ce..eee6940213 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs @@ -6,9 +6,9 @@ public partial class Vl53l0x { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x29 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs index c0302086ea..1c78354e37 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Sensors.Distance /// /// Represents the Vl53l0x distance sensor /// - public partial class Vl53l0x : ByteCommsSensorBase, IRangeFinder + public partial class Vl53l0x : ByteCommsSensorBase, IRangeFinder, II2cPeripheral { /// /// Distance updated event @@ -36,20 +36,25 @@ public bool IsShutdown } /// - /// The distance to the measured object. + /// The distance to the measured object /// public Length? Distance { get; protected set; } = new Length(0); /// - /// Minimum valid distance in mm. + /// Minimum valid distance /// public Length MinimumDistance => new Length(30, Length.UnitType.Millimeters); /// - /// Maximum valid distance in mm (CurrentDistance returns -1 if above). + /// Maximum valid distance (CurrentDistance returns -1 if above) /// public Length MaximumDistance => new Length(2000, Length.UnitType.Millimeters); + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + readonly IDigitalOutputPort shutdownPort; byte stopVariable; @@ -59,10 +64,9 @@ public bool IsShutdown /// /// I2C bus /// I2C address - public Vl53l0x(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Vl53l0x(II2cBus i2cBus, byte address = (byte)Address.Default) : this(i2cBus, null, address) - { - } + { } /// /// Creates a new Vl53l0x object @@ -71,7 +75,7 @@ public Vl53l0x(II2cBus i2cBus, byte address = (byte)Addresses.Default) /// Shutdown pin /// VL53L0X address - public Vl53l0x(II2cBus i2cBus, IPin shutdownPin, byte address = (byte)Addresses.Default) + public Vl53l0x(II2cBus i2cBus, IPin shutdownPin, byte address = (byte)Address.Default) : base(i2cBus, address) { if (shutdownPin != null) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Samples/Vl53l0x_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Samples/Vl53l0x_Sample/MeadowApp.cs index 65d6be25ea..7bbbed3b6c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Samples/Vl53l0x_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Samples/Vl53l0x_Sample/MeadowApp.cs @@ -1,10 +1,10 @@ -using System; -using System.Threading.Tasks; -using Meadow; +using Meadow; using Meadow.Devices; using Meadow.Foundation.Sensors.Distance; using Meadow.Hardware; using Meadow.Units; +using System; +using System.Threading.Tasks; using LU = Meadow.Units.Length.UnitType; namespace Sensors.Distance.Vl53l0x_Sample @@ -20,7 +20,7 @@ public override Task Initialize() Resolver.Log.Info("Initializing hardware..."); var i2cBus = Device.CreateI2cBus(I2cBusSpeed.FastPlus); - sensor = new Vl53l0x(i2cBus, (byte)Vl53l0x.Addresses.Default); + sensor = new Vl53l0x(i2cBus); sensor.DistanceUpdated += Sensor_Updated; @@ -39,10 +39,10 @@ private void Sensor_Updated(object sender, IChangeResult result) if (result.New == null) { return; } if (result.New < new Length(0, LU.Millimeters)) - { + { Resolver.Log.Info("out of range."); } - else + else { Resolver.Log.Info($"{result.New.Millimeters}mm / {result.New.Inches:n3}\""); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs index 62da821d61..6067121ae9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs @@ -8,9 +8,9 @@ public partial class Ags01Db { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x11 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs index b99eefe696..1fe1b4d514 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Sensors.Environmental /// Pinout (left to right, label side down): VDD, SDA, GND, SCL /// Note: requires pullup resistors on SDA/SCL /// - public partial class Ags01Db : ByteCommsSensorBase + public partial class Ags01Db : ByteCommsSensorBase, II2cPeripheral { const byte CRC_POLYNOMIAL = 0x31; const byte CRC_INIT = 0xFF; @@ -30,19 +30,23 @@ public partial class Ags01Db : ByteCommsSensorBase /// public Concentration? Concentration { get; private set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Ags01Db object /// /// The I2C bus /// The I2C address - public Ags01Db(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Ags01Db(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 3, writeBufferSize: 3) { } /// - /// Get ASG01DB VOC Gas Concentration and - /// Update the Concentration property. + /// Get ASG01DB VOC Gas Concentration and update the Concentration property /// protected override Task ReadSensor() { @@ -74,7 +78,7 @@ public byte GetVersion() BusComms.Exchange(WriteBuffer.Span[0..1], ReadBuffer.Span[0..1]); // CRC check - if (!CheckCrc8(ReadBuffer.Slice(0, 1).ToArray(), 1, ReadBuffer.Span[1])) + if (!CheckCrc8(ReadBuffer[..1].ToArray(), 1, ReadBuffer.Span[1])) { return unchecked((byte)-1); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs index 11d7bded6f..99822f117f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs @@ -5,7 +5,7 @@ partial class Ens160 /// /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs index 7f399bb2c2..9b36965b36 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs @@ -15,7 +15,7 @@ public partial class Ens160 : ByteCommsSensorBase<(Concentration? CO2Concentration, Concentration? EthanolConcentration, Concentration? TVOCConcentration)>, - IConcentrationSensor + IConcentrationSensor, II2cPeripheral { /// /// Raised when the CO2 concentration changes @@ -66,6 +66,11 @@ public OperatingMode CurrentOperatingMode set => BusComms.WriteRegister((byte)Registers.OPMODE, (byte)value); } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new ENS160 object /// @@ -75,7 +80,7 @@ public OperatingMode CurrentOperatingMode /// /// The I2C bus /// The I2C address - public Ens160(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Ens160(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 9, writeBufferSize: 9) { Initialize().Wait(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs index 3f34254395..08dfb88d22 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs @@ -1,8 +1,8 @@ -using System; -using System.Threading.Tasks; -using Meadow; +using Meadow; using Meadow.Devices; using Meadow.Foundation.Sensors.Environmental; +using System; +using System.Threading.Tasks; namespace Sensors.Environmental.Ens160_Sample { @@ -17,10 +17,10 @@ public override Task Initialize() Resolver.Log.Info("Initializing..."); var i2cBus = Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.Standard); - - sensor = new Ens160(i2cBus, (byte)Ens160.Addresses.Address_0x53); - + sensor = new Ens160(i2cBus, (byte)Ens160.Address.Address_0x53); + + var consumer = Ens160.CreateObserver( handler: result => { @@ -46,7 +46,7 @@ public override Task Initialize() Resolver.Log.Info($" CO2 Concentration: {result.New.CO2Concentration?.PartsPerMillion:N0}ppm"); Resolver.Log.Info($" Ethanol Concentraion: {result.New.EthanolConcentration?.PartsPerBillion:N0}ppb"); Resolver.Log.Info($" TVOC Concentraion: {result.New.TVOCConcentration?.PartsPerBillion:N0}ppb"); - Resolver.Log.Info($" AQI: {sensor.GetAirQualityIndex()}"); + Resolver.Log.Info($" AQI: {sensor.GetAirQualityIndex()}"); }; } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.NextPm/Driver/Sensors.Environmental.NextPm.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.NextPm/Driver/Sensors.Environmental.NextPm.csproj index e32fc42a08..adb8b0141f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.NextPm/Driver/Sensors.Environmental.NextPm.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.NextPm/Driver/Sensors.Environmental.NextPm.csproj @@ -14,7 +14,7 @@ 0.1.0 enable true - TERA Sensor NextPM particulate matter sensor + TERA Sensor NextPM serial particulate matter sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs index 82cb2a69cb..2e390fc91a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs @@ -5,7 +5,7 @@ public partial class Pmsa003i /// /// Valid I2C addresses for the sensor /// - internal enum Addresses : byte + internal enum Address : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs index 4b42cf848c..393a368da4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs @@ -22,7 +22,8 @@ public partial class Pmsa003i : ParticleDensity? ParticleDensity_10microns, ParticleDensity? ParticleDensity_25microns, ParticleDensity? ParticleDensity_50microns, - ParticleDensity? ParticleDensity_100microns)> + ParticleDensity? ParticleDensity_100microns)>, + II2cPeripheral { /// /// Raised when the Standard particulate matter PM1.0 density changes @@ -139,13 +140,18 @@ public partial class Pmsa003i : /// public ParticleDensity? CountOf100micronParticles => Conditions.ParticleDensity_100microns; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new PMSA003I sensor object /// /// /// The I2C bus public Pmsa003i(II2cBus i2cBus) - : base(i2cBus, (byte)Addresses.Address_0x12) + : base(i2cBus, (byte)Address.Default) { } /// @@ -199,7 +205,6 @@ public override void StopUpdating() throw new Exception("Message is corrupt or has invalid length"); } - var checksum = BitConverter.ToUInt16(buffer[2..4]); // this is in big-endian format, so we need to reverse things... var pm10Standard = new Density(BitConverter.ToUInt16(span[26..28]), Density.UnitType.MicroGramsPerMetersCubed); var pm25Standard = new Density(BitConverter.ToUInt16(span[24..26]), Density.UnitType.MicroGramsPerMetersCubed); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs index 85034d05b5..51033c761e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs @@ -5,7 +5,7 @@ partial class Scd4xBase /// /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x62 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs index fdc95ea3e7..68dfb6b720 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs @@ -15,7 +15,7 @@ public abstract partial class Scd4xBase : ByteCommsSensorBase<(Concentration? Concentration, Units.Temperature? Temperature, RelativeHumidity? Humidity)>, - ITemperatureSensor, IHumiditySensor, IConcentrationSensor + ITemperatureSensor, IHumiditySensor, IConcentrationSensor, II2cPeripheral { /// /// Raised when the concentration changes @@ -47,6 +47,11 @@ public abstract partial class Scd4xBase /// public RelativeHumidity? Humidity => Conditions.Humidity; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Scd4xBase object /// @@ -56,7 +61,7 @@ public abstract partial class Scd4xBase /// /// The I2C bus /// The I2C address - public Scd4xBase(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Scd4xBase(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 9, writeBufferSize: 9) { StopPeriodicUpdates().Wait(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.Mt3339/Driver/Sensors.Gnss.Mt3339.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.Mt3339/Driver/Sensors.Gnss.Mt3339.csproj index 1d4ce0cf3f..71e76c0cfb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.Mt3339/Driver/Sensors.Gnss.Mt3339.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.Mt3339/Driver/Sensors.Gnss.Mt3339.csproj @@ -16,11 +16,8 @@ MediaTek MT3339 serial GNSS / GPS controller enable - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs index fa30c6be10..25bf8324cb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs @@ -3,9 +3,9 @@ public partial class NeoM8 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x42 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs index 8ffcf62d87..dce53885d5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs @@ -6,8 +6,13 @@ namespace Meadow.Foundation.Sensors.Gnss { - public partial class NeoM8 + public partial class NeoM8 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -20,7 +25,7 @@ public partial class NeoM8 /// /// Create a new NeoM8 object using I2C /// - public NeoM8(II2cBus i2cBus, byte address = (byte)Addresses.Default, IPin resetPin = null, IPin ppsPin = null) + public NeoM8(II2cBus i2cBus, byte address = (byte)Address.Default, IPin resetPin = null, IPin ppsPin = null) { if (resetPin != null) { @@ -38,7 +43,7 @@ public NeoM8(II2cBus i2cBus, byte address = (byte)Addresses.Default, IPin resetP /// /// Create a new NeoM8 object using I2C /// - public NeoM8(II2cBus i2cBus, byte address = (byte)Addresses.Default, IDigitalOutputPort resetPort = null, IDigitalInputPort ppsPort = null) + public NeoM8(II2cBus i2cBus, byte address = (byte)Address.Default, IDigitalOutputPort resetPort = null, IDigitalInputPort ppsPort = null) { ResetPort = resetPort; PulsePerSecondPort = ppsPort; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Spi.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Spi.cs index 2b7c503b05..be59cb134d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Spi.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Spi.cs @@ -6,7 +6,7 @@ namespace Meadow.Foundation.Sensors.Gnss { - public partial class NeoM8 : ISpiDevice + public partial class NeoM8 : ISpiPeripheral { /// /// The default SPI bus speed for the device diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs index a6e76f9534..e421605f99 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs @@ -3,9 +3,9 @@ public partial class As5013 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs index 2c848807bd..3e8a2b5263 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs @@ -69,7 +69,7 @@ public DigitalJoystickPosition? DigitalPosition /// the I2C bus /// the device I2C address /// port connected to the interrupt pin - public As5013(II2cBus i2cBus, byte address = (byte)Addresses.Default, IDigitalInterruptPort interruptPort = null) + public As5013(II2cBus i2cBus, byte address = (byte)Address.Default, IDigitalInterruptPort interruptPort = null) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs index d530562192..6b776ded44 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs @@ -26,9 +26,9 @@ public enum KeyState } /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x1F diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs index 40e32ad86b..90fb4bba2b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs @@ -49,7 +49,7 @@ public byte BackLight2 /// The I2C bus /// The interrupt pin /// The I2C address - public BBQ10Keyboard(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Addresses.Default) + public BBQ10Keyboard(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs index 0bc43bdc3c..57a64c8302 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs @@ -59,7 +59,7 @@ public int RefreshPeriod /// /// Create a new MPR121 keypad object. /// - public Mpr121(II2cBus i2cBus, byte address = (byte)Addresses.Default, int refreshPeriod = -1, Mpr121Configuration configuration = null) + public Mpr121(II2cBus i2cBus, byte address = (byte)Address.Default, int refreshPeriod = -1, Mpr121Configuration configuration = null) { this.refreshPeriod = refreshPeriod; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs index bde1a53b5a..1dbdc36379 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs @@ -4,9 +4,9 @@ namespace Meadow.Foundation.Sensors.Hid public partial class Mpr121 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x5A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs index a39c63e9dd..6933e33677 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs @@ -3,9 +3,9 @@ public partial class Tsc2004 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x4B diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs index 62c27393e2..aed69b4bd5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs @@ -55,7 +55,7 @@ public partial class Tsc2004 /// /// The I2C bus /// The I2C address - public Tsc2004(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Tsc2004(II2cBus i2cBus, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs index b00f9d9538..8bc9fae6f1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs @@ -36,7 +36,7 @@ public class NesClassicController : WiiClassicControllerBase /// Creates a NES Classic Mini Controller object /// /// the I2C bus connected to controller - public NesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) + public NesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs index d2839a4e98..ba7fa434e8 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs @@ -53,7 +53,7 @@ public class SnesClassicController : WiiClassicControllerBase /// Creates a SNES Classic Mini Controller object /// /// the I2C bus connected to controller - public SnesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) + public SnesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs index 3863f6b89d..6b9818ede2 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs @@ -85,7 +85,7 @@ public class WiiClassicController : WiiClassicControllerBase /// /// the I2C bus connected to controller /// Enable high resolution mode analog sticks and triggers (8 bits of precision) - public WiiClassicController(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Addresses.Default) + public WiiClassicController(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Address.Default) { this.useHighResolutionMode = useHighResolutionMode; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs index f013b4d680..685cca31b0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs @@ -76,7 +76,7 @@ public class WiiClassicControllerPro : WiiClassicControllerBase /// /// the I2C bus connected to controller /// Enable high resolution mode analog sticks and triggers (8 bits of precision) - public WiiClassicControllerPro(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Addresses.Default) + public WiiClassicControllerPro(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Address.Default) { this.useHighResolutionMode = useHighResolutionMode; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs index a95c44779a..d9d70a8884 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs @@ -45,7 +45,7 @@ public class WiiNunchuck : WiiExtensionControllerBase /// Creates a Wii Nunchuck object /// /// the I2C bus connected to controller - public WiiNunchuck(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) + public WiiNunchuck(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs index b099a6feb2..a6b72382d5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs @@ -3,9 +3,9 @@ public abstract partial class WiiExtensionControllerBase { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs index f9031af29d..92f3e14992 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs @@ -3,9 +3,9 @@ public partial class Bh1745 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Address of the peripheral when the address pin is pulled low. diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs index 75d7b9c815..065b5e56b7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs @@ -238,7 +238,7 @@ public ushort UpperInterruptThreshold /// /// Create a new BH17545 color sensor object /// - public Bh1745(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Bh1745(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { CompensationMultipliers = new ChannelMultipliers diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs index 78d55511fc..05eb2e6e28 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs @@ -3,9 +3,9 @@ public partial class Bh1750 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Address of the peripheral when the address pin is pulled low diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs index 0bb2d50b80..f32a772db4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs @@ -46,7 +46,7 @@ public double LightTransmittance /// Create a new BH1750 light sensor object using a static reference voltage. /// public Bh1750( - II2cBus i2cBus, byte address = (byte)Addresses.Default, + II2cBus i2cBus, byte address = (byte)Address.Default, MeasuringModes measuringMode = MeasuringModes.ContinuouslyHighResolutionMode, double lightTransmittance = 1) : base(i2cBus, address) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs index 25cc2579c8..e20c1a31ed 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs @@ -3,9 +3,9 @@ public partial class Max44009 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x4A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs index c8593ff863..2cfaa0a234 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs @@ -15,7 +15,7 @@ public partial class Max44009 : ByteCommsSensorBase /// /// The I2C bus /// The I2C address - public Max44009(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Max44009(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs index 88727407c3..0550c0fda1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs @@ -3,9 +3,9 @@ public partial class Si1145 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs index 302e52351c..d9daba43e7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs @@ -21,7 +21,7 @@ public partial class Si1145 /// Create a new SI1145 sensor object /// /// I2cBus (default to 400 KHz) - public Si1145(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) + public Si1145(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) { if (BusComms.ReadRegister(Registers.REG_PARTID) != 0x45) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs index 84a32bb9cb..71f4cdd257 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs @@ -14,9 +14,9 @@ namespace Meadow.Foundation.Sensors.Light public partial class Tsl2591 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x29 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs index db2875d788..eda0ecea7f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs @@ -107,7 +107,7 @@ public IntegrationTimes IntegrationTime /// The I2C bus /// The I2C address public Tsl2591(II2cBus i2cBus, - byte address = (byte)Addresses.Default) + byte address = (byte)Address.Default) : base(i2cBus, address) { Gain = GainFactor.Medium; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs index 2f5ecafe4d..51087ac99a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs @@ -3,9 +3,9 @@ public partial class Veml7700 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x10 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs index 9b07ebcd87..f1373e8b79 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs @@ -46,7 +46,7 @@ public partial class Veml7700 : ByteCommsSensorBase, ILightSensor, /// /// The I2C bus public Veml7700(II2cBus i2cBus) - : base(i2cBus, (byte)Addresses.Default) + : base(i2cBus, (byte)Address.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs index 051b105d2e..7195733dec 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs @@ -4,9 +4,9 @@ namespace Meadow.Foundation.Sensors.LoadCell public partial class Nau7802 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x2A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs index b6cb0d4b86..bcc24df5b7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs @@ -37,20 +37,20 @@ public partial class Nau7802 : ByteCommsSensorBase, IMassSensor, IDisposab /// /// The I2C bus public Nau7802(II2cBus i2cBus) - : base(i2cBus, (byte)Addresses.Default) + : base(i2cBus, (byte)Address.Default) { - Initialize((byte)Addresses.Default); + Initialize((byte)Address.Default); } private void Initialize(byte address) { switch (address) { - case (byte)Addresses.Default: + case (byte)Address.Default: // valid; break; default: - throw new ArgumentOutOfRangeException($"NAU7802 device supports only address {(byte)Addresses.Default}"); + throw new ArgumentOutOfRangeException($"NAU7802 device supports only address {(byte)Address.Default}"); } PowerOn(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs index 3d8846ef18..1a8289f627 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs @@ -72,7 +72,7 @@ public sbyte OffsetZ /// /// Address of the I2C sensor /// I2C bus - public Adxl345(II2cBus i2cBus, Addresses address = Addresses.Default) + public Adxl345(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs index aed970095c..c1fd8e6bdc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs @@ -3,9 +3,9 @@ public partial class Adxl345 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x53 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs index a82cb37521..3f3a9d3a3e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs @@ -24,7 +24,7 @@ namespace Meadow.Foundation.Sensors.Motion /// public partial class Adxl362 : ByteCommsSensorBase<(Acceleration3D? Acceleration3D, Units.Temperature? Temperature)>, - IAccelerometer, ITemperatureSensor, ISpiDevice + IAccelerometer, ITemperatureSensor, ISpiPeripheral { /// /// Raised when the acceleration value changes diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs index 1321b7f2ed..aa6b9f7f2b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs @@ -3,9 +3,9 @@ public partial class Apds9960 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x39 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs index 64b0aefb2e..90d6860407 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs @@ -58,7 +58,7 @@ public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? /// SI2C bus object /// The interrupt pin public Apds9960(II2cBus i2cBus, IPin interruptPin) - : base(i2cBus, (byte)Addresses.Default) + : base(i2cBus, (byte)Address.Default) { if (interruptPin != null) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs index f839858181..fa291db04a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs @@ -5,7 +5,7 @@ public partial class Bmi270 /// /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs index 92d88fa34d..ae02d20e1b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs @@ -63,7 +63,7 @@ public partial class Bmi270 : /// /// The I2C bus connected to the sensor /// The I2C address - public Bmi270(II2cBus i2cBus, byte address = (byte)Addresses.Address_0x68) + public Bmi270(II2cBus i2cBus, byte address = (byte)Address.Address_0x68) { //Read buffer: 16 (needs at least 13) //Write buffer: 256 bytes for the config data + 1 for the address diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs index 645569aa8b..6d948bbedc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs @@ -3,9 +3,9 @@ public partial class Bno055 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x28 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs index bcb9f3ddb1..ae1de12c0e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs @@ -252,7 +252,7 @@ private byte Page /// /// Address of the BNO055 (default = 0x28). /// I2C bus (default = 400 KHz). - public Bno055(II2cBus i2cBus, Addresses address = Addresses.Default) + public Bno055(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs index f17556a4bf..dd1f53e054 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs @@ -3,9 +3,9 @@ public partial class Hmc5883 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x1E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs index 6d433e63f7..d575f8f4a0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs @@ -49,7 +49,7 @@ public partial class Hmc5883 : ByteCommsSensorBase /// Output rate /// Sample amount /// Measurement configuration - public Hmc5883(II2cBus i2cBus, byte address = (byte)Addresses.Default, + public Hmc5883(II2cBus i2cBus, byte address = (byte)Address.Default, GainLevels gain = GainLevels.Gain1090, MeasuringModes measuringMode = MeasuringModes.Continuous, DataOutputRates outputRate = DataOutputRates.Rate15, diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs index 38414c3217..8cf29aa7e8 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs @@ -20,7 +20,7 @@ public class Qmc5883 : Hmc5883 /// Output rate /// Samples amount /// Measurement configuration - public Qmc5883(II2cBus i2cBus, byte address = (byte)Addresses.Qmc5883, + public Qmc5883(II2cBus i2cBus, byte address = (byte)Address.Qmc5883, GainLevels gain = GainLevels.Gain1090, MeasuringModes measuringMode = MeasuringModes.Continuous, DataOutputRates outputRate = DataOutputRates.Rate15, diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs index 79559de8f6..f19333b8af 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs @@ -5,7 +5,7 @@ public partial class Lis2Mdl /// /// Valid I2C addresses for the sensor /// - enum Addresses : byte + enum Address : byte { /// /// Bus address 0x1E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs index 953d0a6ceb..33cde6d812 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs @@ -32,7 +32,7 @@ public partial class Lis2Mdl : PollingSensorBase, IMagnetometer /// /// The I2C bus connected to the sensor /// The I2C address - public Lis2Mdl(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Lis2Mdl(II2cBus i2cBus, byte address = (byte)Address.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs index 52b0999109..566bcc003b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs @@ -5,7 +5,7 @@ public partial class Lsm303agr /// /// Valid I2C addresses for the sensor /// - enum Addresses : byte + enum Address : byte { /// /// Bus address 0x19 for the accelerometer diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs index e730d93504..144214ee1a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs @@ -49,8 +49,8 @@ public partial class Lsm303agr : /// The I2C bus connected to the sensor public Lsm303agr(II2cBus i2cBus) { - i2cCommsAccel = new I2cCommunications(i2cBus, (byte)Addresses.AddressAccel_0x19); - i2cCommsMag = new I2cCommunications(i2cBus, (byte)Addresses.AddressMag_0x1E); + i2cCommsAccel = new I2cCommunications(i2cBus, (byte)Address.AddressAccel_0x19); + i2cCommsMag = new I2cCommunications(i2cBus, (byte)Address.AddressMag_0x1E); Initialize(); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs index f5f4c42247..a75d32aee9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs @@ -3,9 +3,9 @@ public partial class Mag3110 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x0E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs index ad22481f6d..365cf838e9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs @@ -114,7 +114,7 @@ public bool DigitalInputsEnabled /// Interrupt port used to detect end of conversions /// Address of the MAG3110 (default = 0x0e) /// I2C bus object - default = 400 KHz) - public Mag3110(II2cBus i2cBus, IDigitalInputPort interruptPort = null, byte address = (byte)Addresses.Default) + public Mag3110(II2cBus i2cBus, IDigitalInputPort interruptPort = null, byte address = (byte)Address.Default) : base(i2cBus, address) { var deviceID = BusComms.ReadRegister(Registers.WHO_AM_I); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs index 2e1c1899cd..72f5c68417 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs @@ -3,9 +3,9 @@ public partial class Mma7660fc { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x4C diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs index 87e3733f62..e15f566204 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs @@ -36,7 +36,7 @@ public partial class Mma7660fc : ByteCommsSensorBase, IAccelerom /// /// Address of the I2C sensor /// I2C bus - public Mma7660fc(II2cBus i2cBus, Addresses address = Addresses.Default) + public Mma7660fc(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs index 2329db725a..6a23fb556b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mmc5603 /// /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x30 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs index fa379e9648..a155a8c946 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs @@ -38,7 +38,7 @@ public bool ContinuousModeEnabled /// /// Address of the Mmc5603 /// I2C bus object - default = 400 KHz - public Mmc5603(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Mmc5603(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, 10, 8) { var deviceID = BusComms.ReadRegister(Registers.WHO_AM_I); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs index 9ca4668d4d..d6659579f2 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs @@ -3,9 +3,9 @@ public partial class Mpu6050 { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs index 67792dc529..ae081de834 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs @@ -63,7 +63,7 @@ public partial class Mpu6050 : /// /// The I2C bus /// The I2C address - public Mpu6050(II2cBus i2cBus, Addresses address = Addresses.Default) + public Mpu6050(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs index 533261dc27..dc920116b5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs @@ -8,9 +8,9 @@ namespace Meadow.Foundation.Sensors.Power public partial class Ina260 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs index dfc3a00e70..8499e92d30 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs @@ -48,13 +48,13 @@ public partial class Ina260 /// /// The I2C bus /// The I2C address - public Ina260(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Ina260(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { switch (address) { - case (byte)Addresses.Address_0x40: - case (byte)Addresses.Address_0x41: + case (byte)Address.Address_0x40: + case (byte)Address.Address_0x41: // valid; break; default: diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs index 0b67a2d964..01aaae2755 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs @@ -3,9 +3,9 @@ public partial class Lm75 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs index df56fda667..7e99c2604f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs @@ -25,7 +25,7 @@ public partial class Lm75 : ByteCommsSensorBase, ITemperature /// /// The I2C bus /// I2C address of the sensor - public Lm75(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Lm75(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs index c118755f7d..f7f490b4fc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs @@ -12,7 +12,7 @@ public partial class Mcp9600 : Mcp960x /// /// The I2C bus /// I2C address of the sensor - public Mcp9600(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) + public Mcp9600(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs index bdf771d233..048cce7af5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs @@ -12,7 +12,7 @@ public partial class Mcp9601 : Mcp960x /// /// The I2C bus /// I2C address of the sensor - public Mcp9601(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) + public Mcp9601(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) { } } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs index 87e6d5b455..66189d9ce3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs @@ -3,9 +3,9 @@ public partial class Mcp960x { /// - /// Valid addresses for the sensor + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs index 6384afe74b..7258c79188 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs @@ -3,9 +3,9 @@ public partial class Mcp9808 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x18 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs index c108a3392f..2bc375325b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs @@ -44,7 +44,7 @@ public partial class Mcp9808 : ByteCommsSensorBase, ITemperat /// /// The I2C bus /// The I2C address - public Mcp9808(II2cBus i2CBus, byte address = (byte)Addresses.Default) + public Mcp9808(II2cBus i2CBus, byte address = (byte)Address.Default) : base(i2CBus, address, readBufferSize: 8, writeBufferSize: 8) { BusComms?.WriteRegister(MCP_REG_CONFIG, (ushort)0x0); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs index d8404e746a..442816a862 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs @@ -3,9 +3,9 @@ public partial class Tmp102 { /// - /// Valid addresses for the sensor. + /// Valid I2C addresses for the sensor /// - public enum Addresses : byte + public enum Address : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs index 37c6771635..df02f3387a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs @@ -54,7 +54,7 @@ public Resolution SensorResolution /// /// The I2CBus /// I2C address of the sensor. - public Tmp102(II2cBus i2cBus, byte address = (byte)Addresses.Default) + public Tmp102(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 2, writeBufferSize: 2) { BusComms?.ReadRegister(0x01, ReadBuffer.Span); diff --git a/Source/Meadow.Foundation.sln b/Source/Meadow.Foundation.sln index 6d0a9f3df7..23523effbb 100644 --- a/Source/Meadow.Foundation.sln +++ b/Source/Meadow.Foundation.sln @@ -1143,8 +1143,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pmsa003i", "Pmsa003i", "{AD EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{A3F37EFB-9686-4074-9962-5F731C52D919}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ArducamMini", "ArducamMini", "{C9DEB9C4-050B-4C5D-8893-AF7041F89867}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch1115", "Ch1115", "{753F764D-EA21-43A0-B761-6E9B43D8C90B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Displays.Ch1115", "Meadow.Foundation.Peripherals\Displays.Ch1115\Driver\Displays.Ch1115.csproj", "{C182D69A-FE45-46BF-8522-76E0BC962FFB}" @@ -3527,7 +3525,6 @@ Global {16A387A9-80AA-4080-85F6-10F53D6EC99E} = {7311794D-7D2F-47E8-A5B0-C216CBD64A13} {AD6DD7B6-B896-44B9-904E-9330C2C842C7} = {78E463DA-0FA1-4AAE-A281-D3297C9388C9} {A3F37EFB-9686-4074-9962-5F731C52D919} = {AD6DD7B6-B896-44B9-904E-9330C2C842C7} - {C9DEB9C4-050B-4C5D-8893-AF7041F89867} = {91DE515A-DFF9-4B75-809C-F56C51222310} {753F764D-EA21-43A0-B761-6E9B43D8C90B} = {2B794146-DFEE-475A-B919-7D3ED48587B8} {C182D69A-FE45-46BF-8522-76E0BC962FFB} = {753F764D-EA21-43A0-B761-6E9B43D8C90B} {D46CA94B-9A0C-4188-9EE8-8A51E1499B73} = {753F764D-EA21-43A0-B761-6E9B43D8C90B} From 66a142e90eec84e6aa5c0f2166a9a1ce7a83c3d1 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 25 Apr 2023 09:34:26 -0700 Subject: [PATCH 2/5] More peripheral cleanup and abstraction --- .../Leds.Pca9633/Driver/Pca9633.cs | 2 +- .../Driver/Sensors.Atmospheric.Ccs811.csproj | 2 +- .../Sensors.Hid.As5013/Driver/As5013.cs | 11 ++- .../Driver/BBQ10Keyboard.cs | 7 +- .../Sensors.Hid.Mpr121/Driver/Mpr121.cs | 7 +- .../Sensors.Hid.Tsc2004/Driver/Tsc2004.cs | 7 +- .../Driver/WiiExtensionControllerBase.cs | 9 +- .../NesClassicController_Sample/MeadowApp.cs | 2 +- .../SnesClassicController_Sample/MeadowApp.cs | 2 +- .../MeadowApp.cs | 2 +- .../WiiClassicController_Sample/MeadowApp.cs | 2 +- .../Samples/WiiNunchuck_Sample/MeadowApp.cs | 2 +- .../Sensors.Light.Bh1745/Driver/Bh1745.cs | 22 ++--- .../Sensors.Light.Bh1750/Driver/Bh1750.cs | 7 +- .../Driver/Sensors.Light.Bh1750.csproj | 2 +- .../Sensors.Light.Max44009/Driver/Max44009.cs | 9 +- .../Driver/Sensors.Light.Max44009.csproj | 2 +- .../Sensors.Light.Si1145/Driver/Si1145.cs | 13 +-- .../Sensors.Light.Veml7700/Driver/Veml7700.cs | 83 ++++++++++--------- .../Sensors.LoadCell.Hx711/Driver/Hx711.cs | 58 ++++++------- .../Driver/Sensors.LoadCell.Hx711.csproj | 2 +- .../Driver/Nau7802.cs | 59 +++++++------ .../Driver/Sensors.LoadCell.Nau7802.csproj | 9 +- .../Driver/Sensors.Moisture.Capacitive.csproj | 7 +- .../Driver/Sensors.Moisture.Fc28.csproj | 9 +- .../Driver/Sensors.Motion.Adxl3xx.csproj | 2 +- 26 files changed, 181 insertions(+), 158 deletions(-) diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs index c3584898f3..13960c8018 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs @@ -5,7 +5,7 @@ namespace Meadow.Foundation.Leds /// /// Represents a Pca9633 led driver /// - public partial class Pca9633 + public partial class Pca9633 : II2cPeripheral { /// /// The default I2C address for the peripheral diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Sensors.Atmospheric.Ccs811.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Sensors.Atmospheric.Ccs811.csproj index 39588b0cc3..b483343bec 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Sensors.Atmospheric.Ccs811.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Sensors.Atmospheric.Ccs811.csproj @@ -8,7 +8,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Atmospheric.Ccs811 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, VOC, Air, Ccs811 + Meadow.Foundation,VOC,Air,quality,Ccs811 0.1.17 true Ccs811 I2C VOC Air Quality Sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs index 3e8a2b5263..84e185d68f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs @@ -11,7 +11,7 @@ namespace Meadow.Foundation.Sensors.Hid /// for analog joysticks /// public partial class As5013 - : SamplingSensorBase, IAnalogJoystick + : SamplingSensorBase, IAnalogJoystick, II2cPeripheral { /// /// Event if interrupt port is provided for interrupt pin @@ -58,6 +58,11 @@ public DigitalJoystickPosition? DigitalPosition } } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// @@ -197,9 +202,7 @@ void Update() if (IsVerticalHorizonalSwapped) { - float temp = newX; - newX = newY; - newY = temp; + (newY, newX) = (newX, newY); } var oldPosition = Position; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs index 90fb4bba2b..6f067c3f15 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs @@ -7,8 +7,13 @@ namespace Meadow.Foundation.Sensors.Hid /// /// Represents a BBQ10Keyboard Featherwing /// - public partial class BBQ10Keyboard + public partial class BBQ10Keyboard : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs index 57a64c8302..5981a7d6a2 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs @@ -9,8 +9,13 @@ namespace Meadow.Foundation.Sensors.Hid /// /// Represents the MPR121 12-Key Capacitive Touch Sensor /// - public partial class Mpr121 + public partial class Mpr121 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs index aed69b4bd5..12209d5014 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs @@ -8,8 +8,13 @@ namespace Meadow.Foundation.Sensors.Hid /// /// Represents a TSC2004 4-wire touch screen controller /// - public partial class Tsc2004 + public partial class Tsc2004 : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs index ca1a8c16dc..51158c3286 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs @@ -9,12 +9,17 @@ namespace Meadow.Foundation.Sensors.Hid /// Abstract base class that represents /// Nintendo Wiimote I2C extension controllers /// - public abstract partial class WiiExtensionControllerBase + public abstract partial class WiiExtensionControllerBase : II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Default I2C bus speed (400kHz) /// - public static I2cBusSpeed DefaultSpeed => I2cBusSpeed.Fast; + public static I2cBusSpeed DefaultI2cSpeed => I2cBusSpeed.Fast; /// /// I2C Communication bus used to communicate with the peripheral diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/NesClassicController_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/NesClassicController_Sample/MeadowApp.cs index 9e9ab08195..a37c010cb7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/NesClassicController_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/NesClassicController_Sample/MeadowApp.cs @@ -16,7 +16,7 @@ public override Task Initialize() { Resolver.Log.Info("Initialize..."); - var i2cBus = Device.CreateI2cBus(NesClassicController.DefaultSpeed); + var i2cBus = Device.CreateI2cBus(NesClassicController.DefaultI2cSpeed); nesController = new NesClassicController(i2cBus: i2cBus); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/SnesClassicController_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/SnesClassicController_Sample/MeadowApp.cs index ed1100f6c2..d158164c6e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/SnesClassicController_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/SnesClassicController_Sample/MeadowApp.cs @@ -16,7 +16,7 @@ public override Task Initialize() { Resolver.Log.Info("Initialize..."); - var i2cBus = Device.CreateI2cBus(SnesClassicController.DefaultSpeed); + var i2cBus = Device.CreateI2cBus(SnesClassicController.DefaultI2cSpeed); snesController = new SnesClassicController(i2cBus: i2cBus); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicControllerPro_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicControllerPro_Sample/MeadowApp.cs index f0e0a61685..cc2b434b0e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicControllerPro_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicControllerPro_Sample/MeadowApp.cs @@ -16,7 +16,7 @@ public override Task Initialize() { Resolver.Log.Info("Initialize..."); - var i2cBus = Device.CreateI2cBus(WiiClassicControllerPro.DefaultSpeed); + var i2cBus = Device.CreateI2cBus(WiiClassicControllerPro.DefaultI2cSpeed); classicControllerPro = new WiiClassicControllerPro(i2cBus: i2cBus, useHighResolutionMode: true); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicController_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicController_Sample/MeadowApp.cs index af3b7699b8..66ec80bb77 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicController_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiClassicController_Sample/MeadowApp.cs @@ -16,7 +16,7 @@ public override Task Initialize() { Resolver.Log.Info("Initialize..."); - var i2cBus = Device.CreateI2cBus(WiiClassicController.DefaultSpeed); + var i2cBus = Device.CreateI2cBus(WiiClassicController.DefaultI2cSpeed); classicController = new WiiClassicController(i2cBus: i2cBus, useHighResolutionMode: true); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiNunchuck_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiNunchuck_Sample/MeadowApp.cs index d477cb2c06..d09c3d81eb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiNunchuck_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Samples/WiiNunchuck_Sample/MeadowApp.cs @@ -16,7 +16,7 @@ public override Task Initialize() { Resolver.Log.Info("Initialize..."); - nunchuck = new WiiNunchuck(Device.CreateI2cBus(WiiNunchuck.DefaultSpeed)); + nunchuck = new WiiNunchuck(Device.CreateI2cBus(WiiNunchuck.DefaultI2cSpeed)); nunchuck.GetIdentification(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs index 065b5e56b7..27cb077536 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs @@ -7,25 +7,12 @@ namespace Meadow.Foundation.Sensors.Light { - // TODO: The chip can drive LEDs which will help to identify colors more - // accurately by lighting them up. I found this documentation from the - // pimoroni site (https://shop.pimoroni.com/products/bh1745-luminance-and-colour-sensor-breakout) - // which makes a breakout that has LEDs: - // - // The LEDs are connected to the BH1745 Interrupt line. This is activated by - // a threshold mechanism that is fully documented in the BH1745 chip manual. - // You can select which of the four light sensor channels to use and you can - // set a high and a low threshold. The Interrupt is enabled when the light - // is above the high level or below the low level. Write 0x1D to register - // 0x60 to enable Interrupts and select the unfiltered light sensor. Write - // 0xFF to the four registers starting at 0x62 to force the LEDs on. With - // the default settings in these registers, the LEDS will be off. - /// /// Represents a BH1745 Luminance and Colour Sensor /// public partial class Bh1745 - : ByteCommsSensorBase<(Illuminance? AmbientLight, Color? Color, bool Valid)>, ILightSensor + : ByteCommsSensorBase<(Illuminance? AmbientLight, Color? Color, bool Valid)>, + ILightSensor, II2cPeripheral { /// /// Raised when the luminosity changes @@ -235,6 +222,11 @@ public ushort UpperInterruptThreshold /// public ChannelMultipliers CompensationMultipliers { get; set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new BH17545 color sensor object /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs index f32a772db4..a03920267d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs @@ -11,7 +11,7 @@ namespace Meadow.Foundation.Sensors.Light /// /// Represents a BH1750 ambient light sensor /// - public partial class Bh1750 : ByteCommsSensorBase, ILightSensor + public partial class Bh1750 : ByteCommsSensorBase, ILightSensor, II2cPeripheral { /// /// Raised when a new Illuminance value is read by the sensor @@ -42,6 +42,11 @@ public double LightTransmittance private const float MaxTransmittance = 2.225f; private const float MinTransmittance = 0.272f; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new BH1750 light sensor object using a static reference voltage. /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Sensors.Light.Bh1750.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Sensors.Light.Bh1750.csproj index f72e3c4d76..b995205fe0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Sensors.Light.Bh1750.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Sensors.Light.Bh1750.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Light.Bh1750 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Light, Bh1750 + Meadow.Foundation,luminance,color,Light,Bh1750 0.1.52 true Bh1750 I2C luminance and color light sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs index 2cfaa0a234..2018fbcbcd 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs @@ -8,15 +8,20 @@ namespace Meadow.Foundation.Sensors.Light /// /// Driver for the Max44009 light-to-digital converter /// - public partial class Max44009 : ByteCommsSensorBase + public partial class Max44009 : ByteCommsSensorBase, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Max44009 object /// /// The I2C bus /// The I2C address public Max44009(II2cBus i2cBus, byte address = (byte)Address.Default) - : base(i2cBus, address) + : base(i2cBus, address) { Initialize(); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Sensors.Light.Max44009.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Sensors.Light.Max44009.csproj index 73d727c4db..43bf0de40c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Sensors.Light.Max44009.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Sensors.Light.Max44009.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Light.Max44009 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Max44009, Light + Meadow.Foundation,Max44009,Light,ultraviolet 0.1.49 true Max44009 I2C ultraviolet and ambient light sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs index d9daba43e7..97c61f53c5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs @@ -6,17 +6,18 @@ namespace Meadow.Foundation.Sensors.Light { - // TODO: the proximity stuff isn't exposed. exposing it needs some more - // thought. you need to hook up an infrared LED to the LED pin. this will - // cause that pin to fire, then the sensor measures the time of flight. - // it's basically a completely different sensor. - /// /// Represents a SiLabs Proximity, UV, and ambient light sensor /// public partial class Si1145 - : ByteCommsSensorBase<(Illuminance? VisibleLight, double? UltravioletIndex, Illuminance? Infrared)> + : ByteCommsSensorBase<(Illuminance? VisibleLight, double? UltravioletIndex, Illuminance? Infrared)>, + II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new SI1145 sensor object /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs index f1373e8b79..97e5226f03 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs @@ -9,7 +9,8 @@ namespace Meadow.Foundation.Sensors.Light /// /// High Accuracy Ambient Light Sensor /// - public partial class Veml7700 : ByteCommsSensorBase, ILightSensor, IDisposable + public partial class Veml7700 : ByteCommsSensorBase, + ILightSensor, II2cPeripheral, IDisposable { /// /// Raised when the luminosity value changes @@ -41,6 +42,11 @@ public partial class Veml7700 : ByteCommsSensorBase, ILightSensor, private const ushort DATA_FLOOR = 100; private const ushort DATA_CEILING = 10000; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Create a new Veml7700 object with the default address /// @@ -50,10 +56,10 @@ public Veml7700(II2cBus i2cBus) { } - int _gain = 3; - int _integrationTime = 0; - bool _firstRead = true; - bool _outOfRange = false; + int gain = 3; + int integrationTime = 0; + bool firstRead = true; + bool outOfRange = false; /// /// Reads data from the sensor @@ -63,12 +69,11 @@ protected async override Task ReadSensor() { Illuminance illuminance = new Illuminance(0); - if (_firstRead) + if (firstRead) { WriteRegister(Registers.AlsConf0, 0); - //--//--// await Task.Delay(5); - _firstRead = false; + firstRead = false; } // priming read @@ -76,59 +81,59 @@ protected async override Task ReadSensor() while (true) { - _outOfRange = false; + outOfRange = false; // Resolver.Log.Info($"{DataSource} DATA A: 0x{data:x4}"); if (data > DATA_CEILING) { // Too bright! - if (_gain > 1) + if (gain > 1) { - await SetGain(--_gain); + await SetGain(--gain); } else if (data > DATA_CEILING) { // we're at min gain, have to speed integration time - if (++_integrationTime >= 4) + if (++integrationTime >= 4) { // everything is maxed out RangeExceededHigh?.Invoke(this, EventArgs.Empty); - _outOfRange = true; + outOfRange = true; } else { - await SetIntegrationTime(_integrationTime); + await SetIntegrationTime(integrationTime); } } } else if (data < DATA_FLOOR) { // Too dim! - if (_gain < 4) + if (gain < 4) { - await SetGain(++_gain); + await SetGain(++gain); } else if (data < DATA_FLOOR) { // we're at max gain, have to slow integration time - if (--_integrationTime <= -2) + if (--integrationTime <= -2) { RangeExceededLow?.Invoke(this, EventArgs.Empty); - _outOfRange = true; + outOfRange = true; } else { - await SetIntegrationTime(_integrationTime); + await SetIntegrationTime(integrationTime); } } } - if ((data >= DATA_FLOOR && data <= DATA_CEILING) || _outOfRange) + if ((data >= DATA_FLOOR && data <= DATA_CEILING) || outOfRange) { - return ScaleDataToIluminance(data, _gain, _integrationTime); + return ScaleDataToIluminance(data, gain, integrationTime); } - await DelayForIntegrationTime(_integrationTime); + await DelayForIntegrationTime(integrationTime); data = ReadRegister(DataSource == SensorTypes.Ambient ? Registers.Als : Registers.White); } @@ -136,24 +141,17 @@ protected async override Task ReadSensor() private Illuminance ScaleDataToIluminance(ushort data, int gain, int integrationTime) { - int scale; - - switch (gain) + var scale = gain switch { - case 1: // 1/8 - scale = 8; - break; - case 2: // 1/4 - scale = 4; - break; - case 4: // 2 - scale = 2; - break; - case 3: // 1 - default: - scale = 1; - break; - } + // 1/8 + 1 => 8, + // 1/4 + 2 => 4, + // 2 + 4 => 2, + // 1 + _ => 1, + }; switch (integrationTime) { @@ -196,8 +194,11 @@ private Illuminance CalculateCorrectedLux(double lux) return new Illuminance(6.0135E-13 * Math.Pow(lux, 4) - 9.3924E-09 * Math.Pow(lux, 3) + 8.1488E-05 * Math.Pow(lux, 2) + 1.0023E+00 * lux); } - - private void SetPower(bool on) + /// + /// Set power mode + /// + /// + public void SetPower(bool on) { ushort cfg; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Hx711.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Hx711.cs index 4c8eea86fd..92610519ff 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Hx711.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Hx711.cs @@ -15,16 +15,16 @@ public partial class Hx711 : PollingSensorBase, IMassSensor, IDisposable private const uint GPIO_BASE = 0x40020000; private const uint IDR_OFFSET = 0x10; private const uint BSSR_OFFSET = 0x18; - private const int timing_iterations = 3; + private const int timingIterations = 3; - private uint _sck_address; - private int _sck_pin; - private uint _dout_address; - private uint _sck_set; - private uint _sck_clear; - private uint _dout_mask; - private double _gramsPerAdcUnit; - private bool _createdPorts = false; + private uint sckAddress; + private int sckPin; + private uint doutAddress; + private uint sckSet; + private uint sckClear; + private uint doutMask; + private double gramsPerAdcUnit; + private readonly bool createdPorts = false; private IDigitalOutputPort SCK { get; } private IDigitalInputPort DOUT { get; } @@ -74,7 +74,7 @@ public Hx711(IPin sck, IPin dout, uint? tareValue = null) { SCK = sck.CreateDigitalOutputPort(); DOUT = dout.CreateDigitalInputPort(); - _createdPorts = true; // we need to dispose what we create + createdPorts = true; // we need to dispose what we create CalculateRegisterValues(sck, dout); Start(); @@ -185,7 +185,7 @@ public int CalculateCalibrationFactor() /// public void SetCalibrationFactor(int factor, Mass knownValue) { - _gramsPerAdcUnit = (knownValue.Grams / factor); + gramsPerAdcUnit = (knownValue.Grams / factor); } /// @@ -197,7 +197,7 @@ protected override Task ReadSensor() //ReadADC() call may block so wrap the logic in a Task return Task.Run(() => { - if (_gramsPerAdcUnit == 0) + if (gramsPerAdcUnit == 0) { throw new Exception("Calibration factor has not been set"); } @@ -219,7 +219,7 @@ protected override Task ReadSensor() } // convert to grams - var grams = value * _gramsPerAdcUnit; + var grams = value * gramsPerAdcUnit; // convert to desired units return new Mass(grams, Units.Mass.UnitType.Grams); @@ -234,15 +234,15 @@ private void CalculateRegisterValues(IPin sck, IPin dout) // Bits 15:0 set // Port offset = 0x0400 * index (with A being index 0) int gpio_port = sck.Key.ToString()[1] - 'A'; - _sck_pin = int.Parse(sck.Key.ToString().Substring(2)); - _sck_address = GPIO_BASE | (0x400u * (uint)gpio_port) | BSSR_OFFSET; - _sck_set = 1u << _sck_pin; - _sck_clear = 1u << (16 + _sck_pin); + sckPin = int.Parse(sck.Key.ToString().Substring(2)); + sckAddress = GPIO_BASE | (0x400u * (uint)gpio_port) | BSSR_OFFSET; + sckSet = 1u << sckPin; + sckClear = 1u << (16 + sckPin); gpio_port = dout.Key.ToString()[1] - 'A'; var gpio_pin = int.Parse(dout.Key.ToString().Substring(2)); - _dout_address = GPIO_BASE | (0x400u * (uint)gpio_port) | IDR_OFFSET; - _dout_mask = 1u << gpio_pin; + doutAddress = GPIO_BASE | (0x400u * (uint)gpio_port) | IDR_OFFSET; + doutMask = 1u << gpio_pin; } private unsafe void ClockLow() @@ -250,19 +250,19 @@ private unsafe void ClockLow() // this seems convoluted, but it is intentionally so to keep the compiler from optimizing out out timing. // A single call takes roughly 0.2us, but the part requires a minimum of 0.25us for the ADC to settle. // We don't have a simple micro-sleep, so we simply make multiple calls to assert state to suck up the required timing - for (int i = 0; i < timing_iterations; i++) + for (int i = 0; i < timingIterations; i++) { - var val = 1u << (16 + _sck_pin); // low - *(uint*)_sck_address = val; + var val = 1u << (16 + sckPin); // low + *(uint*)sckAddress = val; } } private unsafe void ClockHigh() { - for (int i = 0; i < timing_iterations; i++) + for (int i = 0; i < timingIterations; i++) { - var val = 1u << _sck_pin; // high - *(uint*)_sck_address = val; + var val = 1u << sckPin; // high + *(uint*)sckAddress = val; } } @@ -273,7 +273,7 @@ private unsafe uint ReadADC() lock (samplingLock) { // data line low indicates ready - while ((*(uint*)_dout_address & _dout_mask) != 0) + while ((*(uint*)doutAddress & doutMask) != 0) { Thread.Sleep(0); } @@ -281,10 +281,10 @@ private unsafe uint ReadADC() for (int i = 0; i < 24; i++) // 24 bits of data { ClockHigh(); - count = count << 1; + count <<= 1; ClockLow(); - if ((*(uint*)_dout_address & _dout_mask) != 0) // read DOUT state + if ((*(uint*)doutAddress & doutMask) != 0) // read DOUT state { count++; } @@ -326,7 +326,7 @@ protected override void RaiseEventsAndNotify(IChangeResult changeResult) /// Is disposing protected virtual void Dispose(bool disposing) { - if (_createdPorts) + if (createdPorts) { SCK.Dispose(); DOUT.Dispose(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Sensors.LoadCell.Hx711.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Sensors.LoadCell.Hx711.csproj index b4211af8fc..855bd45fbd 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Sensors.LoadCell.Hx711.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Hx711/Driver/Sensors.LoadCell.Hx711.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.LoadCell.Hx711 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, LoadCell, Hx711 + Meadow.Foundation,LoadCell,Hx711 0.1.49 true Hx711 digital load cell amplifier diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs index bcc24df5b7..2396e679cf 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs @@ -10,17 +10,17 @@ namespace Meadow.Foundation.Sensors.LoadCell /// /// 24-Bit Dual-Channel ADC For Bridge Sensors /// - public partial class Nau7802 : ByteCommsSensorBase, IMassSensor, IDisposable + public partial class Nau7802 : ByteCommsSensorBase, IMassSensor, II2cPeripheral, IDisposable { /// /// Raised when the mass value changes /// public event EventHandler> MassUpdated = delegate { }; - private byte[] _read = new byte[3]; - private double _gramsPerAdcUnit = 0; - private PU_CTRL_BITS _currentPU_CTRL; - private int _tareValue; + private readonly byte[] readBuffer = new byte[3]; + private double gramsPerAdcUnit = 0; + private PU_CTRL_BITS currentPuCTRL; + private int tareValue; /// /// Default sample period @@ -32,6 +32,11 @@ public partial class Nau7802 : ByteCommsSensorBase, IMassSensor, IDisposab /// public Mass? Mass { get; private set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Creates an instance of the NAU7802 Driver class /// @@ -66,8 +71,8 @@ private int ReadADC() Thread.Sleep(1); } - BusComms?.ReadRegister((byte)Register.ADCO_B2, _read); - return _read[0] << 16 | _read[1] << 8 | _read[2]; + BusComms?.ReadRegister((byte)Register.ADCO_B2, readBuffer); + return readBuffer[0] << 16 | readBuffer[1] << 8 | readBuffer[2]; } /// @@ -80,8 +85,8 @@ public void Tare() Thread.Sleep(1); } - _tareValue = ReadADC(); - Output.WriteLine($"Tare base = {_tareValue:x}"); + tareValue = ReadADC(); + Output.WriteLine($"Tare base = {tareValue:x}"); } private void PowerOn() @@ -89,17 +94,17 @@ private void PowerOn() Output.WriteLine($"Powering up..."); // Set and clear the RR bit in 0x00, to guarantee a reset of all register values - _currentPU_CTRL = PU_CTRL_BITS.RR; - BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)_currentPU_CTRL); + currentPuCTRL = PU_CTRL_BITS.RR; + BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)currentPuCTRL); Thread.Sleep(1); // make sure it has time to do it's thing - _currentPU_CTRL &= ~PU_CTRL_BITS.RR; + currentPuCTRL &= ~PU_CTRL_BITS.RR; - BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)_currentPU_CTRL); + BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)currentPuCTRL); // turn on the analog and digital power - _currentPU_CTRL |= (PU_CTRL_BITS.PUD | PU_CTRL_BITS.PUA); + currentPuCTRL |= (PU_CTRL_BITS.PUD | PU_CTRL_BITS.PUA); - BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)_currentPU_CTRL); + BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)currentPuCTRL); // wait for power-up ready var timeout = 100; do @@ -110,8 +115,8 @@ private void PowerOn() throw new Exception("Timeout powering up"); } Thread.Sleep(10); - _currentPU_CTRL = (PU_CTRL_BITS)(BusComms?.ReadRegister((byte)Register.PU_CTRL) ?? 0); - } while ((_currentPU_CTRL & PU_CTRL_BITS.PUR) != PU_CTRL_BITS.PUR); + currentPuCTRL = (PU_CTRL_BITS)(BusComms?.ReadRegister((byte)Register.PU_CTRL) ?? 0); + } while ((currentPuCTRL & PU_CTRL_BITS.PUR) != PU_CTRL_BITS.PUR); Output.WriteLine($"Configuring..."); @@ -128,13 +133,13 @@ private void PowerOn() } // turn on cycle start - _currentPU_CTRL = (PU_CTRL_BITS)(BusComms?.ReadRegister((byte)Register.PU_CTRL) ?? 0); - _currentPU_CTRL |= PU_CTRL_BITS.CS; + currentPuCTRL = (PU_CTRL_BITS)(BusComms?.ReadRegister((byte)Register.PU_CTRL) ?? 0); + currentPuCTRL |= PU_CTRL_BITS.CS; - BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)_currentPU_CTRL); + BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)currentPuCTRL); - Output.WriteLine($"PU_CTRL: {_currentPU_CTRL}"); // 0xBE + Output.WriteLine($"PU_CTRL: {currentPuCTRL}"); // 0xBE // Enter the low power standby condition by setting PUA and PUD bits to 0, in R0x00 // Resume operation by setting PUA and PUD bits to 1, in R0x00.This sequence is the same for powering up from the standby condition, except that from standby all of the information in the configuration and calibration registers will be retained if the power supply is stable.Depending on conditions and the application, it may be desirable to perform calibration again to update the calibration registers for the best possible accuracy. @@ -162,9 +167,9 @@ private void SetLDO(LdoVoltage value) ctrl1 |= (byte)((byte)value << 3); BusComms?.WriteRegister((byte)Register.CTRL1, ctrl1); - _currentPU_CTRL |= PU_CTRL_BITS.AVDDS; + currentPuCTRL |= PU_CTRL_BITS.AVDDS; - BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)_currentPU_CTRL); // enable internal LDO + BusComms?.WriteRegister((byte)Register.PU_CTRL, (byte)currentPuCTRL); // enable internal LDO } private void SetGain(AdcGain value) @@ -239,7 +244,7 @@ public int CalculateCalibrationFactor() public void SetCalibrationFactor(int factor, Mass knownValue) { Resolver.Log.Info($"SetCalibrationFactor: knownValue.Grams: {knownValue.Grams:N1}"); - _gramsPerAdcUnit = knownValue.Grams / factor; + gramsPerAdcUnit = knownValue.Grams / factor; } int DoConversion() @@ -265,7 +270,7 @@ int DoConversion() /// The latest sensor reading protected override Task ReadSensor() { - if (_gramsPerAdcUnit == 0) + if (gramsPerAdcUnit == 0) { throw new Exception("Calibration factor has not been set"); } @@ -273,9 +278,9 @@ protected override Task ReadSensor() // get an ADC conversion var c = DoConversion(); // subtract the tare - var adc = c - _tareValue; + var adc = c - tareValue; // convert to grams - var grams = adc * _gramsPerAdcUnit; + var grams = adc * gramsPerAdcUnit; // convert to desired units return Task.FromResult(new Mass(grams, Units.Mass.UnitType.Grams)); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Sensors.LoadCell.Nau7802.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Sensors.LoadCell.Nau7802.csproj index 964e5b4dd4..6f4898b7b0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Sensors.LoadCell.Nau7802.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Sensors.LoadCell.Nau7802.csproj @@ -10,17 +10,14 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.LoadCell.Nau7802 https://github.com/WildernessLabs/Meadow.Foundation - Meadow,Meadow.Foundation,LoadCell, Nau7802 + Meadow,Meadow.Foundation,LoadCell,Nau7802 0.1.17 true NAU7802 I2C 24-Bit dual channel analog to digital converter enable - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Capacitive/Driver/Sensors.Moisture.Capacitive.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Capacitive/Driver/Sensors.Moisture.Capacitive.csproj index 0d5ce90ab2..b1b7f465a0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Capacitive/Driver/Sensors.Moisture.Capacitive.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Capacitive/Driver/Sensors.Moisture.Capacitive.csproj @@ -16,11 +16,8 @@ Analog capacitive soil moisture sensor enable - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Fc28/Driver/Sensors.Moisture.Fc28.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Fc28/Driver/Sensors.Moisture.Fc28.csproj index 98c68f38ad..4ce9dbee36 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Fc28/Driver/Sensors.Moisture.Fc28.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Moisture.Fc28/Driver/Sensors.Moisture.Fc28.csproj @@ -10,17 +10,14 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Moisture.Fc28 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, FC28, Soil Moisture + Meadow.Foundation,FC28,Soil,Moisture 0.5.54 true FC28 analog soil moisture sensor enable - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Sensors.Motion.Adxl3xx.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Sensors.Motion.Adxl3xx.csproj index 94b2a4605a..29c9fbf424 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Sensors.Motion.Adxl3xx.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Sensors.Motion.Adxl3xx.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.Adxl3xx https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, ADXL335, ADXL345, ADXL337, ADXL362, ADXL377, Accelerometer, Motion + Meadow.Foundation,ADXL335,ADXL345,ADXL337,ADXL362,ADXL377,Accelerometer,Motion,3-axis 0.1.13 true ADXL3xx Analog and I2C 3-axis accelerometers (ADXL335, ADXL345, ADXL337, ADXL362, ADXL377) From 5b87e40a06767d1efaf5c20698e9b03b7cc7b6cb Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 25 Apr 2023 10:15:50 -0700 Subject: [PATCH 3/5] More I2C cleanup --- .../Driver/Drivers/Adxl335.cs | 12 ++--- .../Driver/Drivers/Adxl337.cs | 17 +++---- .../Driver/Drivers/Adxl345.cs | 43 +++++++++------- .../Driver/Drivers/Adxl362.cs | 12 +---- .../Driver/Drivers/Adxl377.cs | 20 ++++---- .../Driver/Apds9960.cs | 12 +++-- .../Driver/Sensors.Motion.Apds9960.csproj | 2 +- .../Driver/Bmi270.Enums.cs | 2 +- .../Sensors.Motion.Bmi270/Driver/Bmi270.cs | 8 ++- .../Sensors.Motion.Bno055/Driver/Bno055.cs | 28 +++-------- .../Driver/Hcsens0040.cs | 20 ++++---- .../Driver/Sensors.Motion.Hcsens0040.csproj | 2 +- .../Sensors.Motion.Hmc5883/Driver/Hmc5883.cs | 7 ++- .../Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs | 7 ++- .../Driver/Lsm303agr.cs | 8 ++- .../Sensors.Motion.Mag3110/Driver/Mag3110.cs | 13 +++-- .../Driver/Sensors.Motion.Mag3110.csproj | 2 +- .../Driver/Mma7660fc.cs | 10 ++-- .../Driver/Sensors.Motion.Mma7660fc.csproj | 2 +- .../Sensors.Motion.Mmc5603/Driver/Mmc5603.cs | 11 +++-- .../Sensors.Motion.Mpu6050/Driver/Mpu6050.cs | 16 +++--- .../Driver/Sensors.Motion.ParallaxPir.csproj | 2 +- .../Sensors.Power.Ina260/Driver/Ina260.cs | 8 ++- .../Driver/Sensors.Power.Ina260.csproj | 7 +-- .../Driver/Sensors.Radio.Rfid.IDxxLA.csproj | 2 +- .../Driver/Sensors.Sound.Ky038.csproj | 2 +- .../Sensors.Temperature.Lm75/Driver/Lm75.cs | 8 ++- .../Driver/Sensors.Temperature.Lm75.csproj | 7 +-- .../Driver/Mcp960x.cs | 9 +++- .../Driver/Mcp9808.Registers.cs | 27 ++++++++++ .../Driver/Mcp9808.cs | 49 +++++++------------ .../Sensors.Temperature.Thermistor.csproj | 11 ++--- .../Driver/Thermistor.cs | 11 +++-- .../Driver/Sensors.Temperature.Tmp102.csproj | 9 ++-- .../Driver/Tmp102.cs | 24 +++++---- ...Sensors.Weather.SwitchingAnemometer.csproj | 4 +- .../Sensors.Weather.SwitchingRainGauge.csproj | 2 +- .../Driver/Sensors.Weather.WindVane.csproj | 2 +- .../Driver/Servos.ServoCore.csproj | 2 +- 39 files changed, 237 insertions(+), 203 deletions(-) create mode 100644 Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Registers.cs diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl335.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl335.cs index 8acb3bb8e9..c3c7be4989 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl335.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl335.cs @@ -4,18 +4,18 @@ namespace Meadow.Foundation.Sensors.Motion { /// - /// Driver for the ADXL335 triple axis accelerometer. + /// Driver for the ADXL335 triple axis accelerometer /// +/- 3g /// public class Adxl335 : Adxl3xxBase { /// - /// Create a new ADXL335 sensor object. + /// Create a new ADXL335 sensor object /// - /// Analog pin connected to the X axis output from the ADXL335 sensor. - /// Analog pin connected to the Y axis output from the ADXL335 sensor. - /// Analog pin connected to the Z axis output from the ADXL335 sensor. - /// The voltage supplied to the sensor. Defaults to 3.3V if null. + /// Analog pin connected to the X axis output from the ADXL335 sensor + /// Analog pin connected to the Y axis output from the ADXL335 sensor + /// Analog pin connected to the Z axis output from the ADXL335 sensor + /// The voltage supplied to the sensor. Defaults to 3.3V if null public Adxl335( IPin xPin, IPin yPin, IPin zPin, Voltage? supplyVoltage) : base(xPin, yPin, zPin, 6, supplyVoltage) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl337.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl337.cs index c6d84adb1a..fd3ff3ff13 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl337.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl337.cs @@ -4,22 +4,21 @@ namespace Meadow.Foundation.Sensors.Motion { /// - /// Driver for the ADXL337 triple axis accelerometer. + /// Driver for the ADXL337 triple axis accelerometer /// +/- 3g /// public class Adxl337 : Adxl3xxBase { /// - /// Create a new ADXL335 sensor object. + /// Create a new ADXL335 sensor object /// - /// Analog pin connected to the X axis output from the ADXL335 sensor. - /// Analog pin connected to the Y axis output from the ADXL335 sensor. - /// Analog pin connected to the Z axis output from the ADXL335 sensor. - /// The voltage supplied to the sensor. Defaults to 3.3V if null. - public Adxl337( - IPin xPin, IPin yPin, IPin zPin, Voltage? supplyVoltage) + /// Analog pin connected to the X axis output from the ADXL335 sensor + /// Analog pin connected to the Y axis output from the ADXL335 sensor + /// Analog pin connected to the Z axis output from the ADXL335 sensor + /// The voltage supplied to the sensor. Defaults to 3.3V if null + public Adxl337(IPin xPin, IPin yPin, IPin zPin, Voltage? supplyVoltage) : base(xPin, yPin, zPin, 6, supplyVoltage) { } } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs index 1a8289f627..07d92976ce 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs @@ -11,8 +11,13 @@ namespace Meadow.Foundation.Sensors.Motion /// Driver for the ADXL345 triple axis accelerometer /// +/- 16g /// - public partial class Adxl345 : ByteCommsSensorBase, IAccelerometer + public partial class Adxl345 : ByteCommsSensorBase, IAccelerometer, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Event raised when acceleration changes /// @@ -22,7 +27,7 @@ public partial class Adxl345 : ByteCommsSensorBase, IAcceleromet /// /// Minimum value that can be used for the update interval when the - /// sensor is being configured to generate interrupts. + /// sensor is being configured to generate interrupts /// public const ushort MinimumPollingPeriod = 100; @@ -32,10 +37,10 @@ public partial class Adxl345 : ByteCommsSensorBase, IAcceleromet public Acceleration3D? Acceleration3D => Conditions; /// - /// Values stored in this register are automatically added to the X reading. + /// Values stored in this register are automatically added to the X reading /// /// - /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g. + /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g /// public sbyte OffsetX { @@ -44,10 +49,10 @@ public sbyte OffsetX } /// - /// Values stored in this register are automatically added to the Y reading. + /// Values stored in this register are automatically added to the Y reading /// /// - /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g. + /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g /// public sbyte OffsetY { @@ -56,10 +61,10 @@ public sbyte OffsetY } /// - /// Values stored in this register are automatically added to the Z reading. + /// Values stored in this register are automatically added to the Z reading /// /// - /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g. + /// Scale factor is 15.6 mg/LSB so 0x7f represents an offset of 2g /// public sbyte OffsetZ { @@ -68,7 +73,7 @@ public sbyte OffsetZ } /// - /// Create a new instance of the ADXL345 communicating over the I2C interface. + /// Create a new instance of the ADXL345 communicating over the I2C interface /// /// Address of the I2C sensor /// I2C bus @@ -78,7 +83,7 @@ public Adxl345(II2cBus i2cBus, Address address = Address.Default) } /// - /// Create a new instance of the ADXL345 communicating over the I2C interface. + /// Create a new instance of the ADXL345 communicating over the I2C interface /// /// Address of the I2C sensor /// I2C bus @@ -122,11 +127,11 @@ protected override void RaiseEventsAndNotify(IChangeResult chang /// /// Set the PowerControl register (see pages 25 and 26 of the data sheet) /// - /// Link the activity and inactivity events. - /// Enable / disable auto sleep when the activity and inactivity are linked. - /// Enable or disable measurements (turn on or off). - /// Put the part to sleep (true) or run in normal more (false). - /// Frequency of measurements when the part is in sleep mode. + /// Link the activity and inactivity events + /// Enable / disable auto sleep when the activity and inactivity are linked + /// Enable or disable measurements (turn on or off) + /// Put the part to sleep (true) or run in normal more (false) + /// Frequency of measurements when the part is in sleep mode public void SetPowerState(bool linkActivityAndInactivity, bool autoSleep, bool measuring, bool sleep, Frequencies frequency) { byte data = 0; @@ -154,13 +159,13 @@ public void SetPowerState(bool linkActivityAndInactivity, bool autoSleep, bool m /// /// Configure the data format (see pages 26 and 27 of the data sheet). /// - /// Put the device into self test mode when true. - /// Use 3-wire SPI (true) or 4-wire SPI (false). + /// Put the device into self test mode when true + /// Use 3-wire SPI (true) or 4-wire SPI (false) /// /// Set to full resolution (true) or 10-bit mode using the range determined by the range /// parameter (false). /// - /// Left-justified when true, right justified with sign extension when false. + /// Left-justified when true, right justified with sign extension when false /// Set the range of the sensor to 2g, 4g, 8g or 16g /// /// The range of the sensor is determined by the following table: @@ -196,7 +201,7 @@ public void SetDataFormat(bool selfTest, bool spiMode, bool fullResolution, bool /// /// Set the data rate and low power mode for the sensor. /// - /// Data rate for the sensor. + /// Data rate for the sensor /// /// Setting this to true will enter low power mode (note measurement will encounter more noise in /// this mode). diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs index 3f3a9d3a3e..3c2899568d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl362.cs @@ -11,14 +11,6 @@ namespace Meadow.Foundation.Sensors.Motion { - // Sample Reading - // Accel: [X:-1.04,Y:-0.29,Z:-9.44 (m/s^2)] - // Temp: 21.10C - - // Todo: right now, the sensor default to +-2G sensitivity. that can be - // changed in software. it would be good to expose that. note that the - // conversion will be different based on sensitivity range. - /// /// Driver for the ADXL362 triple axis accelerometer. /// @@ -40,12 +32,12 @@ public partial class Adxl362 const double AVERAGE_TEMPERATURE_BIAS = 350; /// - /// Digital input port attached to interrupt pin 1 on the ADXL362. + /// Digital input port attached to interrupt pin 1 on the ADXL362 /// private IDigitalInputPort digitalInputPort1; /// - /// Digital Input port attached to interrupt pin 2 on the ADXL362. + /// Digital Input port attached to interrupt pin 2 on the ADXL362 /// private IDigitalInputPort digitalInputPort2; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl377.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl377.cs index eae3ed0b75..3970034163 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl377.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl377.cs @@ -4,22 +4,20 @@ namespace Meadow.Foundation.Sensors.Motion { /// - /// Driver for the ADXL377 triple axis accelerometer. + /// Driver for the ADXL377 triple axis accelerometer /// +/- 200g /// public class Adxl377 : Adxl3xxBase { /// - /// Create a new ADXL335 sensor object. + /// Create a new ADXL377 sensor object /// - /// Analog pin connected to the X axis output from the ADXL335 sensor. - /// Analog pin connected to the Y axis output from the ADXL335 sensor. - /// Analog pin connected to the Z axis output from the ADXL335 sensor. - /// The voltage supplied to the sensor. Defaults to 3.3V if null. - public Adxl377( - IPin xPin, IPin yPin, IPin zPin, Voltage? supplyVoltage) + /// Analog pin connected to the X axis output from the ADXL335 sensor + /// Analog pin connected to the Y axis output from the ADXL335 sensor + /// Analog pin connected to the Z axis output from the ADXL335 sensor + /// The voltage supplied to the sensor. Defaults to 3.3V if null + public Adxl377(IPin xPin, IPin yPin, IPin zPin, Voltage? supplyVoltage) : base(xPin, yPin, zPin, 400, supplyVoltage) - { - } + { } } -} +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs index 90d6860407..aac94f8fa3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs @@ -6,14 +6,11 @@ namespace Meadow.Foundation.Sensors.Motion { - // TODO: the light stuff seems to work. not sure on the RGB conversion though. - // haven't tested any of the gesture stuff. - // need to add distance - /// /// Represents the APDS9960 Proximity, Light, RGB, and Gesture Sensor /// - public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? AmbientLight)> + public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? AmbientLight)>, + II2cPeripheral { /// /// Raised when the ambient light value changes @@ -25,6 +22,11 @@ public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? /// public event EventHandler> ColorUpdated = delegate { }; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + readonly IDigitalInputPort interruptPort; readonly GestureData gestureData; int gestureUdDelta; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Sensors.Motion.Apds9960.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Sensors.Motion.Apds9960.csproj index 7c413c972f..d0752d9ff3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Sensors.Motion.Apds9960.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Sensors.Motion.Apds9960.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.Apds9960 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Acceleration, Accelerometer, Apds9960 + Meadow.Foundation,Acceleration,Accelerometer,Apds9960 0.1.20 false APDS9960 I2C proximity, light, color and gesture sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs index fa291db04a..3f2a365dfc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs @@ -18,7 +18,7 @@ public enum Address : byte /// /// Default bus address 0x68 /// - Address_Default = Address_0x68, + Default = Address_0x68, } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs index ae02d20e1b..2b7daded85 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs @@ -11,7 +11,8 @@ namespace Meadow.Foundation.Sensors.Accelerometers /// Represents a BMI270 interial measurement unit (IMU) /// public partial class Bmi270 : - PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, Units.Temperature? Temperature)> + PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, Units.Temperature? Temperature)>, + II2cPeripheral { /// /// Event raised when linear acceleration changes @@ -53,6 +54,11 @@ public partial class Bmi270 : /// public AngularVelocityRange CurrentAngularVelocityRange { get; private set; } + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs index ae1de12c0e..19e1efcb74 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs @@ -10,27 +10,6 @@ namespace Meadow.Foundation.Sensors.Motion { - // Sample Reading: - // Accel: [X:0.00,Y:-1.15,Z:10.09 (m/s^2)] - // Gyro: [X:0.00,Y:-0.06,Z:0.06 (degrees/s)] - // Compass: [X:19.38,Y:-36.75,Z:-118.25 (Tesla)] - // Gravity: [X:0.00, Y:-1.12, Z:9.74 (meters/s^2)] - // Quaternion orientation: [X:-0.06, Y:0.00, Z:0.00] - // Euler orientation: [heading: 0.00, Roll: 0.00, Pitch: 0.12] - // Linear Accel: [X:0.00, Y:-0.03, Z:0.35 (meters/s^2)] - // Temp: 33.00C - - //TODO: the sensor works great as is right now, but there's some room for - // improvement. Currently, we basically turn it on full bore and get all - // the readings. - // However, there's an opportunity here to allow users to selectively turn - // on the various features, and then in the `ReadSensor()` method we can - // check before we do the reading to see what the user has turned on. - // if the feature is turned on, we can read and parse the registers and then - // set the `Conditions.[X] = reading`, otherwise set them to `null`, since - // all the conditions are nullable. this would provide folks with an - // opportunity to use the sensor in a low or lower-power configuration. - /// /// Provide methods / properties to allow an application to control a BNO055 /// 9-axis absolute orientation sensor. @@ -48,8 +27,13 @@ public partial class Bno055 : ByteCommsSensorBase<( MagneticField3D? MagneticField3D, Quaternion? QuaternionOrientation, Acceleration3D? LinearAcceleration, Acceleration3D? GravityVector, EulerAngles? EulerOrientation, Units.Temperature? Temperature)>, - IAccelerometer, IGyroscope, ITemperatureSensor + IAccelerometer, IGyroscope, ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the acceleration value changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Hcsens0040.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Hcsens0040.cs index 60c9f138b2..9c60dcc21b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Hcsens0040.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Hcsens0040.cs @@ -4,27 +4,27 @@ namespace Meadow.Foundation.Sensors.Motion { /// - /// Create a new Hscens0040 object. + /// Create a new Hscens0040 object /// public class Hcsens0040 { /// /// Digital input port /// - private readonly IDigitalInputPort _digitalInputPort; + private readonly IDigitalInputPort digitalInputPort; /// - /// Delgate for the motion start and end events. + /// Delgate for the motion start and end events /// public delegate void MotionChange(object sender); /// - /// Event raised when motion is detected. + /// Event raised when motion is detected /// public event MotionChange OnMotionDetected; /// - /// Create a new Parallax PIR object connected to an input pin and IO Device. + /// Create a new Parallax PIR object connected to an input pin and IO Device /// /// The input pin public Hcsens0040(IPin inputPin) : @@ -32,15 +32,15 @@ public Hcsens0040(IPin inputPin) : { } /// - /// Create a new Parallax PIR object connected to a interrupt port. + /// Create a new Parallax PIR object connected to a interrupt port /// /// public Hcsens0040(IDigitalInputPort digitalInputPort) { if (digitalInputPort != null) { - _digitalInputPort = digitalInputPort; - _digitalInputPort.Changed += DigitalInputPortChanged; + this.digitalInputPort = digitalInputPort; + this.digitalInputPort.Changed += DigitalInputPortChanged; } else { @@ -49,11 +49,11 @@ public Hcsens0040(IDigitalInputPort digitalInputPort) } /// - /// Catch the PIR motion change interrupts and work out which interrupt should be raised. + /// Catch the PIR motion change interrupts and work out which interrupt should be raised /// private void DigitalInputPortChanged(object sender, DigitalPortResult e) { - if (_digitalInputPort.State == true) + if (digitalInputPort.State == true) { OnMotionDetected?.Invoke(this); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Sensors.Motion.Hcsens0040.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Sensors.Motion.Hcsens0040.csproj index da0a72f3e9..96873bbe2a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Sensors.Motion.Hcsens0040.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hcsens0040/Driver/Sensors.Motion.Hcsens0040.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.Hcsens0040 https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Motion, HCSENS0040, RCWL-0516 + Meadow,Meadow.Foundation,Motion,microwave,HCSENS0040,RCWL-0516 0.1.52 true HCSENS0040 digital microwave motion sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs index d575f8f4a0..f8af3663a7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs @@ -11,8 +11,13 @@ namespace Meadow.Foundation.Sensors.Motion /// /// This driver is untested /// - public partial class Hmc5883 : ByteCommsSensorBase + public partial class Hmc5883 : ByteCommsSensorBase, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Event to be raised when the compass changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs index 33cde6d812..fb91329216 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Sensors.Accelerometers /// Represents a LIS2MDL is a low-power, high-performance 3-axis magnetometer from STMicroelectronics /// with a fixed full range of ±50 gauss and a 16-bit resolution /// - public partial class Lis2Mdl : PollingSensorBase, IMagnetometer + public partial class Lis2Mdl : PollingSensorBase, IMagnetometer, II2cPeripheral { /// /// Event raised when magnetic field changes @@ -22,6 +22,11 @@ public partial class Lis2Mdl : PollingSensorBase, IMagnetometer /// public MagneticField3D? MagneticField3D => Conditions; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// I2C Communication bus used to communicate with the peripheral /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs index 144214ee1a..d8db61d456 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs @@ -11,7 +11,8 @@ namespace Meadow.Foundation.Sensors.Accelerometers /// Represents a LSM303AGR is a system-in-package (SiP) that combines a 3D linear acceleration sensor and a 3D magnetic sensor /// public partial class Lsm303agr : - PollingSensorBase<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>, IMagnetometer, IAccelerometer + PollingSensorBase<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>, + IMagnetometer, IAccelerometer, II2cPeripheral { /// /// Event raised when acceleration changes @@ -33,6 +34,11 @@ public partial class Lsm303agr : /// public MagneticField3D? MagneticField3D => Conditions.MagneticField3D; + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.AddressAccel_0x19; + /// /// I2C Communication bus used to communicate with the accelerometer /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs index 365cf838e9..f50b27c5af 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs @@ -7,19 +7,18 @@ namespace Meadow.Foundation.Sensors.Motion { - // TODO: Sensor is fully converted but data isn't right: - // Accel: [X:429.00,Y:-45.00,Z:-1,682.00 (m/s^2)] - // Temp: 16.00C - - // TODO: Interrupt handling is commented out - /// /// Represents the Xtrinsic MAG3110 Three-Axis, Digital Magnetometer /// public partial class Mag3110 : ByteCommsSensorBase<(MagneticField3D? MagneticField3D, Units.Temperature? Temperature)>, - ITemperatureSensor, IMagnetometer + ITemperatureSensor, IMagnetometer, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the magnetic field value changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Sensors.Motion.Mag3110.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Sensors.Motion.Mag3110.csproj index 8f528ab68f..6b62c7d7e4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Sensors.Motion.Mag3110.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Sensors.Motion.Mag3110.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.Mag3110 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, motion, magnetometer + Meadow.Foundation,motion,magnetometer,MAG3110 0.1.29 true Freescale MAG3110 I2C 3 axis magnetometer diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs index e15f566204..b732b43773 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs @@ -9,8 +9,13 @@ namespace Meadow.Foundation.Sensors.Motion /// /// Represents Mma7660fc 3-axis acclerometer /// - public partial class Mma7660fc : ByteCommsSensorBase, IAccelerometer + public partial class Mma7660fc : ByteCommsSensorBase, IAccelerometer, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when new acceleration data is processed /// @@ -38,8 +43,7 @@ public partial class Mma7660fc : ByteCommsSensorBase, IAccelerom /// I2C bus public Mma7660fc(II2cBus i2cBus, Address address = Address.Default) : this(i2cBus, (byte)address) - { - } + { } /// /// Create a new instance of the Mma7660fc communicating over the I2C interface. diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Sensors.Motion.Mma7660fc.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Sensors.Motion.Mma7660fc.csproj index 0200ea0ebd..408b1d9ed3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Sensors.Motion.Mma7660fc.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Sensors.Motion.Mma7660fc.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.Mma7660fc https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Mma7660fc, Accelerometer, Motion + Meadow.Foundation,Mma7660fc,Accelerometer,Motion 0.1.7 true Mma7660fc I2C 3-axis accelerometer diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs index a155a8c946..87d8564d38 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs @@ -11,9 +11,14 @@ namespace Meadow.Foundation.Sensors.Motion /// /// Represents the Mmc5603 Three-Axis, Digital Magnetometer /// - public partial class Mmc5603 : - ByteCommsSensorBase, IMagnetometer + public partial class Mmc5603 : ByteCommsSensorBase, + IMagnetometer, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the magnetic field value changes /// @@ -128,7 +133,7 @@ protected override Task ReadSensor() } } - BusComms.ReadRegister(Registers.OUT_X_L, ReadBuffer.Span[0..9]); //9 bytes + BusComms.ReadRegister(Registers.OUT_X_L, ReadBuffer.Span[0..9]); int x = (int)((uint)(ReadBuffer.Span[0] << 12) | (uint)(ReadBuffer.Span[1] << 4) | (uint)(ReadBuffer.Span[6] >> 4)); int y = (int)((uint)(ReadBuffer.Span[2] << 12) | (uint)(ReadBuffer.Span[3] << 4) | (uint)(ReadBuffer.Span[7] >> 4)); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs index ae081de834..14ed7773e9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs @@ -8,22 +8,18 @@ namespace Meadow.Foundation.Sensors.Motion { - // Sample reading: - // Accel: [X:0.24,Y:-0.74,Z:10.49 (m/s^2)] - // Angular Velocity: [X:-0.90, Y:-1.24, Z:-0.52 (dps)] - // Temp: 33.33C - - // TODO: this sensor has software controlled sensitivity ranges. we should - // expose them. note the `AccelScaleBase` will need to change. Right now it's - // hard coded to +-2G - /// /// Represents an MPU6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking device /// public partial class Mpu6050 : ByteCommsSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D, Units.Temperature? Temperature)>, - IAccelerometer, IGyroscope, ITemperatureSensor + IAccelerometer, IGyroscope, ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the acceration value changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.ParallaxPir/Driver/Sensors.Motion.ParallaxPir.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.ParallaxPir/Driver/Sensors.Motion.ParallaxPir.csproj index e0e2531c73..fb4171f9f6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.ParallaxPir/Driver/Sensors.Motion.ParallaxPir.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.ParallaxPir/Driver/Sensors.Motion.ParallaxPir.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Motion.ParallaxPir https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Motion, Parallax, PIR + Meadow,Meadow.Foundation,Motion,Parallax,PIR 0.8.55 true Parallax PIR analog motion sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs index 8499e92d30..97282efc17 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs @@ -9,8 +9,14 @@ namespace Meadow.Foundation.Sensors.Power /// Represents a INA260 Precision Digital Current and Power Monitor /// public partial class Ina260 - : ByteCommsSensorBase<(Units.Power? Power, Voltage? Voltage, Current? Current)> + : ByteCommsSensorBase<(Units.Power? Power, Voltage? Voltage, Current? Current)>, + II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the power value changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Sensors.Power.Ina260.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Sensors.Power.Ina260.csproj index cbbcdef956..63ec7817d2 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Sensors.Power.Ina260.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Sensors.Power.Ina260.csproj @@ -15,11 +15,8 @@ true INA260 I2C current and power monitor - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Radio.Rfid.IDxxLA/Driver/Sensors.Radio.Rfid.IDxxLA.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Radio.Rfid.IDxxLA/Driver/Sensors.Radio.Rfid.IDxxLA.csproj index ede99df4da..04bc9fc1d4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Radio.Rfid.IDxxLA/Driver/Sensors.Radio.Rfid.IDxxLA.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Radio.Rfid.IDxxLA/Driver/Sensors.Radio.Rfid.IDxxLA.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Radio.Rfid.IDxxLA https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, RFID, ID-2LA, ID-12LA, ID-20LA + Meadow,Meadow.Foundation,RFID,ID-2LA,ID-12LA,ID-20LA 0.1.50 true IDxxLA Serial radio frequency ID readers diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Sound.Ky038/Driver/Sensors.Sound.Ky038.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Sound.Ky038/Driver/Sensors.Sound.Ky038.csproj index 01d475fc6b..65775ebdcb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Sound.Ky038/Driver/Sensors.Sound.Ky038.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Sound.Ky038/Driver/Sensors.Sound.Ky038.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Sound.Ky038 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, KY-038, Sound, KY038 + Meadow.Foundation,KY-038,Sound,KY038 0.1.49 true KY-038 analog sound sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs index 7e99c2604f..c1f9ab2dc4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs @@ -8,8 +8,14 @@ namespace Meadow.Foundation.Sensors.Temperature /// /// TMP102 Temperature sensor object /// - public partial class Lm75 : ByteCommsSensorBase, ITemperatureSensor + public partial class Lm75 : ByteCommsSensorBase, + ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the value of the reading changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Sensors.Temperature.Lm75.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Sensors.Temperature.Lm75.csproj index a674695205..2f7c3327d3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Sensors.Temperature.Lm75.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Sensors.Temperature.Lm75.csproj @@ -17,11 +17,8 @@ enable Meadow.Foundation.Sensors.Temperature - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs index 0ebdf89e86..2d24dac600 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs @@ -8,8 +8,15 @@ namespace Meadow.Foundation.Sensors.Temperature /// /// Represents a Mcp960x Thermocouple sensor object /// - public abstract partial class Mcp960x : ByteCommsSensorBase<(Units.Temperature? TemperatureHot, Units.Temperature? TemperatureCold)>, ITemperatureSensor + public abstract partial class Mcp960x : + ByteCommsSensorBase<(Units.Temperature? TemperatureHot, Units.Temperature? TemperatureCold)>, + ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the Hot temperature value changes /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Registers.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Registers.cs new file mode 100644 index 0000000000..0c0c92539e --- /dev/null +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Registers.cs @@ -0,0 +1,27 @@ +namespace Meadow.Foundation.Sensors.Temperature +{ + public partial class Mcp9808 + { + internal class Registers + { + public const ushort CONFIG_SHUTDOWN = 0x0100; // shutdown config + public const ushort CONFIG_CRITLOCKED = 0x0080; // critical trip lock + public const ushort CONFIG_WINLOCKED = 0x0040; // alarm window lock + public const ushort CONFIG_INTCLR = 0x0020; // interrupt clear + public const ushort CONFIG_ALERTSTAT = 0x0010; // alert output status + public const ushort CONFIG_ALERTCTRL = 0x0008; // alert output control + public const ushort CONFIG_ALERTSEL = 0x0004; // alert output select + public const ushort CONFIG_ALERTPOL = 0x0002; // alert output polarity + public const ushort CONFIG_ALERTMODE = 0x0001; // alert output mode + + public const byte REG_CONFIG = 0x01; // config + public const byte UPPER_TEMP = 0x02; // upper alert boundary + public const byte LOWER_TEMP = 0x03; // lower alert boundery + public const byte CRIT_TEMP = 0x04; // critical temperature + public const byte AMBIENT_TEMP = 0x05; // ambient temperature + public const byte MANUFACTURER_ID = 0x06; // manufacturer ID + public const byte DEVICE_ID = 0x07; // device ID + public const byte RESOLUTION = 0x08; // resolution + } + } +} \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs index 2bc375325b..054e719c0d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs @@ -8,32 +8,19 @@ namespace Meadow.Foundation.Sensors.Temperature /// /// Represents a Mcp9808 temperature sensor /// - public partial class Mcp9808 : ByteCommsSensorBase, ITemperatureSensor + public partial class Mcp9808 : ByteCommsSensorBase, + ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the temeperature value changes /// public event EventHandler> TemperatureUpdated = delegate { }; - const ushort MCP_CONFIG_SHUTDOWN = 0x0100; // shutdown config - const ushort MCP_CONFIG_CRITLOCKED = 0x0080; // critical trip lock - const ushort MCP_CONFIG_WINLOCKED = 0x0040; // alarm window lock - const ushort MCP_CONFIG_INTCLR = 0x0020; // interrupt clear - const ushort MCP_CONFIG_ALERTSTAT = 0x0010; // alert output status - const ushort MCP_CONFIG_ALERTCTRL = 0x0008; // alert output control - const ushort MCP_CONFIG_ALERTSEL = 0x0004; // alert output select - const ushort MCP_CONFIG_ALERTPOL = 0x0002; // alert output polarity - const ushort MCP_CONFIG_ALERTMODE = 0x0001; // alert output mode - - const byte MCP_REG_CONFIG = 0x01; // config - const byte MCP_UPPER_TEMP = 0x02; // upper alert boundary - const byte MCP_LOWER_TEMP = 0x03; // lower alert boundery - const byte MCP_CRIT_TEMP = 0x04; // critical temperature - const byte MCP_AMBIENT_TEMP = 0x05; // ambient temperature - const byte MCP_MANUFACTURER_ID = 0x06; // manufacturer ID - const byte MCP_DEVICE_ID = 0x07; // device ID - const byte MCP_RESOLUTION = 0x08; // resolution - /// /// The temperature, in degrees celsius (°C), from the last reading. /// @@ -47,7 +34,7 @@ public partial class Mcp9808 : ByteCommsSensorBase, ITemperat public Mcp9808(II2cBus i2CBus, byte address = (byte)Address.Default) : base(i2CBus, address, readBufferSize: 8, writeBufferSize: 8) { - BusComms?.WriteRegister(MCP_REG_CONFIG, (ushort)0x0); + BusComms?.WriteRegister(Registers.REG_CONFIG, (ushort)0x0); } /// @@ -55,11 +42,11 @@ public Mcp9808(II2cBus i2CBus, byte address = (byte)Address.Default) /// public void Wake() { - ushort config = BusComms?.ReadRegisterAsUShort(MCP_REG_CONFIG, ByteOrder.BigEndian) ?? 0; + ushort config = BusComms?.ReadRegisterAsUShort(Registers.REG_CONFIG, ByteOrder.BigEndian) ?? 0; - config = (ushort)(config & (~MCP_CONFIG_SHUTDOWN)); + config = (ushort)(config & (~Registers.CONFIG_SHUTDOWN)); - BusComms?.WriteRegister(MCP_REG_CONFIG, config); + BusComms?.WriteRegister(Registers.REG_CONFIG, config); } /// @@ -67,9 +54,9 @@ public void Wake() /// public void Sleep() { - ushort config = BusComms?.ReadRegisterAsUShort(MCP_REG_CONFIG, ByteOrder.BigEndian) ?? 0; + ushort config = BusComms?.ReadRegisterAsUShort(Registers.REG_CONFIG, ByteOrder.BigEndian) ?? 0; - BusComms?.WriteRegister(MCP_REG_CONFIG, (ushort)(config | MCP_CONFIG_SHUTDOWN)); + BusComms?.WriteRegister(Registers.REG_CONFIG, (ushort)(config | Registers.CONFIG_SHUTDOWN)); } /// @@ -77,7 +64,7 @@ public void Sleep() /// public ushort GetDeviceId() { - return BusComms?.ReadRegisterAsUShort(MCP_DEVICE_ID, ByteOrder.BigEndian) ?? 0; + return BusComms?.ReadRegisterAsUShort(Registers.DEVICE_ID, ByteOrder.BigEndian) ?? 0; } /// @@ -85,7 +72,7 @@ public ushort GetDeviceId() /// public ushort GetManufactureId() { - return BusComms?.ReadRegisterAsUShort(MCP_MANUFACTURER_ID, ByteOrder.BigEndian) ?? 0; + return BusComms?.ReadRegisterAsUShort(Registers.MANUFACTURER_ID, ByteOrder.BigEndian) ?? 0; } /// @@ -93,7 +80,7 @@ public ushort GetManufactureId() /// public byte GetResolution() { - return BusComms?.ReadRegister(MCP_RESOLUTION) ?? 0; + return BusComms?.ReadRegister(Registers.RESOLUTION) ?? 0; } /// @@ -101,7 +88,7 @@ public byte GetResolution() /// public void SetResolution(byte resolution) { - BusComms?.WriteRegister(MCP_RESOLUTION, resolution); + BusComms?.WriteRegister(Registers.RESOLUTION, resolution); } /// @@ -110,7 +97,7 @@ public void SetResolution(byte resolution) /// The latest sensor reading protected override Task ReadSensor() { - ushort value = BusComms?.ReadRegisterAsUShort(MCP_AMBIENT_TEMP, ByteOrder.BigEndian) ?? 0; + ushort value = BusComms?.ReadRegisterAsUShort(Registers.AMBIENT_TEMP, ByteOrder.BigEndian) ?? 0; double temp = value & 0x0FFF; temp /= 16.0; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Sensors.Temperature.Thermistor.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Sensors.Temperature.Thermistor.csproj index be1c3c3c23..e662310348 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Sensors.Temperature.Thermistor.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Sensors.Temperature.Thermistor.csproj @@ -10,18 +10,15 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Temperature.Thermistor https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Temperature, Thermistor + Meadow.Foundation,Temperature,Thermistor 0.1.0 true - Thermistor temperature sensor + Thermistor analog temperature sensor enable Meadow.Foundation.Sensors.Temperature - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Thermistor.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Thermistor.cs index bd11eb6b93..3de0868fee 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Thermistor.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Thermistor/Driver/Thermistor.cs @@ -15,10 +15,11 @@ namespace Meadow.Foundation.Sensors.Temperature /// | /// +---[ TM ]--- < GND /// - public abstract class Thermistor : PollingSensorBase, ITemperatureSensor + public abstract class Thermistor : PollingSensorBase, + ITemperatureSensor { /// - /// The analog input eing used to determine output voltage of the voltage divider circuit + /// The analog input port used to determine output voltage of the voltage divider circuit /// protected IAnalogInputPort AnalogInput { get; } /// @@ -36,10 +37,10 @@ public abstract class Thermistor : PollingSensorBase, ITemper /// The analog input reading the thermistor voltage divider output protected Thermistor(IAnalogInputPort analogInput) { - this.AnalogInput = analogInput; - this.AnalogInput.StartUpdating(); + AnalogInput = analogInput; + AnalogInput.StartUpdating(); - base.Updated += (s, e) => TemperatureUpdated?.Invoke(this, e); + Updated += (s, e) => TemperatureUpdated?.Invoke(this, e); } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Sensors.Temperature.Tmp102.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Sensors.Temperature.Tmp102.csproj index 1f0fdb840d..8712d8c202 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Sensors.Temperature.Tmp102.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Sensors.Temperature.Tmp102.csproj @@ -10,18 +10,15 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Temperature.Tmp102 https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Temperature, TMP102 + Meadow.Foundation,Temperature,TMP102 0.1.53 true TMP102 I2C temperature sensor enable Meadow.Foundation.Sensors.Temperature - - 8.0 - - - 8.0 + + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs index df02f3387a..b4a7af1e39 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs @@ -1,27 +1,33 @@ -using System; -using System.Threading.Tasks; -using Meadow.Hardware; +using Meadow.Hardware; using Meadow.Peripherals.Sensors; +using System; +using System.Threading.Tasks; namespace Meadow.Foundation.Sensors.Temperature { /// /// TMP102 Temperature sensor object /// - public partial class Tmp102 : ByteCommsSensorBase, ITemperatureSensor + public partial class Tmp102 : ByteCommsSensorBase, + ITemperatureSensor, II2cPeripheral { + /// + /// The default I2C address for the peripheral + /// + public byte I2cDefaultAddress => (byte)Address.Default; + /// /// Raised when the temperature value changes /// public event EventHandler> TemperatureUpdated = delegate { }; /// - /// Backing variable for the SensorResolution property. + /// Backing variable for the SensorResolution property /// private Resolution _sensorResolution; /// - /// Get / set the resolution of the sensor. + /// Get / set the resolution of the sensor /// public Resolution SensorResolution { @@ -45,15 +51,15 @@ public Resolution SensorResolution } /// - /// The temperature from the last reading. + /// The temperature from the last reading /// public Units.Temperature? Temperature { get; protected set; } /// - /// Create a new TMP102 object using the default configuration for the sensor. + /// Create a new TMP102 object using the default configuration for the sensor /// /// The I2CBus - /// I2C address of the sensor. + /// I2C address of the sensor public Tmp102(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address, readBufferSize: 2, writeBufferSize: 2) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingAnemometer/Driver/Sensors.Weather.SwitchingAnemometer.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingAnemometer/Driver/Sensors.Weather.SwitchingAnemometer.csproj index ac62a89d80..fcddfa92cc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingAnemometer/Driver/Sensors.Weather.SwitchingAnemometer.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingAnemometer/Driver/Sensors.Weather.SwitchingAnemometer.csproj @@ -8,7 +8,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Weather.SwitchingAnemometer https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation, Weather, Wind, Switching, Anemometer + Meadow.Foundation,Weather,Wind,Switching,Anemometer 0.1.17 true Digital Switching Anemometer wind speed sensor @@ -17,7 +17,7 @@ true icon.png - 8.0 + 10.0 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingRainGauge/Driver/Sensors.Weather.SwitchingRainGauge.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingRainGauge/Driver/Sensors.Weather.SwitchingRainGauge.csproj index 33db39c2fe..9879c31c31 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingRainGauge/Driver/Sensors.Weather.SwitchingRainGauge.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.SwitchingRainGauge/Driver/Sensors.Weather.SwitchingRainGauge.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Weather.SwitchingRainGauge https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Rain, RainGauge + Meadow,Meadow.Foundation,Rain,RainGauge 0.1.7 true GPIO rain gauge sensor diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.WindVane/Driver/Sensors.Weather.WindVane.csproj b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.WindVane/Driver/Sensors.Weather.WindVane.csproj index b2238f81da..a7e91aa793 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Weather.WindVane/Driver/Sensors.Weather.WindVane.csproj +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Weather.WindVane/Driver/Sensors.Weather.WindVane.csproj @@ -10,7 +10,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Sensors.Weather.WindVane https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Wind, WindVane + Meadow,Meadow.Foundation,Wind,WindVane 0.1.22 true WindVane analog wind direction sensor diff --git a/Source/Meadow.Foundation.Peripherals/Servos.ServoCore/Driver/Servos.ServoCore.csproj b/Source/Meadow.Foundation.Peripherals/Servos.ServoCore/Driver/Servos.ServoCore.csproj index 3b9e186bce..05d9d8c047 100644 --- a/Source/Meadow.Foundation.Peripherals/Servos.ServoCore/Driver/Servos.ServoCore.csproj +++ b/Source/Meadow.Foundation.Peripherals/Servos.ServoCore/Driver/Servos.ServoCore.csproj @@ -9,7 +9,7 @@ http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ Meadow.Foundation.Servos.ServoCore https://github.com/WildernessLabs/Meadow.Foundation - Meadow, Meadow.Foundation, Servo, Meadow.Foundation.Servo + Meadow,Meadow.Foundation,Servo,Meadow.Foundation.Servo 0.8.49 true PWM generic servo controller From 6fb671fb5575da91a30682b2ac6743b9cb88899c Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 25 Apr 2023 10:50:48 -0700 Subject: [PATCH 4/5] Rename Address enum to Addresses --- .../Driver/Tea5767.Enums.cs | 2 +- .../Audio.Radio.Tea5767/Driver/Tea5767.cs | 4 +- .../Driver/CharacterDisplay.cs | 2 +- .../Driver/GroveCharacterDisplay.cs | 6 +- .../Driver/I2cCharacterDisplay.Enums.cs | 2 +- .../Driver/I2cCharacterDisplay.cs | 4 +- .../CharacterDisplay_Sample/MeadowApp.cs | 4 +- .../Displays.Sh110x/Driver/Sh110x.Enums.cs | 2 +- .../Displays.Sh110x/Driver/Sh110x.cs | 2 +- .../Samples/Sh1107_Sample/MeadowApp.cs | 2 +- .../Driver/Drivers/Ssd1306.cs | 2 +- .../Driver/Drivers/Ssd1309.cs | 2 +- .../Driver/SSd130xBase.Enums.cs | 2 +- .../Displays.Ssd130x/Driver/Ssd130xBase.cs | 2 +- .../Driver/Ads1x15Base.Enums.cs | 2 +- .../ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs | 4 +- .../ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs | 2 +- .../ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs | 2 +- .../Samples/Ads1015_Sample/MeadowApp.cs | 2 +- .../Samples/Ads1115_Sample/MeadowApp.cs | 2 +- .../Driver/At24Cxx.Enums.cs | 2 +- .../ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs | 4 +- .../Driver/Emc2101.Enums.cs | 2 +- .../Driver/Emc2101.cs | 4 +- .../Driver/As1115.Enums.cs | 2 +- .../ICs.IOExpanders.As1115/Driver/As1115.cs | 4 +- .../Driver/Ds3502.Enums.cs | 2 +- .../ICs.IOExpanders.Ds3502/Driver/Ds3502.cs | 4 +- .../Driver/Ht16k33.Enums.cs | 2 +- .../ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs | 4 +- .../Driver/Is31fl3731.Enums.cs | 2 +- .../Driver/Is31fl3731.cs | 4 +- .../Driver/Mcp23xxx.Enums.cs | 2 +- .../Driver/Mcp23xxx.cs | 2 +- .../Mcp23x08_Input_Sample/MeadowApp.cs | 2 +- .../Mcp23x17_Input_Sample/MeadowApp.cs | 2 +- .../Driver/Pca9685.Enums.cs | 2 +- .../ICs.IOExpanders.Pca9685/Driver/Pca9685.cs | 6 +- .../Samples/Pca9685_Sample/MeadowApp.cs | 2 +- .../Driver/Drivers/Sw18AB.cs | 2 +- .../Driver/SerialWombatBase.Enums.cs | 2 +- .../Driver/SerialWombatBase.cs | 6 +- .../Driver/SparkFunQwiicLEDStick.Enums.cs | 2 +- .../Driver/SparkFunQwiicLEDStick.cs | 2 +- .../Leds.Pca9633/Driver/Pca9633.Enums.cs | 2 +- .../Leds.Pca9633/Driver/Pca9633.cs | 4 +- .../RTCs.Ds1307/Driver/Ds1307.Enums.cs | 2 +- .../RTCs.Ds1307/Driver/Ds1307.cs | 26 +++---- .../RTCs.Ds323x/Driver/Ds3231.cs | 4 +- .../RTCs.Ds323x/Driver/Ds323x.Enums.cs | 2 +- .../RTCs.Ds323x/Driver/Ds323x.cs | 2 +- .../Driver/AdafruitMPRLS.Enums.cs | 2 +- .../Driver/AdafruitMPRLS.cs | 4 +- .../Driver/Bh1900Nux.Address.cs | 2 +- .../Driver/Bh1900Nux.cs | 8 +- .../Samples/Bh1900Nux_Sample/MeadowApp.cs | 2 +- .../Driver/Bme280.Address.cs | 2 +- .../Driver/Bme280.cs | 4 +- .../Samples/Bme280_Sample/MeadowApp.cs | 2 +- .../Driver/Bme68x.Enums.cs | 2 +- .../Driver/Bme68x.cs | 4 +- .../Driver/Drivers/Bme680.cs | 2 +- .../Driver/Drivers/Bme688.cs | 2 +- .../Samples/Bme680_Sample/MeadowApp.cs | 2 +- .../Samples/Bme688_Sample/MeadowApp.cs | 2 +- .../Driver/Bmp085.Enums.cs | 2 +- .../Driver/Bmp085.cs | 4 +- .../Driver/Bmp180.Enums.cs | 74 +++++++++---------- .../Driver/Bmp180.cs | 4 +- .../Driver/Ccs811.Enums.cs | 2 +- .../Driver/Ccs811.cs | 4 +- .../Driver/DhtBase.Enums.cs | 2 +- .../Driver/DhtBase.cs | 2 +- .../Driver/Drivers/Dht10.cs | 2 +- .../Driver/Drivers/Dht12.cs | 4 +- .../Driver/Hih6130.Enums.cs | 2 +- .../Driver/Hih6130.cs | 4 +- .../Driver/Drivers/Extras/Htu31d.Enums.cs | 2 +- .../Driver/Drivers/Htu21d.cs | 2 +- .../Driver/Drivers/Htu31d.cs | 2 +- .../Driver/Htux1dBase.cs | 6 +- .../Driver/Mpl3115a2.Addresses.cs | 2 +- .../Driver/Mpl3115a2.cs | 4 +- .../Driver/Ms5611.Enums.cs | 2 +- .../Driver/Ms5611.cs | 4 +- .../Driver/Sgp40.Enums.cs | 2 +- .../Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs | 4 +- .../Driver/Sht31d.Enums.cs | 2 +- .../Driver/Sht31d.cs | 4 +- .../Driver/Sht4x.Enums.cs | 2 +- .../Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs | 4 +- .../Driver/Si70xx.Enums.cs | 2 +- .../Driver/Si70xx.cs | 4 +- .../Driver/Th02.Enums.cs | 2 +- .../Sensors.Atmospheric.Th02/Driver/Th02.cs | 4 +- .../Driver/Mlx90640.Enums.cs | 2 +- .../Driver/Mlx90640.cs | 4 +- .../Driver/MaxBotix.I2c.cs | 4 +- .../Driver/MaxBotix.enums.cs | 2 +- .../Driver/Vl53l0x.Enums.cs | 2 +- .../Driver/Vl53l0x.cs | 6 +- .../Driver/Ags01Db.Enums.cs | 2 +- .../Driver/Ags01Db.cs | 4 +- .../Driver/Ens160.Enums.cs | 2 +- .../Driver/Ens160.cs | 4 +- .../Samples/Ens160_Sample/MeadowApp.cs | 2 +- .../Driver/Pmsa003i.Enums.cs | 2 +- .../Driver/Pmsa003i.cs | 4 +- .../Driver/Scd4xBase.Enums.cs | 2 +- .../Driver/Scd4xBase.cs | 4 +- .../Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs | 2 +- .../Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs | 6 +- .../Sensors.Hid.As5013/Driver/As5013.Enums.cs | 2 +- .../Sensors.Hid.As5013/Driver/As5013.cs | 4 +- .../Driver/BBQ10Keyboard.Enums.cs | 2 +- .../Driver/BBQ10Keyboard.cs | 4 +- .../Sensors.Hid.Mpr121/Driver/Mpr121.cs | 4 +- .../Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs | 2 +- .../Driver/Tsc2004.Enums.cs | 2 +- .../Sensors.Hid.Tsc2004/Driver/Tsc2004.cs | 4 +- .../Driver/Drivers/NesClassicController.cs | 2 +- .../Driver/Drivers/SnesClassicController.cs | 2 +- .../Driver/Drivers/WiiClassicController.cs | 2 +- .../Driver/Drivers/WiiClassicControllerPro.cs | 2 +- .../Driver/Drivers/WiiNunchuck.cs | 2 +- .../WiiExtensionControllerBase.Enums.cs | 2 +- .../Driver/WiiExtensionControllerBase.cs | 2 +- .../Driver/Bh1745.Addresses.cs | 2 +- .../Sensors.Light.Bh1745/Driver/Bh1745.cs | 4 +- .../Driver/Bh1750.Addresses.cs | 2 +- .../Sensors.Light.Bh1750/Driver/Bh1750.cs | 4 +- .../Driver/Max44009.Enums.cs | 2 +- .../Sensors.Light.Max44009/Driver/Max44009.cs | 4 +- .../Driver/Si1145.Addresses.cs | 2 +- .../Sensors.Light.Si1145/Driver/Si1145.cs | 4 +- .../Driver/Tsl2591.Enums.cs | 2 +- .../Sensors.Light.Tsl2591/Driver/Tsl2591.cs | 2 +- .../Driver/Veml7700.Addresses.cs | 2 +- .../Sensors.Light.Veml7700/Driver/Veml7700.cs | 4 +- .../Driver/Nau7802.Enums.cs | 2 +- .../Driver/Nau7802.cs | 10 +-- .../Driver/Drivers/Adxl345.cs | 4 +- .../Adxl345_Extras/Adxl345.Addresses.cs | 2 +- .../Driver/Apds9960.Addresses.cs | 2 +- .../Driver/Apds9960.cs | 4 +- .../Driver/Bmi270.Enums.cs | 2 +- .../Sensors.Motion.Bmi270/Driver/Bmi270.cs | 4 +- .../Driver/Bno055.Enums.cs | 2 +- .../Sensors.Motion.Bno055/Driver/Bno055.cs | 4 +- .../Driver/Hmc5883.Addresses.cs | 2 +- .../Sensors.Motion.Hmc5883/Driver/Hmc5883.cs | 4 +- .../Sensors.Motion.Hmc5883/Driver/Qmc5883.cs | 2 +- .../Driver/Lis2Mdl.Enums.cs | 2 +- .../Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs | 4 +- .../Driver/Lsm303agr.Enums.cs | 2 +- .../Driver/Lsm303agr.cs | 6 +- .../Driver/Mag3110.Addresses.cs | 2 +- .../Sensors.Motion.Mag3110/Driver/Mag3110.cs | 4 +- .../Driver/Mma7660fc.Addresses.cs | 2 +- .../Driver/Mma7660fc.cs | 4 +- .../Driver/Mmc5603.Addresses.cs | 2 +- .../Sensors.Motion.Mmc5603/Driver/Mmc5603.cs | 4 +- .../Driver/Mpu6050.Addresses.cs | 2 +- .../Sensors.Motion.Mpu6050/Driver/Mpu6050.cs | 4 +- .../Driver/Ina260.Enums.cs | 2 +- .../Sensors.Power.Ina260/Driver/Ina260.cs | 8 +- .../Driver/Lm75.Addresses.cs | 2 +- .../Sensors.Temperature.Lm75/Driver/Lm75.cs | 4 +- .../Driver/Drivers/Mcp9600.cs | 2 +- .../Driver/Drivers/Mcp9601.cs | 2 +- .../Driver/Mcp960x.Enums.cs | 2 +- .../Driver/Mcp960x.cs | 2 +- .../Driver/Mcp9808.Enums.cs | 2 +- .../Driver/Mcp9808.cs | 4 +- .../Driver/Tmp102.Addresses.cs | 2 +- .../Driver/Tmp102.cs | 4 +- 176 files changed, 303 insertions(+), 303 deletions(-) diff --git a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs index b9f3022b6c..6367d6f020 100644 --- a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.Enums.cs @@ -5,7 +5,7 @@ public partial class Tea5767 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// I2C address 0 diff --git a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs index 25a0f3b42e..066da694e5 100644 --- a/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs +++ b/Source/Meadow.Foundation.Peripherals/Audio.Radio.Tea5767/Driver/Tea5767.cs @@ -28,14 +28,14 @@ public partial class Tea5767 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new TEA5767 object using the default parameters /// /// I2Cbus connected to the radio /// Address of the bus on the I2C display. - public Tea5767(II2cBus i2cBus, byte address = (byte)Address.Default) + public Tea5767(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs index 7b0d0ea84f..22516d5426 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/CharacterDisplay.cs @@ -120,7 +120,7 @@ public CharacterDisplay( /// The number of character columns /// True if this is a Seeed Studio Grove display (default is false) public CharacterDisplay(II2cBus i2cBus, - byte address = (byte)I2cCharacterDisplay.Address.Default, + byte address = (byte)I2cCharacterDisplay.Addresses.Default, byte rows = 4, byte columns = 20, bool isGroveDisplay = false) { diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs index 4e866e909a..bcccf0c94b 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/GroveCharacterDisplay.cs @@ -1,5 +1,5 @@ -using System.Threading; -using Meadow.Hardware; +using Meadow.Hardware; +using System.Threading; namespace Meadow.Foundation.Displays.Lcd { @@ -16,7 +16,7 @@ public class GroveCharacterDisplay : I2cCharacterDisplay /// The number of character rows /// The number of character columns public GroveCharacterDisplay(II2cBus i2cBus, - byte address = (byte)Address.Address_0x3E, + byte address = (byte)Addresses.Address_0x3E, byte rows = 2, byte columns = 16) : base(i2cBus, address, rows, columns) { diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs index cef498f95a..6b44b83894 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.Enums.cs @@ -5,7 +5,7 @@ public partial class I2cCharacterDisplay /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x27 diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs index 7bfd85b652..54f5b3cae9 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Driver/I2cCharacterDisplay.cs @@ -12,7 +12,7 @@ public partial class I2cCharacterDisplay : ICharacterDisplay, II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -126,7 +126,7 @@ protected enum I2CCommands /// I2C address /// Number of character rows /// Number of character columns - public I2cCharacterDisplay(II2cBus i2cBus, byte address = (byte)Address.Default, byte rows = 4, byte columns = 20) + public I2cCharacterDisplay(II2cBus i2cBus, byte address = (byte)Addresses.Default, byte rows = 4, byte columns = 20) { i2cComms = new I2cCommunications(i2cBus, address); DisplayConfig = new TextDisplayConfig() { Width = columns, Height = rows }; diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs index c21c1dd024..5f1df27532 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Lcd.CharacterDisplay/Samples/CharacterDisplay_Sample/MeadowApp.cs @@ -63,7 +63,7 @@ void InitI2c() display = new CharacterDisplay ( i2cBus: Device.CreateI2cBus(I2cBusSpeed.Standard), - address: (byte)I2cCharacterDisplay.Address.Default, + address: (byte)I2cCharacterDisplay.Addresses.Default, rows: 4, columns: 20 ); } @@ -75,7 +75,7 @@ void InitGrove() display = new CharacterDisplay ( i2cBus: Device.CreateI2cBus(I2cBusSpeed.Standard), - address: (byte)I2cCharacterDisplay.Address.Grove, + address: (byte)I2cCharacterDisplay.Addresses.Grove, rows: 2, columns: 16, isGroveDisplay: true ); diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs index d7b51feabe..343c145196 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.Enums.cs @@ -66,7 +66,7 @@ internal enum DisplayCommand : byte /// /// Valid I2C addresses for the display /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x3C diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs index 37df60e8f8..71269a3b40 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Driver/Sh110x.cs @@ -63,7 +63,7 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// The connection type (I2C or SPI) diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs index 886038ec61..ae107cdbc0 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Sh110x/Samples/Sh1107_Sample/MeadowApp.cs @@ -20,7 +20,7 @@ public override Task Initialize() var sh1107 = new Sh1107 ( i2cBus: Device.CreateI2cBus(), - address: (byte)Address.Address_0x3C, + address: (byte)Addresses.Address_0x3C, width: 128, height: 128 ); diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs index 1452b0081f..7e2646d664 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1306.cs @@ -54,7 +54,7 @@ public Ssd1306(ISpiBus spiBus, /// Address of the bus on the I2C display. /// Type of SSD1306 display (default = 128x64 pixel display). public Ssd1306(II2cBus i2cBus, - byte address = (byte)Address.Default, + byte address = (byte)Addresses.Default, DisplayType displayType = DisplayType.OLED128x64) { this.displayType = displayType; diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs index bc2b3c1675..05e69772c8 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Drivers/Ssd1309.cs @@ -36,7 +36,7 @@ public Ssd1309(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutput /// /// I2cBus connected to display /// Address of the bus on the I2C display. - public Ssd1309(II2cBus i2cBus, byte address = (byte)Address.Default) : + public Ssd1309(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, DisplayType.OLED128x64) { } diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs index df6e4ccfc2..61e5002b9b 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/SSd130xBase.Enums.cs @@ -5,7 +5,7 @@ public abstract partial class Ssd130xBase /// /// Valid I2C addresses for the display /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x3C diff --git a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs index 87f92d6c5f..9e5fa6078d 100644 --- a/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Displays.Ssd130x/Driver/Ssd130xBase.cs @@ -53,7 +53,7 @@ public Frequency SpiBusSpeed /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// The default SPI bus mode for the device diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs index 9582fa3e17..021f84d016 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.Enums.cs @@ -5,7 +5,7 @@ public abstract partial class Ads1x15Base /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs index 29220bf38b..dc420e47b3 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Ads1x15Base.cs @@ -12,7 +12,7 @@ public abstract partial class Ads1x15Base : PollingSensorBase, II2cPeri /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -44,7 +44,7 @@ public abstract partial class Ads1x15Base : PollingSensorBase, II2cPeri /// /// protected Ads1x15Base(II2cBus i2cBus, - Address address, + Addresses address, MeasureMode mode, ChannelSetting channel) { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs index 741c0adff1..d3849baddc 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1015.cs @@ -65,7 +65,7 @@ public SampleRateSetting SampleRate /// Create a new ADS1015 object /// public Ads1015(II2cBus i2cBus, - Address address = Address.Default, + Addresses address = Addresses.Default, MeasureMode mode = MeasureMode.OneShot, ChannelSetting channel = ChannelSetting.A0A1Differential, SampleRateSetting sampleRate = SampleRateSetting.Sps1600) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs index 309bb5c367..de7efba83d 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Driver/Drivers/Ads1115.cs @@ -64,7 +64,7 @@ public SampleRateSetting SampleRate /// Create a new ADS1115 object /// public Ads1115(II2cBus i2cBus, - Address address = Address.Default, + Addresses address = Addresses.Default, MeasureMode mode = MeasureMode.OneShot, ChannelSetting channel = ChannelSetting.A0A1Differential, SampleRateSetting sampleRate = SampleRateSetting.Sps128) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs index 5d8d9987cd..9f3bd1e77a 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1015_Sample/MeadowApp.cs @@ -18,7 +18,7 @@ public override async Task Initialize() adc = new Ads1015( Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.FastPlus), - Ads1x15Base.Address.Default, + Ads1x15Base.Addresses.Default, Ads1x15Base.MeasureMode.Continuous, Ads1x15Base.ChannelSetting.A0SingleEnded, Ads1015.SampleRateSetting.Sps3300); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs index 1d64320625..f85f76cec8 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.ADC.Ads1x15/Samples/Ads1115_Sample/MeadowApp.cs @@ -18,7 +18,7 @@ public override async Task Initialize() adc = new Ads1115( Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.FastPlus), - Ads1x15Base.Address.Default, + Ads1x15Base.Addresses.Default, Ads1x15Base.MeasureMode.Continuous, Ads1x15Base.ChannelSetting.A0SingleEnded, Ads1115.SampleRateSetting.Sps128); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs index af7249c858..25dd0945d6 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.Enums.cs @@ -5,7 +5,7 @@ public partial class At24Cxx /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x50 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs index ad7dde192a..75cd6881bb 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.EEPROM.At24Cxx/Driver/At24Cxx.cs @@ -12,7 +12,7 @@ public partial class At24Cxx : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -40,7 +40,7 @@ public partial class At24Cxx : II2cPeripheral /// Number of bytes in a page (default = 32 - AT24C32). /// Total number of bytes in the EEPROM (default = 8192 - AT24C32). public At24Cxx(II2cBus i2cBus, - byte address = (byte)Address.Default, + byte address = (byte)Addresses.Default, ushort pageSize = 32, ushort memorySize = 8192) { diff --git a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs index d5255c21f1..cd4a0c7131 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.Enums.cs @@ -137,7 +137,7 @@ public enum DataRate : byte /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x4C diff --git a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs index aec5e2af8f..80d2837a81 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.FanControllers.Emc2101/Driver/Emc2101.cs @@ -46,7 +46,7 @@ public partial class Emc2101 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Get/Set the minimum fan speed for the currently connected fan @@ -156,7 +156,7 @@ public bool DACOutputEnabled /// /// I2CBus connected to display /// Address of the EMC2101 (default = 0x4C) - public Emc2101(II2cBus i2cBus, byte address = (byte)Address.Default) + public Emc2101(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs index 6b1ed4301b..b42572fdb6 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.Enums.cs @@ -5,7 +5,7 @@ public partial class As1115 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x00 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs index be521facc8..c6f1687e7a 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.As1115/Driver/As1115.cs @@ -48,7 +48,7 @@ public partial class As1115 : IGraphicsDisplay, II2cPeripheral, IDisposable /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// The display color mode (1 bit per pixel) @@ -100,7 +100,7 @@ public partial class As1115 : IGraphicsDisplay, II2cPeripheral, IDisposable /// Interrupt pin /// Address of the bus on the I2C display. public As1115(II2cBus i2cBus, IPin buttonInterruptPin, - byte address = (byte)Address.Default) + byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs index 63ac3ffe32..0e792d0c31 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.Enums.cs @@ -6,7 +6,7 @@ public partial class Ds3502 /// Valid I2C addresses for the sensor /// Controlled by pulling A0 and A1 high or low /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x28 (A0 low, A1 low) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs index 2d2d997da1..5e7f635095 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ds3502/Driver/Ds3502.cs @@ -12,7 +12,7 @@ public partial class Ds3502 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Default I2C bus speed @@ -29,7 +29,7 @@ public partial class Ds3502 : II2cPeripheral /// /// Address of the bus on the I2C display /// I2C bus instance - public Ds3502(II2cBus i2cBus, byte address = (byte)Address.Default) + public Ds3502(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs index 8b644dad3e..e97b83d3b6 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.Enums.cs @@ -7,7 +7,7 @@ public partial class Ht16k33 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x70 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs index e574db66de..4527c4c926 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ht16k33/Driver/Ht16k33.cs @@ -11,7 +11,7 @@ public partial class Ht16k33 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -33,7 +33,7 @@ public partial class Ht16k33 : II2cPeripheral /// /// Address of the bus on the I2C display /// I2C bus instance - public Ht16k33(II2cBus i2cBus, byte address = (byte)Address.Default) + public Ht16k33(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address, 8, 17); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs index ca73c3baad..fb7d64b86d 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.Enums.cs @@ -5,7 +5,7 @@ public partial class Is31fl3731 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x74 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs index 0e59c5f8e3..4414a9f443 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Is31fl3731/Driver/Is31fl3731.cs @@ -25,7 +25,7 @@ public partial class Is31fl3731 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -42,7 +42,7 @@ public partial class Is31fl3731 : II2cPeripheral /// /// The I2C bus /// The I2C address - public Is31fl3731(II2cBus i2cBus, byte address = (byte)Address.Default) + public Is31fl3731(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); Frame = 0; diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs index 7ae7a2e874..972ef67f6a 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.Enums.cs @@ -5,7 +5,7 @@ public partial class Mcp23xxx /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x20 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs index 906c2830d8..5b44a9b0d6 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Driver/Mcp23xxx.cs @@ -55,7 +55,7 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; private readonly IByteCommunications mcpDevice; private IDigitalOutputPort resetPort; diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs index 922c56bbc4..db00ba212b 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x08_Input_Sample/MeadowApp.cs @@ -24,7 +24,7 @@ public override Task Initialize() IDigitalInputPort interruptPort = Device.CreateDigitalInputPort(Device.Pins.D00, InterruptMode.EdgeBoth, ResistorMode.InternalPullDown); IDigitalOutputPort resetPort = Device.CreateDigitalOutputPort(Device.Pins.D01); - mcp = new Mcp23008(Device.CreateI2cBus(), (byte)Address.Address_0x20, interruptPort, resetPort); + mcp = new Mcp23008(Device.CreateI2cBus(), (byte)Addresses.Address_0x20, interruptPort, resetPort); return base.Initialize(); } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs index 5c534cde33..4ee0acb267 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Mcp23xxx/Samples/Mcp23x17_Input_Sample/MeadowApp.cs @@ -23,7 +23,7 @@ public override Task Initialize() IDigitalInputPort interruptPort = Device.CreateDigitalInputPort(Device.Pins.D00, InterruptMode.EdgeBoth, ResistorMode.InternalPullDown); IDigitalOutputPort resetPort = Device.CreateDigitalOutputPort(Device.Pins.D01); - mcp = new Mcp23017(Device.CreateI2cBus(), (byte)Address.Address_0x20, interruptPort, resetPort); + mcp = new Mcp23017(Device.CreateI2cBus(), (byte)Addresses.Address_0x20, interruptPort, resetPort); mcp.InputChanged += Mcp_InputChanged; diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs index 7565486850..4d14780ab3 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.Enums.cs @@ -5,7 +5,7 @@ public partial class Pca9685 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs index 58389192cc..ec4e9c4148 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs @@ -14,7 +14,7 @@ public partial class Pca9685 /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte I2cDefaultAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -59,7 +59,7 @@ public partial class Pca9685 /// The I2C bus connected to the peripheral /// The frequency /// The I2C address - public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Address.Default) + public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Addresses.Default) { i2CBus = i2cBus; this.address = address; @@ -72,7 +72,7 @@ public Pca9685(II2cBus i2cBus, Frequency frequency, byte address = (byte)Address /// /// The I2C bus connected to the peripheral /// The I2C address - public Pca9685(II2cBus i2cBus, byte address = (byte)Address.Default) + public Pca9685(II2cBus i2cBus, byte address = (byte)Addresses.Default) : this(i2cBus, new Frequency(IPwmOutputController.DefaultPwmFrequency, Frequency.UnitType.Hertz), address) { } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs index 4949a83f2f..99d4de22d0 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Samples/Pca9685_Sample/MeadowApp.cs @@ -17,7 +17,7 @@ public override Task Initialize() Resolver.Log.Info("Initialize..."); var i2CBus = Device.CreateI2cBus(I2cBusSpeed.FastPlus); - pca9685 = new Pca9685(i2CBus, new Meadow.Units.Frequency(50, Meadow.Units.Frequency.UnitType.Hertz), (byte)Pca9685.Address.Default); + pca9685 = new Pca9685(i2CBus, new Meadow.Units.Frequency(50, Meadow.Units.Frequency.UnitType.Hertz), (byte)Pca9685.Addresses.Default); pca9685.Initialize(); return base.Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/Drivers/Sw18AB.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/Drivers/Sw18AB.cs index a25be8f709..fe49cf9453 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/Drivers/Sw18AB.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/Drivers/Sw18AB.cs @@ -14,7 +14,7 @@ public class Sw18AB : SerialWombatBase /// The I2C bus connected to the wombat /// The I2C address /// Meadow logger (optional) - public Sw18AB(II2cBus i2cBus, Address address = SerialWombatBase.Address.Default, Logger? logger = null) + public Sw18AB(II2cBus i2cBus, Addresses address = SerialWombatBase.Addresses.Default, Logger? logger = null) : base(i2cBus, address, logger) { } } diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs index 3099d7df41..451357bbed 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.Enums.cs @@ -8,7 +8,7 @@ public partial class SerialWombatBase /// /// Valid I2C addresses for the device /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x6a diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs index e24ed96e8c..30e3269545 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.SerialWombat/Driver/SerialWombatBase.cs @@ -20,12 +20,12 @@ public abstract partial class SerialWombatBase : IDigitalInputOutputController, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// The current I2C address for the peripheral /// - public Address I2cAddress { get; } + public Addresses I2cAddress { get; } /// /// The sync root object @@ -40,7 +40,7 @@ public abstract partial class SerialWombatBase : IDigitalInputOutputController, /// /// Create SerialWombatBase object /// - protected SerialWombatBase(II2cBus bus, Address address = Address.Default, Logger? logger = null) + protected SerialWombatBase(II2cBus bus, Addresses address = Addresses.Default, Logger? logger = null) { Pins = new PinDefinitions(this); i2cBus = bus; diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs index fb96c2533c..d64f842745 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.Enums.cs @@ -5,7 +5,7 @@ public partial class SparkFunQwiicLEDStick /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x22 diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs index db08a83977..a805fe621b 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Apa102/Driver/SparkFunQwiicLEDStick.cs @@ -24,7 +24,7 @@ public partial class SparkFunQwiicLEDStick : I2cCommunications, IApa102 /// The I2C bus /// The I2C address public SparkFunQwiicLEDStick(II2cBus i2cbus, - byte address = (byte)Address.Default) + byte address = (byte)Addresses.Default) : base(i2cbus, address, 1, 16) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs index d6b342173b..2a0fb8a64a 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.Enums.cs @@ -5,7 +5,7 @@ public partial class Pca9633 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x62 diff --git a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs index 13960c8018..e421033edc 100644 --- a/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs +++ b/Source/Meadow.Foundation.Peripherals/Leds.Pca9633/Driver/Pca9633.cs @@ -10,7 +10,7 @@ public partial class Pca9633 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -45,7 +45,7 @@ public bool IsOn /// /// i2c bus /// i2c address - public Pca9633(II2cBus i2cBus, Address address = Address.Default) + public Pca9633(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs index 860efd6aaf..2a5c0a459c 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.Enums.cs @@ -5,7 +5,7 @@ public partial class Ds1307 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs index acbbc09c19..82f2fdbec8 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds1307/Driver/Ds1307.cs @@ -12,7 +12,7 @@ public partial class Ds1307 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; const int OriginYear = 1980; @@ -36,15 +36,15 @@ public bool IsRunning get { // read 1 byte starting from 0x00 var reg = new byte[1]; - i2cBus.Write((byte)Address.Default, new byte[] { 0 }); - i2cBus.Read((byte)Address.Default, reg); + i2cBus.Write((byte)Addresses.Default, new byte[] { 0 }); + i2cBus.Read((byte)Addresses.Default, reg); return (reg[0] & (1 << 7)) != 0; } set { // read the seconds register var reg = new byte[1]; - i2cBus.Write((byte)Address.Default, new byte[] { 0 }); - i2cBus.Read((byte)Address.Default, reg); + i2cBus.Write((byte)Addresses.Default, new byte[] { 0 }); + i2cBus.Read((byte)Addresses.Default, reg); var current = (reg[0] & (1 << 7)) != 0; if ((value && current) || (!value && !current)) return; @@ -59,7 +59,7 @@ public bool IsRunning } // and write it back to register 0x00 - i2cBus.Write((byte)Address.Default, reg); + i2cBus.Write((byte)Addresses.Default, reg); } } @@ -70,8 +70,8 @@ public bool IsRunning public DateTime GetTime() { var data = new byte[7]; - i2cBus.Write((byte)Address.Default, new byte[] { 0 }); - i2cBus.Read((byte)Address.Default, data); + i2cBus.Write((byte)Addresses.Default, new byte[] { 0 }); + i2cBus.Read((byte)Addresses.Default, data); return FromRTCTime(data); } @@ -84,7 +84,7 @@ public void SetTime(DateTime time) var data = new List { 0 }; data.AddRange(ToRTCTime(time)); - i2cBus.Write((byte)Address.Default, data.ToArray()); + i2cBus.Write((byte)Addresses.Default, data.ToArray()); } /// @@ -95,8 +95,8 @@ public void SetTime(DateTime time) public byte[] ReadRAM(int offset, int count) { var data = new byte[count]; - i2cBus.Write((byte)Address.Default, new byte[] { (byte)(0x08 + offset) }); - i2cBus.Read((byte)Address.Default, data); + i2cBus.Write((byte)Addresses.Default, new byte[] { (byte)(0x08 + offset) }); + i2cBus.Read((byte)Addresses.Default, data); return data; } @@ -114,7 +114,7 @@ public void WriteRAM(int offset, params byte[] data) }; d.AddRange(data); - i2cBus.Write((byte)Address.Default, d.ToArray()); + i2cBus.Write((byte)Addresses.Default, d.ToArray()); } /// @@ -136,7 +136,7 @@ public void SquareWaveOutput(SquareWaveFrequency freq) }; // control register is at 0x07 - i2cBus.Write((byte)Address.Default, new byte[] { 0x07, registerData }); //register and value + i2cBus.Write((byte)Addresses.Default, new byte[] { 0x07, registerData }); //register and value } static byte ToBCD(ushort i) diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs index 0f04cc3894..c4dc836559 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds3231.cs @@ -13,7 +13,7 @@ public partial class Ds3231 : Ds323x /// Digital pin connected to the alarm interrupt pin on the RTC. /// The I2C Bus the peripheral is connected to /// I2C Bus address of the peripheral - public Ds3231(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Address.Default) + public Ds3231(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Addresses.Default) : base(new I2cCommunications(i2cBus, address), interruptPin) { } @@ -26,7 +26,7 @@ public Ds3231(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Add public Ds3231( II2cBus i2cBus, IDigitalInputPort interruptPort = null, - byte address = (byte)Address.Default) + byte address = (byte)Addresses.Default) : base(new I2cCommunications(i2cBus, address), interruptPort) { } diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs index c71faca891..ff5a192471 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.Enums.cs @@ -5,7 +5,7 @@ public partial class Ds323x /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs index 125762c13e..1a7e8ab4b8 100644 --- a/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs +++ b/Source/Meadow.Foundation.Peripherals/RTCs.Ds323x/Driver/Ds323x.cs @@ -12,7 +12,7 @@ public partial class Ds323x : II2cPeripheral, IDisposable /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Number of registers that hold the date and time information. diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs index 938279f327..f0cf2c078f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.Enums.cs @@ -5,7 +5,7 @@ public partial class AdafruitMPRLS /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x18 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs index ee53e52cbe..af9fa08623 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.AdafruitMPRLS/Driver/AdafruitMPRLS.cs @@ -18,7 +18,7 @@ public partial class AdafruitMPRLS : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when a new reading has been made. Events will only be raised @@ -67,7 +67,7 @@ public partial class AdafruitMPRLS : /// /// I2Cbus connected to the sensor public AdafruitMPRLS(II2cBus i2cbus) - : base(i2cbus, (byte)Address.Default) + : base(i2cbus, (byte)Addresses.Default) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs index 39c753e429..7ab8d4ff68 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.Address.cs @@ -58,7 +58,7 @@ public enum MeasurementModes /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs index f94f5f200c..1026a6e232 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Driver/Bh1900Nux.cs @@ -23,17 +23,17 @@ public partial class Bh1900Nux : ByteCommsSensorBase, ITemper /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Bh1900Nux object /// /// The I2C bus /// The I2C address - public Bh1900Nux(II2cBus i2cBus, Address address) + public Bh1900Nux(II2cBus i2cBus, Addresses address) : base(i2cBus, (byte)address, 2, 2) { - if (address < Address.Address_0x48 || address > Address.Address_0x4f) + if (address < Addresses.Address_0x48 || address > Addresses.Address_0x4f) { throw new ArgumentOutOfRangeException("Bh1900Nux address must be in the range of 0x48-0x4f"); } @@ -47,7 +47,7 @@ public Bh1900Nux(II2cBus i2cBus, Address address) /// The I2C bus /// The I2C address public Bh1900Nux(II2cBus i2cBus, byte address) - : this(i2cBus, (Address)address) + : this(i2cBus, (Addresses)address) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Samples/Bh1900Nux_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Samples/Bh1900Nux_Sample/MeadowApp.cs index d3c1476524..e3b76d4bab 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Samples/Bh1900Nux_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bh1900Nux/Samples/Bh1900Nux_Sample/MeadowApp.cs @@ -17,7 +17,7 @@ public override Task Initialize() { Resolver.Log.Info("Initializing..."); - _sensor = new Bh1900Nux(Device.CreateI2cBus(), Bh1900Nux.Address.Default); + _sensor = new Bh1900Nux(Device.CreateI2cBus(), Bh1900Nux.Addresses.Default); var consumer = Bh1900Nux.CreateObserver( handler: result => diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs index 697ca6d99b..d252eafac3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.Address.cs @@ -5,7 +5,7 @@ public partial class Bme280 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x76 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs index 227a1e3e9e..0b841337f8 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Driver/Bme280.cs @@ -122,14 +122,14 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Initializes a new instance of the BME280 class /// /// I2C Bus to use for communicating with the sensor /// I2C address of the sensor (default = 0x77) - public Bme280(II2cBus i2cBus, byte address = (byte)Address.Default) + public Bme280(II2cBus i2cBus, byte address = (byte)Addresses.Default) { bme280Comms = new I2cCommunications(i2cBus, address); configuration = new Configuration(); // here to avoid the warning diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs index 1d769b5619..5aea2e58a6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme280/Samples/Bme280_Sample/MeadowApp.cs @@ -75,7 +75,7 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME280 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme280(i2c, (byte)Bme280.Address.Default); // SDA pulled up + sensor = new Bme280(i2c, (byte)Bme280.Addresses.Default); // SDA pulled up } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs index 6d52a1dfc9..cd479c7b00 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.Enums.cs @@ -5,7 +5,7 @@ partial class Bme68x /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x77 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs index 7310c72984..6a7f3c4f0c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Bme68x.cs @@ -186,7 +186,7 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Communication bus used to read and write to the BME68x sensor @@ -234,7 +234,7 @@ public SpiClockConfiguration.Mode SpiBusMode /// /// I2C Bus to use for communicating with the sensor /// I2C address - protected Bme68x(II2cBus i2cBus, byte address = (byte)Address.Default) + protected Bme68x(II2cBus i2cBus, byte address = (byte)Addresses.Default) { configuration = new Configuration(); busComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs index 8b353ab26b..5024dc58e4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme680.cs @@ -15,7 +15,7 @@ public partial class Bme680 : Bme68x /// /// I2C Bus to use for communicating with the busComms /// I2C address of the busComms - public Bme680(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) + public Bme680(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs index 7c951f29c2..388dc6e385 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Driver/Drivers/Bme688.cs @@ -15,7 +15,7 @@ public partial class Bme688 : Bme68x /// /// I2C Bus to use for communicating with the busComms /// I2C address of the busComms - public Bme688(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) + public Bme688(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs index 56c21b7bdb..a8cdef775a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme680_Sample/MeadowApp.cs @@ -89,7 +89,7 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME680 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme680(i2c, (byte)Bme688.Address.Address_0x76); + sensor = new Bme680(i2c, (byte)Bme688.Addresses.Address_0x76); } async Task ReadConditions() diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs index 7981d2de9b..176ee63502 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bme68x/Samples/Bme688_Sample/MeadowApp.cs @@ -90,7 +90,7 @@ void CreateI2CSensor() Resolver.Log.Info("Create BME688 sensor with I2C..."); var i2c = Device.CreateI2cBus(); - sensor = new Bme688(i2c, (byte)Bme688.Address.Address_0x76); + sensor = new Bme688(i2c, (byte)Bme688.Addresses.Address_0x76); } async Task ReadConditions() diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs index 0c65e8b5e1..d7c56df4b7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.Enums.cs @@ -5,7 +5,7 @@ public partial class Bmp085 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x77 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs index 493cb678a3..c1dc593e84 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp085/Driver/Bmp085.cs @@ -27,7 +27,7 @@ public partial class Bmp085 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; readonly byte oversamplingSetting; @@ -65,7 +65,7 @@ public partial class Bmp085 : /// The I2C bus /// The I2C address /// The device mode - public Bmp085(II2cBus i2cBus, byte address = (byte)Address.Default, + public Bmp085(II2cBus i2cBus, byte address = (byte)Addresses.Default, DeviceMode deviceMode = DeviceMode.Standard) : base(i2cBus, address) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs index f082b80018..8dd4755e8a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.Enums.cs @@ -2,42 +2,42 @@ { public partial class Bmp180 { - /// - /// Valid I2C addresses for the sensor - /// - public enum Address : byte - { - /// - /// Bus address 0x77 - /// - Address_0x77 = 0x77, - /// - /// Default bus address - /// - Default = Address_0x77 - } + /// + /// Valid I2C addresses for the sensor + /// + public enum Addresses : byte + { + /// + /// Bus address 0x77 + /// + Address_0x77 = 0x77, + /// + /// Default bus address + /// + Default = Address_0x77 + } - /// - /// BMP180 device mode - /// - public enum DeviceMode - { - /// - /// Ultra low power mode - /// - UltraLowPower = 0, - /// - /// Standard / normal mode - /// - Standard = 1, - /// - /// High resolution mode - /// - HighResolution = 2, - /// - /// Ultra high resolution mode - /// - UltraHighResolution = 3 - } - } + /// + /// BMP180 device mode + /// + public enum DeviceMode + { + /// + /// Ultra low power mode + /// + UltraLowPower = 0, + /// + /// Standard / normal mode + /// + Standard = 1, + /// + /// High resolution mode + /// + HighResolution = 2, + /// + /// Ultra high resolution mode + /// + UltraHighResolution = 3 + } + } } \ No newline at end of file diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs index b8709a5a66..45b4b686fa 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Bmp180/Driver/Bmp180.cs @@ -60,7 +60,7 @@ public partial class Bmp180 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new BMP180 object @@ -68,7 +68,7 @@ public partial class Bmp180 : /// The I2C bus /// The I2C address /// The device mode - public Bmp180(II2cBus i2cBus, byte address = (byte)Address.Default, + public Bmp180(II2cBus i2cBus, byte address = (byte)Addresses.Default, DeviceMode deviceMode = DeviceMode.Standard) : base(i2cBus, address) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs index d8949873a0..fe5fe1dffd 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.Enums.cs @@ -5,7 +5,7 @@ public partial class Ccs811 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x5A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs index 2d6dacef27..93cbc51566 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ccs811/Driver/Ccs811.cs @@ -42,14 +42,14 @@ public partial class Ccs811 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Ccs811 object /// /// The I2C bus /// The I2C address - public Ccs811(II2cBus i2cBus, Address address = Address.Default) + public Ccs811(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs index a146b53e5a..75422d5c88 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.Enums.cs @@ -10,7 +10,7 @@ public abstract partial class DhtBase /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x5C diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs index e8fd10969b..f1c2f21b64 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/DhtBase.cs @@ -46,7 +46,7 @@ public abstract partial class DhtBase : /// /// The I2C bus connected to the sensor /// The I2C address - public DhtBase(II2cBus i2cBus, byte address = (byte)Address.Default) + public DhtBase(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, writeBufferSize: 8, readBufferSize: 6) { protocol = BusType.I2C; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs index d6547beec9..f10e36019f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht10.cs @@ -20,7 +20,7 @@ public class Dht10 : DhtBase /// /// Address of the Dht12 (default = 0x27). /// I2C bus (default = 100 KHz). - public Dht10(II2cBus i2cBus, byte address = (byte)Address.Default) + public Dht10(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { BusComms?.Write(CMD_SOFTRESET); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs index 2ac93361b9..36818a7258 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Dhtxx/Driver/Drivers/Dht12.cs @@ -13,14 +13,14 @@ public class Dht12 : DhtBase, II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Dht12 object /// /// Address of the Dht12 (default = 0x27) /// I2C bus (default = 100 KHz) - public Dht12(II2cBus i2cBus, byte address = (byte)Address.Default) + public Dht12(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs index 67d4e73c41..c087fed902 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.Enums.cs @@ -5,7 +5,7 @@ public partial class Hih6130 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x27 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs index 6264a7ed4b..3a4510fb9d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Hih6130/Driver/Hih6130.cs @@ -36,14 +36,14 @@ public partial class Hih6130 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new HIH6130 object using the default parameters for the component. /// /// Address of the HIH6130 (default = 0x27). /// I2C bus (default = 100 KHz). - public Hih6130(II2cBus i2cBus, byte address = (byte)Address.Default) + public Hih6130(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 4, writeBufferSize: 4) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs index 2ee2a25d19..d8e3e61c56 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Extras/Htu31d.Enums.cs @@ -5,7 +5,7 @@ public partial class Htu31d /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs index c0275d6735..df61f72e6c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu21d.cs @@ -24,7 +24,7 @@ public partial class Htu21d : Htux1dBase /// Sensor address (default to 0x40) /// I2CBus (default to 100 KHz) /// Update interval, defaults to 1 sec if null - public Htu21d(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) + public Htu21d(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, updateInterval) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs index 997abfcc08..c8cd0cdd4c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Drivers/Htu31d.cs @@ -19,7 +19,7 @@ public partial class Htu31d : Htux1dBase /// Sensor address (default to 0x40). /// I2CBus (default to 100 KHz). /// Update interval, defaults to 1 sec if null - public Htu31d(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) + public Htu31d(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, updateInterval) { SerialNumber = GetSerial(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs index 8743e6bb5b..b8b530164b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Htu2xd/Driver/Htux1dBase.cs @@ -9,7 +9,7 @@ namespace Meadow.Foundation.Sensors.Atmospheric /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 @@ -41,7 +41,7 @@ public abstract class Htux1dBase : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Default I2C bus speed @@ -69,7 +69,7 @@ public abstract class Htux1dBase : /// /// /// - public Htux1dBase(II2cBus i2cBus, byte address = (byte)Address.Default, TimeSpan? updateInterval = null) + public Htux1dBase(II2cBus i2cBus, byte address = (byte)Addresses.Default, TimeSpan? updateInterval = null) : base(i2cBus, address, (int)(updateInterval == null ? 1000 : updateInterval.Value.TotalMilliseconds)) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs index 6472489bda..76a03b1658 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mpl3115a2 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs index 55a04c2183..284a7281e6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Mpl3115a2/Driver/Mpl3115a2.cs @@ -66,14 +66,14 @@ public bool Standby /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new MPL3115A2 object with the default address and speed settings /// /// Address of the sensor (default = 0x60) /// I2cBus (Maximum is 400 kHz) - public Mpl3115a2(II2cBus i2cBus, byte address = (byte)Address.Default) + public Mpl3115a2(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { if (BusComms?.ReadRegister(Registers.WhoAmI) != 0xc4) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs index f8741d1775..97688decd5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.Enums.cs @@ -5,7 +5,7 @@ public partial class Ms5611 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x5C diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs index 454f654389..910600ab03 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Ms5611/Driver/Ms5611.cs @@ -37,7 +37,7 @@ public partial class Ms5611 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -52,7 +52,7 @@ public partial class Ms5611 : /// The I2C bus connected to the device /// I2c address - default is 0x5c /// - public Ms5611(II2cBus i2cBus, byte address = (byte)Address.Default, Resolution resolution = Resolution.OSR_1024) + public Ms5611(II2cBus i2cBus, byte address = (byte)Addresses.Default, Resolution resolution = Resolution.OSR_1024) { i2cComms = new I2cCommunications(i2cBus, address); this.resolution = resolution; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs index 2ba15fd25b..6cfe42ba6e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.Enums.cs @@ -7,7 +7,7 @@ public partial class Sgp40 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x59 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs index bee0b84c53..b53405a698 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sgp40/Driver/Sgp40.cs @@ -28,7 +28,7 @@ public partial class Sgp40 : ByteCommsSensorBase, II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; private byte[]? compensationData = null; @@ -37,7 +37,7 @@ public partial class Sgp40 : ByteCommsSensorBase, II2cPeripheral /// /// Sensor address (default to 0x40). /// I2CBus. - public Sgp40(II2cBus i2cBus, byte address = (byte)Address.Default) + public Sgp40(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, 9, 8) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs index 0387718a94..45e166d7ef 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.Enums.cs @@ -5,7 +5,7 @@ public partial class Sht31d /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs index ce8b4aa2c0..ba269dba85 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht31D/Driver/Sht31d.cs @@ -36,14 +36,14 @@ public partial class Sht31d : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new SHT31D object /// /// Sensor address (should be 0x44 or 0x45) /// I2cBus (0-1000 KHz). - public Sht31d(II2cBus i2cBus, byte address = (byte)Address.Default) + public Sht31d(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 6, writeBufferSize: 2) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs index a6fc00ae97..182b23105a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.Enums.cs @@ -5,7 +5,7 @@ public partial class Sht4x /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x44 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs index 8ce85f97af..888cab9f6d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Sht4x/Driver/Sht4x.cs @@ -42,14 +42,14 @@ public partial class Sht4x : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new SHT4x object /// /// Sensor address /// I2cBus - public Sht4x(II2cBus i2cBus, byte address = (byte)Address.Default) + public Sht4x(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 6, writeBufferSize: 2) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs index 1d513a3a11..9ccc39f6fb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.Enums.cs @@ -5,7 +5,7 @@ public partial class Si70xx /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs index bd40088925..97825e052e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Si70xx/Driver/Si70xx.cs @@ -55,14 +55,14 @@ public partial class Si70xx : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new SI7021 temperature and humidity sensor /// /// I2CBus /// I2C address (default to 0x40) - public Si70xx(II2cBus i2cBus, byte address = (byte)Address.Default) + public Si70xx(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, 8, 3) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs index 808cdd67bf..a6b4a83752 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.Enums.cs @@ -5,7 +5,7 @@ public partial class Th02 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs index b5c8964c4f..a6df4dbe01 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Atmospheric.Th02/Driver/Th02.cs @@ -38,13 +38,13 @@ public partial class Th02 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Provide a mechanism for reading the temperature and humidity from /// a Th02 temperature / humidity sensor /// - public Th02(II2cBus i2cBus, byte address = (byte)Address.Default) + public Th02(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs index 7ba82f90ac..45091d733b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.Enums.cs @@ -5,7 +5,7 @@ public partial class Mlx90640 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x33 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs index d915d7729f..8684713fc8 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Camera.Mlx90640/Driver/Mlx90640.cs @@ -56,7 +56,7 @@ public float Emissivity /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -72,7 +72,7 @@ public float Emissivity /// I2C address /// Emissivity public Mlx90640(II2cBus i2cBus, - byte address = (byte)Address.Default, + byte address = (byte)Addresses.Default, float emissivity = 0.95f) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs index 11b70f3160..a120826d69 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.I2c.cs @@ -9,7 +9,7 @@ public partial class MaxBotix : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Creates a new MaxBotix object communicating over I2C @@ -17,7 +17,7 @@ public partial class MaxBotix : II2cPeripheral /// The I2C bus /// The distance sensor type /// The I2C address - public MaxBotix(II2cBus i2cBus, SensorType sensor, byte address = (byte)Address.Default) + public MaxBotix(II2cBus i2cBus, SensorType sensor, byte address = (byte)Addresses.Default) : base(i2cBus, address) { sensorType = sensor; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs index c207c68e9e..1bc972d847 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.MaxBotix/Driver/MaxBotix.enums.cs @@ -5,7 +5,7 @@ public partial class MaxBotix /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x70 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs index eee6940213..00eba29ad0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.Enums.cs @@ -8,7 +8,7 @@ public partial class Vl53l0x /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x29 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs index 1c78354e37..73e5772ada 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Distance.Vl53l0x/Driver/Vl53l0x.cs @@ -53,7 +53,7 @@ public bool IsShutdown /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; readonly IDigitalOutputPort shutdownPort; @@ -64,7 +64,7 @@ public bool IsShutdown /// /// I2C bus /// I2C address - public Vl53l0x(II2cBus i2cBus, byte address = (byte)Address.Default) + public Vl53l0x(II2cBus i2cBus, byte address = (byte)Addresses.Default) : this(i2cBus, null, address) { } @@ -75,7 +75,7 @@ public Vl53l0x(II2cBus i2cBus, byte address = (byte)Address.Default) /// Shutdown pin /// VL53L0X address - public Vl53l0x(II2cBus i2cBus, IPin shutdownPin, byte address = (byte)Address.Default) + public Vl53l0x(II2cBus i2cBus, IPin shutdownPin, byte address = (byte)Addresses.Default) : base(i2cBus, address) { if (shutdownPin != null) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs index 6067121ae9..dd97bda25a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.Enums.cs @@ -10,7 +10,7 @@ public partial class Ags01Db /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x11 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs index 1fe1b4d514..5c5f39cac9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ags01Db/Driver/Ags01Db.cs @@ -33,14 +33,14 @@ public partial class Ags01Db : ByteCommsSensorBase, II2cPeriphera /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Ags01Db object /// /// The I2C bus /// The I2C address - public Ags01Db(II2cBus i2cBus, byte address = (byte)Address.Default) + public Ags01Db(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 3, writeBufferSize: 3) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs index 99822f117f..11d7bded6f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.Enums.cs @@ -5,7 +5,7 @@ partial class Ens160 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs index 9b36965b36..44b8b02b2b 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Driver/Ens160.cs @@ -69,7 +69,7 @@ public OperatingMode CurrentOperatingMode /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new ENS160 object @@ -80,7 +80,7 @@ public OperatingMode CurrentOperatingMode /// /// The I2C bus /// The I2C address - public Ens160(II2cBus i2cBus, byte address = (byte)Address.Default) + public Ens160(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 9, writeBufferSize: 9) { Initialize().Wait(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs index 08dfb88d22..4e22b203a1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Ens160/Samples/Ens160_Sample/MeadowApp.cs @@ -18,7 +18,7 @@ public override Task Initialize() var i2cBus = Device.CreateI2cBus(Meadow.Hardware.I2cBusSpeed.Standard); - sensor = new Ens160(i2cBus, (byte)Ens160.Address.Address_0x53); + sensor = new Ens160(i2cBus, (byte)Ens160.Addresses.Address_0x53); var consumer = Ens160.CreateObserver( diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs index 2e390fc91a..82cb2a69cb 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.Enums.cs @@ -5,7 +5,7 @@ public partial class Pmsa003i /// /// Valid I2C addresses for the sensor /// - internal enum Address : byte + internal enum Addresses : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs index 393a368da4..fa653f2606 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Pmsa003I/Driver/Pmsa003i.cs @@ -143,7 +143,7 @@ public partial class Pmsa003i : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new PMSA003I sensor object @@ -151,7 +151,7 @@ public partial class Pmsa003i : /// /// The I2C bus public Pmsa003i(II2cBus i2cBus) - : base(i2cBus, (byte)Address.Default) + : base(i2cBus, (byte)Addresses.Default) { } /// diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs index 51033c761e..85034d05b5 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.Enums.cs @@ -5,7 +5,7 @@ partial class Scd4xBase /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x62 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs index 68dfb6b720..e7aa52e88e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Environmental.Scd4x/Driver/Scd4xBase.cs @@ -50,7 +50,7 @@ public abstract partial class Scd4xBase /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Scd4xBase object @@ -61,7 +61,7 @@ public abstract partial class Scd4xBase /// /// The I2C bus /// The I2C address - public Scd4xBase(II2cBus i2cBus, byte address = (byte)Address.Default) + public Scd4xBase(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 9, writeBufferSize: 9) { StopPeriodicUpdates().Wait(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs index 25bf8324cb..aaef4ee3c0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.Enums.cs @@ -5,7 +5,7 @@ public partial class NeoM8 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x42 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs index dce53885d5..b8583c35d6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Gnss.NeoM8/Driver/NeoM8.I2c.cs @@ -11,7 +11,7 @@ public partial class NeoM8 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -25,7 +25,7 @@ public partial class NeoM8 : II2cPeripheral /// /// Create a new NeoM8 object using I2C /// - public NeoM8(II2cBus i2cBus, byte address = (byte)Address.Default, IPin resetPin = null, IPin ppsPin = null) + public NeoM8(II2cBus i2cBus, byte address = (byte)Addresses.Default, IPin resetPin = null, IPin ppsPin = null) { if (resetPin != null) { @@ -43,7 +43,7 @@ public NeoM8(II2cBus i2cBus, byte address = (byte)Address.Default, IPin resetPin /// /// Create a new NeoM8 object using I2C /// - public NeoM8(II2cBus i2cBus, byte address = (byte)Address.Default, IDigitalOutputPort resetPort = null, IDigitalInputPort ppsPort = null) + public NeoM8(II2cBus i2cBus, byte address = (byte)Addresses.Default, IDigitalOutputPort resetPort = null, IDigitalInputPort ppsPort = null) { ResetPort = resetPort; PulsePerSecondPort = ppsPort; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs index e421605f99..ae7fd7c148 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.Enums.cs @@ -5,7 +5,7 @@ public partial class As5013 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs index 84e185d68f..f30497119d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.As5013/Driver/As5013.cs @@ -61,7 +61,7 @@ public DigitalJoystickPosition? DigitalPosition /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -74,7 +74,7 @@ public DigitalJoystickPosition? DigitalPosition /// the I2C bus /// the device I2C address /// port connected to the interrupt pin - public As5013(II2cBus i2cBus, byte address = (byte)Address.Default, IDigitalInterruptPort interruptPort = null) + public As5013(II2cBus i2cBus, byte address = (byte)Addresses.Default, IDigitalInterruptPort interruptPort = null) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs index 6b776ded44..efa6240eea 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.Enums.cs @@ -28,7 +28,7 @@ public enum KeyState /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x1F diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs index 6f067c3f15..a9f1326fd3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.BBQ10Keyboard/Driver/BBQ10Keyboard.cs @@ -12,7 +12,7 @@ public partial class BBQ10Keyboard : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -54,7 +54,7 @@ public byte BackLight2 /// The I2C bus /// The interrupt pin /// The I2C address - public BBQ10Keyboard(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Address.Default) + public BBQ10Keyboard(II2cBus i2cBus, IPin interruptPin = null, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs index 5981a7d6a2..8149a08cfc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.cs @@ -14,7 +14,7 @@ public partial class Mpr121 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -64,7 +64,7 @@ public int RefreshPeriod /// /// Create a new MPR121 keypad object. /// - public Mpr121(II2cBus i2cBus, byte address = (byte)Address.Default, int refreshPeriod = -1, Mpr121Configuration configuration = null) + public Mpr121(II2cBus i2cBus, byte address = (byte)Addresses.Default, int refreshPeriod = -1, Mpr121Configuration configuration = null) { this.refreshPeriod = refreshPeriod; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs index 1dbdc36379..abbc2e9a43 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Mpr121/Driver/Mpr121.enums.cs @@ -6,7 +6,7 @@ public partial class Mpr121 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x5A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs index 6933e33677..db84f79085 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.Enums.cs @@ -5,7 +5,7 @@ public partial class Tsc2004 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x4B diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs index 12209d5014..d7ad9639ba 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.Tsc2004/Driver/Tsc2004.cs @@ -13,7 +13,7 @@ public partial class Tsc2004 : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -60,7 +60,7 @@ public partial class Tsc2004 : II2cPeripheral /// /// The I2C bus /// The I2C address - public Tsc2004(II2cBus i2cBus, byte address = (byte)Address.Default) + public Tsc2004(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs index 8bc9fae6f1..b00f9d9538 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/NesClassicController.cs @@ -36,7 +36,7 @@ public class NesClassicController : WiiClassicControllerBase /// Creates a NES Classic Mini Controller object /// /// the I2C bus connected to controller - public NesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) + public NesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs index ba7fa434e8..d2839a4e98 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/SnesClassicController.cs @@ -53,7 +53,7 @@ public class SnesClassicController : WiiClassicControllerBase /// Creates a SNES Classic Mini Controller object /// /// the I2C bus connected to controller - public SnesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) + public SnesClassicController(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs index 6b9818ede2..3863f6b89d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicController.cs @@ -85,7 +85,7 @@ public class WiiClassicController : WiiClassicControllerBase /// /// the I2C bus connected to controller /// Enable high resolution mode analog sticks and triggers (8 bits of precision) - public WiiClassicController(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Address.Default) + public WiiClassicController(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Addresses.Default) { this.useHighResolutionMode = useHighResolutionMode; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs index 685cca31b0..f013b4d680 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiClassicControllerPro.cs @@ -76,7 +76,7 @@ public class WiiClassicControllerPro : WiiClassicControllerBase /// /// the I2C bus connected to controller /// Enable high resolution mode analog sticks and triggers (8 bits of precision) - public WiiClassicControllerPro(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Address.Default) + public WiiClassicControllerPro(II2cBus i2cBus, bool useHighResolutionMode = false) : base(i2cBus, (byte)Addresses.Default) { this.useHighResolutionMode = useHighResolutionMode; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs index d9d70a8884..a95c44779a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/Drivers/WiiNunchuck.cs @@ -45,7 +45,7 @@ public class WiiNunchuck : WiiExtensionControllerBase /// Creates a Wii Nunchuck object /// /// the I2C bus connected to controller - public WiiNunchuck(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) + public WiiNunchuck(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs index a6b72382d5..efcd5b09a9 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.Enums.cs @@ -5,7 +5,7 @@ public abstract partial class WiiExtensionControllerBase /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x52 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs index 51158c3286..d07dd462c4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Hid.WiiExtensionControllers/Driver/WiiExtensionControllerBase.cs @@ -14,7 +14,7 @@ public abstract partial class WiiExtensionControllerBase : II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Default I2C bus speed (400kHz) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs index 92f3e14992..e5fa769eff 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.Addresses.cs @@ -5,7 +5,7 @@ public partial class Bh1745 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Address of the peripheral when the address pin is pulled low. diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs index 27cb077536..952ec019b7 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1745/Driver/Bh1745.cs @@ -225,12 +225,12 @@ public ushort UpperInterruptThreshold /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new BH17545 color sensor object /// - public Bh1745(II2cBus i2cBus, byte address = (byte)Address.Default) + public Bh1745(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { CompensationMultipliers = new ChannelMultipliers diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs index 05eb2e6e28..e48257343f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.Addresses.cs @@ -5,7 +5,7 @@ public partial class Bh1750 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Address of the peripheral when the address pin is pulled low diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs index a03920267d..673bdbe61a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Bh1750/Driver/Bh1750.cs @@ -45,13 +45,13 @@ public double LightTransmittance /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new BH1750 light sensor object using a static reference voltage. /// public Bh1750( - II2cBus i2cBus, byte address = (byte)Address.Default, + II2cBus i2cBus, byte address = (byte)Addresses.Default, MeasuringModes measuringMode = MeasuringModes.ContinuouslyHighResolutionMode, double lightTransmittance = 1) : base(i2cBus, address) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs index e20c1a31ed..533dac2185 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.Enums.cs @@ -5,7 +5,7 @@ public partial class Max44009 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x4A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs index 2018fbcbcd..812cf7d8c0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Max44009/Driver/Max44009.cs @@ -13,14 +13,14 @@ public partial class Max44009 : ByteCommsSensorBase, II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Max44009 object /// /// The I2C bus /// The I2C address - public Max44009(II2cBus i2cBus, byte address = (byte)Address.Default) + public Max44009(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { Initialize(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs index 0550c0fda1..433da494b6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.Addresses.cs @@ -5,7 +5,7 @@ public partial class Si1145 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs index 97c61f53c5..c3762c0b9a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Si1145/Driver/Si1145.cs @@ -16,13 +16,13 @@ public partial class Si1145 /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new SI1145 sensor object /// /// I2cBus (default to 400 KHz) - public Si1145(II2cBus i2cBus) : base(i2cBus, (byte)Address.Default) + public Si1145(II2cBus i2cBus) : base(i2cBus, (byte)Addresses.Default) { if (BusComms.ReadRegister(Registers.REG_PARTID) != 0x45) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs index 71f4cdd257..cab3cd875f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.Enums.cs @@ -16,7 +16,7 @@ public partial class Tsl2591 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x29 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs index eda0ecea7f..db2875d788 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Tsl2591/Driver/Tsl2591.cs @@ -107,7 +107,7 @@ public IntegrationTimes IntegrationTime /// The I2C bus /// The I2C address public Tsl2591(II2cBus i2cBus, - byte address = (byte)Address.Default) + byte address = (byte)Addresses.Default) : base(i2cBus, address) { Gain = GainFactor.Medium; diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs index 51087ac99a..cac8db767c 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.Addresses.cs @@ -5,7 +5,7 @@ public partial class Veml7700 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x10 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs index 97e5226f03..35b2085a42 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Light.Veml7700/Driver/Veml7700.cs @@ -45,14 +45,14 @@ public partial class Veml7700 : ByteCommsSensorBase, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Create a new Veml7700 object with the default address /// /// The I2C bus public Veml7700(II2cBus i2cBus) - : base(i2cBus, (byte)Address.Default) + : base(i2cBus, (byte)Addresses.Default) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs index 7195733dec..2bb609e3dc 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.Enums.cs @@ -6,7 +6,7 @@ public partial class Nau7802 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x2A diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs index 2396e679cf..d9fe3041ef 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.LoadCell.Nau7802/Driver/Nau7802.cs @@ -35,27 +35,27 @@ public partial class Nau7802 : ByteCommsSensorBase, IMassSensor, II2cPerip /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Creates an instance of the NAU7802 Driver class /// /// The I2C bus public Nau7802(II2cBus i2cBus) - : base(i2cBus, (byte)Address.Default) + : base(i2cBus, (byte)Addresses.Default) { - Initialize((byte)Address.Default); + Initialize((byte)Addresses.Default); } private void Initialize(byte address) { switch (address) { - case (byte)Address.Default: + case (byte)Addresses.Default: // valid; break; default: - throw new ArgumentOutOfRangeException($"NAU7802 device supports only address {(byte)Address.Default}"); + throw new ArgumentOutOfRangeException($"NAU7802 device supports only address {(byte)Addresses.Default}"); } PowerOn(); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs index 07d92976ce..82d848858d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345.cs @@ -16,7 +16,7 @@ public partial class Adxl345 : ByteCommsSensorBase, IAcceleromet /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Event raised when acceleration changes @@ -77,7 +77,7 @@ public sbyte OffsetZ /// /// Address of the I2C sensor /// I2C bus - public Adxl345(II2cBus i2cBus, Address address = Address.Default) + public Adxl345(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs index c1fd8e6bdc..b975a00da4 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Adxl3xx/Driver/Drivers/Adxl345_Extras/Adxl345.Addresses.cs @@ -5,7 +5,7 @@ public partial class Adxl345 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x53 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs index aa6b9f7f2b..21cccf18da 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.Addresses.cs @@ -5,7 +5,7 @@ public partial class Apds9960 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x39 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs index aac94f8fa3..28c7722338 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Apds9960/Driver/Apds9960.cs @@ -25,7 +25,7 @@ public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; readonly IDigitalInputPort interruptPort; readonly GestureData gestureData; @@ -60,7 +60,7 @@ public partial class Apds9960 : ByteCommsSensorBase<(Color? Color, Illuminance? /// SI2C bus object /// The interrupt pin public Apds9960(II2cBus i2cBus, IPin interruptPin) - : base(i2cBus, (byte)Address.Default) + : base(i2cBus, (byte)Addresses.Default) { if (interruptPin != null) { diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs index 3f2a365dfc..4c137f14f6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.Enums.cs @@ -5,7 +5,7 @@ public partial class Bmi270 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs index 2b7daded85..6d39352869 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bmi270/Driver/Bmi270.cs @@ -57,7 +57,7 @@ public partial class Bmi270 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -69,7 +69,7 @@ public partial class Bmi270 : /// /// The I2C bus connected to the sensor /// The I2C address - public Bmi270(II2cBus i2cBus, byte address = (byte)Address.Address_0x68) + public Bmi270(II2cBus i2cBus, byte address = (byte)Addresses.Address_0x68) { //Read buffer: 16 (needs at least 13) //Write buffer: 256 bytes for the config data + 1 for the address diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs index 6d948bbedc..82c7be7fd1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.Enums.cs @@ -5,7 +5,7 @@ public partial class Bno055 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x28 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs index 19e1efcb74..dace41b79d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Bno055/Driver/Bno055.cs @@ -32,7 +32,7 @@ public partial class Bno055 : ByteCommsSensorBase<( /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the acceleration value changes @@ -236,7 +236,7 @@ private byte Page /// /// Address of the BNO055 (default = 0x28). /// I2C bus (default = 400 KHz). - public Bno055(II2cBus i2cBus, Address address = Address.Default) + public Bno055(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs index dd1f53e054..629dd6c7b1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.Addresses.cs @@ -5,7 +5,7 @@ public partial class Hmc5883 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x1E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs index f8af3663a7..aa48362b74 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Hmc5883.cs @@ -16,7 +16,7 @@ public partial class Hmc5883 : ByteCommsSensorBase, II2cPeripheral /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Event to be raised when the compass changes @@ -54,7 +54,7 @@ public partial class Hmc5883 : ByteCommsSensorBase, II2cPeripheral /// Output rate /// Sample amount /// Measurement configuration - public Hmc5883(II2cBus i2cBus, byte address = (byte)Address.Default, + public Hmc5883(II2cBus i2cBus, byte address = (byte)Addresses.Default, GainLevels gain = GainLevels.Gain1090, MeasuringModes measuringMode = MeasuringModes.Continuous, DataOutputRates outputRate = DataOutputRates.Rate15, diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs index 8cf29aa7e8..38414c3217 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Hmc5883/Driver/Qmc5883.cs @@ -20,7 +20,7 @@ public class Qmc5883 : Hmc5883 /// Output rate /// Samples amount /// Measurement configuration - public Qmc5883(II2cBus i2cBus, byte address = (byte)Address.Qmc5883, + public Qmc5883(II2cBus i2cBus, byte address = (byte)Addresses.Qmc5883, GainLevels gain = GainLevels.Gain1090, MeasuringModes measuringMode = MeasuringModes.Continuous, DataOutputRates outputRate = DataOutputRates.Rate15, diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs index f19333b8af..c30e3f6524 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.Enums.cs @@ -5,7 +5,7 @@ public partial class Lis2Mdl /// /// Valid I2C addresses for the sensor /// - enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x1E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs index fb91329216..26bf1b7f75 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lis2Mdl/Driver/Lis2Mdl.cs @@ -25,7 +25,7 @@ public partial class Lis2Mdl : PollingSensorBase, IMagnetometer /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral @@ -37,7 +37,7 @@ public partial class Lis2Mdl : PollingSensorBase, IMagnetometer /// /// The I2C bus connected to the sensor /// The I2C address - public Lis2Mdl(II2cBus i2cBus, byte address = (byte)Address.Default) + public Lis2Mdl(II2cBus i2cBus, byte address = (byte)Addresses.Default) { i2cComms = new I2cCommunications(i2cBus, address); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs index 566bcc003b..eea6d0b66f 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.Enums.cs @@ -5,7 +5,7 @@ public partial class Lsm303agr /// /// Valid I2C addresses for the sensor /// - enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x19 for the accelerometer diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs index d8db61d456..a2f8dcd9a6 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Lsm303agr/Driver/Lsm303agr.cs @@ -37,7 +37,7 @@ public partial class Lsm303agr : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.AddressAccel_0x19; + public byte DefaultI2cAddress => (byte)Addresses.AddressAccel_0x19; /// /// I2C Communication bus used to communicate with the accelerometer @@ -55,8 +55,8 @@ public partial class Lsm303agr : /// The I2C bus connected to the sensor public Lsm303agr(II2cBus i2cBus) { - i2cCommsAccel = new I2cCommunications(i2cBus, (byte)Address.AddressAccel_0x19); - i2cCommsMag = new I2cCommunications(i2cBus, (byte)Address.AddressMag_0x1E); + i2cCommsAccel = new I2cCommunications(i2cBus, (byte)Addresses.AddressAccel_0x19); + i2cCommsMag = new I2cCommunications(i2cBus, (byte)Addresses.AddressMag_0x1E); Initialize(); } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs index a75d32aee9..648cc07e2e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mag3110 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x0E diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs index f50b27c5af..d572cfedc1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mag3110/Driver/Mag3110.cs @@ -17,7 +17,7 @@ public partial class Mag3110 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the magnetic field value changes @@ -113,7 +113,7 @@ public bool DigitalInputsEnabled /// Interrupt port used to detect end of conversions /// Address of the MAG3110 (default = 0x0e) /// I2C bus object - default = 400 KHz) - public Mag3110(II2cBus i2cBus, IDigitalInputPort interruptPort = null, byte address = (byte)Address.Default) + public Mag3110(II2cBus i2cBus, IDigitalInputPort interruptPort = null, byte address = (byte)Addresses.Default) : base(i2cBus, address) { var deviceID = BusComms.ReadRegister(Registers.WHO_AM_I); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs index 72f5c68417..cbd08ba890 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mma7660fc /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x4C diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs index b732b43773..f00567906a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mma7660fc/Driver/Mma7660fc.cs @@ -14,7 +14,7 @@ public partial class Mma7660fc : ByteCommsSensorBase, IAccelerom /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when new acceleration data is processed @@ -41,7 +41,7 @@ public partial class Mma7660fc : ByteCommsSensorBase, IAccelerom /// /// Address of the I2C sensor /// I2C bus - public Mma7660fc(II2cBus i2cBus, Address address = Address.Default) + public Mma7660fc(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs index 6a23fb556b..2329db725a 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mmc5603 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x30 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs index 87d8564d38..75cc5a7abd 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mmc5603/Driver/Mmc5603.cs @@ -17,7 +17,7 @@ public partial class Mmc5603 : ByteCommsSensorBase, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the magnetic field value changes @@ -43,7 +43,7 @@ public bool ContinuousModeEnabled /// /// Address of the Mmc5603 /// I2C bus object - default = 400 KHz - public Mmc5603(II2cBus i2cBus, byte address = (byte)Address.Default) + public Mmc5603(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, 10, 8) { var deviceID = BusComms.ReadRegister(Registers.WHO_AM_I); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs index d6659579f2..ab7b22ea57 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.Addresses.cs @@ -5,7 +5,7 @@ public partial class Mpu6050 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x68 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs index 14ed7773e9..24ac3f6c24 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Motion.Mpu6050/Driver/Mpu6050.cs @@ -18,7 +18,7 @@ public partial class Mpu6050 : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the acceration value changes @@ -59,7 +59,7 @@ public partial class Mpu6050 : /// /// The I2C bus /// The I2C address - public Mpu6050(II2cBus i2cBus, Address address = Address.Default) + public Mpu6050(II2cBus i2cBus, Addresses address = Addresses.Default) : this(i2cBus, (byte)address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs index dc920116b5..15ded9391e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.Enums.cs @@ -10,7 +10,7 @@ public partial class Ina260 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x40 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs index 97282efc17..7f1c161644 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Power.Ina260/Driver/Ina260.cs @@ -15,7 +15,7 @@ public partial class Ina260 /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the power value changes @@ -54,13 +54,13 @@ public partial class Ina260 /// /// The I2C bus /// The I2C address - public Ina260(II2cBus i2cBus, byte address = (byte)Address.Default) + public Ina260(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { switch (address) { - case (byte)Address.Address_0x40: - case (byte)Address.Address_0x41: + case (byte)Addresses.Address_0x40: + case (byte)Addresses.Address_0x41: // valid; break; default: diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs index 01aaae2755..4f8a4401a3 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.Addresses.cs @@ -5,7 +5,7 @@ public partial class Lm75 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs index c1f9ab2dc4..f50ddf9f2e 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Lm75/Driver/Lm75.cs @@ -14,7 +14,7 @@ public partial class Lm75 : ByteCommsSensorBase, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the value of the reading changes @@ -31,7 +31,7 @@ public partial class Lm75 : ByteCommsSensorBase, /// /// The I2C bus /// I2C address of the sensor - public Lm75(II2cBus i2cBus, byte address = (byte)Address.Default) + public Lm75(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs index f7f490b4fc..c118755f7d 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9600.cs @@ -12,7 +12,7 @@ public partial class Mcp9600 : Mcp960x /// /// The I2C bus /// I2C address of the sensor - public Mcp9600(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) + public Mcp9600(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs index 048cce7af5..bdf771d233 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Drivers/Mcp9601.cs @@ -12,7 +12,7 @@ public partial class Mcp9601 : Mcp960x /// /// The I2C bus /// I2C address of the sensor - public Mcp9601(II2cBus i2cBus, byte address = (byte)Address.Default) : base(i2cBus, address) + public Mcp9601(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address) { } } diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs index 66189d9ce3..b7dbd3f6d1 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.Enums.cs @@ -5,7 +5,7 @@ public partial class Mcp960x /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x60 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs index 2d24dac600..5d34d9d606 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp960x/Driver/Mcp960x.cs @@ -15,7 +15,7 @@ public abstract partial class Mcp960x : /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the Hot temperature value changes diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs index 7258c79188..8cb7af7277 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.Enums.cs @@ -5,7 +5,7 @@ public partial class Mcp9808 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x18 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs index 054e719c0d..4394a4b9b0 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Mcp9808/Driver/Mcp9808.cs @@ -14,7 +14,7 @@ public partial class Mcp9808 : ByteCommsSensorBase, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the temeperature value changes @@ -31,7 +31,7 @@ public partial class Mcp9808 : ByteCommsSensorBase, /// /// The I2C bus /// The I2C address - public Mcp9808(II2cBus i2CBus, byte address = (byte)Address.Default) + public Mcp9808(II2cBus i2CBus, byte address = (byte)Addresses.Default) : base(i2CBus, address, readBufferSize: 8, writeBufferSize: 8) { BusComms?.WriteRegister(Registers.REG_CONFIG, (ushort)0x0); diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs index 442816a862..75909355aa 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.Addresses.cs @@ -5,7 +5,7 @@ public partial class Tmp102 /// /// Valid I2C addresses for the sensor /// - public enum Address : byte + public enum Addresses : byte { /// /// Bus address 0x48 diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs index b4a7af1e39..525fd49664 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Temperature.Tmp102/Driver/Tmp102.cs @@ -14,7 +14,7 @@ public partial class Tmp102 : ByteCommsSensorBase, /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Address.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// Raised when the temperature value changes @@ -60,7 +60,7 @@ public Resolution SensorResolution /// /// The I2CBus /// I2C address of the sensor - public Tmp102(II2cBus i2cBus, byte address = (byte)Address.Default) + public Tmp102(II2cBus i2cBus, byte address = (byte)Addresses.Default) : base(i2cBus, address, readBufferSize: 2, writeBufferSize: 2) { BusComms?.ReadRegister(0x01, ReadBuffer.Span); From 974623fa90b001792ace96dc324e19f5ec8f4d59 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 25 Apr 2023 14:15:11 -0700 Subject: [PATCH 5/5] Add II2cPeripheral to Pca9685 --- .../ICs.IOExpanders.Pca9685/Driver/Pca9685.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs index ec4e9c4148..91a1dd51d3 100644 --- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs +++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Pca9685/Driver/Pca9685.cs @@ -9,12 +9,12 @@ namespace Meadow.Foundation.ICs.IOExpanders /// Represents PCA9685 IC /// /// All PWM channels run at the same Frequency - public partial class Pca9685 + public partial class Pca9685 : II2cPeripheral { /// /// The default I2C address for the peripheral /// - public byte I2cDefaultAddress => (byte)Addresses.Default; + public byte DefaultI2cAddress => (byte)Addresses.Default; /// /// I2C Communication bus used to communicate with the peripheral