From 38102a7651edee3b6d4eb4d322830ccf3ad6aa53 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 2 Nov 2022 17:13:44 -0700 Subject: [PATCH] Nugetize, comments, API updates --- .../3-AxisDigitalAccelerometer16g.csproj | 4 ++-- ...-AxisDigitalAccelerometer16g_Sample.csproj | 4 ++-- .../3-AxisDigitalAccelerometer1_5g.csproj | 4 ++-- ...AxisDigitalAccelerometer1_5g_Sample.csproj | 2 +- .../Driver/3-AxisDigitalCompass.csproj | 4 ++-- .../3-AxisDigitalCompass_Sample.csproj | 2 +- .../Driver/4-DigitDisplay.csproj | 4 ++-- .../4-DigitDisplay_Sample.csproj | 2 +- Source/Button/Driver/Button.csproj | 4 ++-- .../Sample/Button_Sample/Button_Sample.csproj | 2 +- Source/Buzzer/Driver/Buzzer.cs | 14 +++++-------- Source/Buzzer/Driver/Buzzer.csproj | 2 +- .../Sample/Buzzer_Sample/Buzzer_Sample.csproj | 2 +- .../Buzzer/Sample/Buzzer_Sample/MeadowApp.cs | 9 ++++---- Source/FlameSensor/Driver/FlameSensor.csproj | 2 +- .../FlameSensor_Sample.csproj | 2 +- .../LCD/Samples/LCD_Sample/LCD_Sample.csproj | 2 +- Source/LEDButton/Driver/LEDButton.csproj | 2 +- .../LEDButton_Sample/LEDButton_Sample.csproj | 2 +- Source/LEDSocket/Driver/LEDSocket.csproj | 2 +- .../LEDSocket_Sample/LEDSocket_Sample.csproj | 2 +- Source/LightSensor/Driver/LightSensor.csproj | 2 +- .../LightSensor_Sample.csproj | 2 +- Source/LineFinder/Driver/LineFinder.csproj | 2 +- .../LineFinder_Sample.csproj | 2 +- .../Driver/LoudnessSensor.csproj | 2 +- .../LoudnessSensor_Sample.csproj | 2 +- .../Driver/MagneticSwitch.csproj | 2 +- .../MagneticSwitch_Sample.csproj | 2 +- .../Driver/MiniPIRMotionSensor.cs | 21 ++++++++++--------- .../MiniPIRMotionSensor_Sample.csproj | 2 +- .../Driver/MoistureSensor.csproj | 2 +- .../MoistureSensor_Sample.csproj | 2 +- .../PIRMotionSensor/Driver/PIRMotionSensor.cs | 19 +++++++++-------- .../PIRMotionSensor_Sample.csproj | 2 +- .../RTC/Sample/RTC_Sample/RTC_Sample.csproj | 2 +- Source/Relay/Driver/Relay.csproj | 2 +- .../Sample/Relay_Sample/Relay_Sample.csproj | 2 +- .../Driver/RotaryAngleSensor.csproj | 2 +- .../RotaryAngleSensor_Sample.csproj | 2 +- .../Sample/Servo_Sample/Servo_Sample.csproj | 2 +- Source/SoundSensor/Driver/SoundSensor.csproj | 2 +- .../SoundSensor_Sample.csproj | 2 +- Source/Speaker/Driver/Speaker.cs | 16 +++++++------- Source/Speaker/Driver/Speaker.csproj | 2 +- .../Sample/Speaker_Sample/MeadowApp.cs | 9 ++++---- .../Speaker_Sample/Speaker_Sample.csproj | 2 +- Source/Switch(P)/Driver/Switch(P).csproj | 2 +- .../Switch(P)_Sample/Switch(P)_Sample.csproj | 2 +- ...iditySensor_HighAccuracyMini_Sample.csproj | 2 +- .../Driver/TemperatureSensor.csproj | 2 +- .../TemperatureSensor_Sample.csproj | 2 +- .../ThumbJoystick/Driver/ThumbJoystick.csproj | 2 +- .../ThumbJoystick_Sample.csproj | 2 +- Source/Tilt/Driver/Tilt.csproj | 2 +- .../Sample/Tilt_Sample/Tilt_Sample.csproj | 2 +- Source/Touch/Driver/Touch.csproj | 2 +- .../Sample/Touch_Sample/Touch_Sample.csproj | 2 +- .../Driver/VibrationMotor.csproj | 2 +- .../VibrationMotor_Sample.csproj | 2 +- .../Driver/VibrationSensor.csproj | 2 +- .../VibrationSensor_Sample.csproj | 2 +- Source/WaterSensor/Driver/WaterSensor.csproj | 2 +- .../WaterSensor_Sample.csproj | 2 +- 64 files changed, 107 insertions(+), 109 deletions(-) diff --git a/Source/3-AxisDigitalAccelerometer16g/Driver/3-AxisDigitalAccelerometer16g.csproj b/Source/3-AxisDigitalAccelerometer16g/Driver/3-AxisDigitalAccelerometer16g.csproj index 0fde7f03..4df461ec 100644 --- a/Source/3-AxisDigitalAccelerometer16g/Driver/3-AxisDigitalAccelerometer16g.csproj +++ b/Source/3-AxisDigitalAccelerometer16g/Driver/3-AxisDigitalAccelerometer16g.csproj @@ -16,6 +16,6 @@ - + - \ No newline at end of file + diff --git a/Source/3-AxisDigitalAccelerometer16g/Sample/3-AxisDigitalAccelerometer16g_Sample/3-AxisDigitalAccelerometer16g_Sample.csproj b/Source/3-AxisDigitalAccelerometer16g/Sample/3-AxisDigitalAccelerometer16g_Sample/3-AxisDigitalAccelerometer16g_Sample.csproj index 56f4acdb..a5d06049 100644 --- a/Source/3-AxisDigitalAccelerometer16g/Sample/3-AxisDigitalAccelerometer16g_Sample/3-AxisDigitalAccelerometer16g_Sample.csproj +++ b/Source/3-AxisDigitalAccelerometer16g/Sample/3-AxisDigitalAccelerometer16g_Sample/3-AxisDigitalAccelerometer16g_Sample.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 true @@ -9,6 +9,6 @@ - + diff --git a/Source/3-AxisDigitalAccelerometer1_5g/Driver/3-AxisDigitalAccelerometer1_5g.csproj b/Source/3-AxisDigitalAccelerometer1_5g/Driver/3-AxisDigitalAccelerometer1_5g.csproj index c8230163..d0e1480a 100644 --- a/Source/3-AxisDigitalAccelerometer1_5g/Driver/3-AxisDigitalAccelerometer1_5g.csproj +++ b/Source/3-AxisDigitalAccelerometer1_5g/Driver/3-AxisDigitalAccelerometer1_5g.csproj @@ -16,6 +16,6 @@ - + - \ No newline at end of file + diff --git a/Source/3-AxisDigitalAccelerometer1_5g/Sample/3-AxisDigitalAccelerometer1_5g_Sample/3-AxisDigitalAccelerometer1_5g_Sample.csproj b/Source/3-AxisDigitalAccelerometer1_5g/Sample/3-AxisDigitalAccelerometer1_5g_Sample/3-AxisDigitalAccelerometer1_5g_Sample.csproj index 6c4ea5fa..b4223f3b 100644 --- a/Source/3-AxisDigitalAccelerometer1_5g/Sample/3-AxisDigitalAccelerometer1_5g_Sample/3-AxisDigitalAccelerometer1_5g_Sample.csproj +++ b/Source/3-AxisDigitalAccelerometer1_5g/Sample/3-AxisDigitalAccelerometer1_5g_Sample/3-AxisDigitalAccelerometer1_5g_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/3-AxisDigitalCompass/Driver/3-AxisDigitalCompass.csproj b/Source/3-AxisDigitalCompass/Driver/3-AxisDigitalCompass.csproj index c7ae6092..248b7006 100644 --- a/Source/3-AxisDigitalCompass/Driver/3-AxisDigitalCompass.csproj +++ b/Source/3-AxisDigitalCompass/Driver/3-AxisDigitalCompass.csproj @@ -16,6 +16,6 @@ - + - \ No newline at end of file + diff --git a/Source/3-AxisDigitalCompass/Sample/3-AxisDigitalCompass_Sample/3-AxisDigitalCompass_Sample.csproj b/Source/3-AxisDigitalCompass/Sample/3-AxisDigitalCompass_Sample/3-AxisDigitalCompass_Sample.csproj index 5f16654a..cd0177fb 100644 --- a/Source/3-AxisDigitalCompass/Sample/3-AxisDigitalCompass_Sample/3-AxisDigitalCompass_Sample.csproj +++ b/Source/3-AxisDigitalCompass/Sample/3-AxisDigitalCompass_Sample/3-AxisDigitalCompass_Sample.csproj @@ -13,6 +13,6 @@ - + diff --git a/Source/4-DigitDisplay/Driver/4-DigitDisplay.csproj b/Source/4-DigitDisplay/Driver/4-DigitDisplay.csproj index 8a9e57da..16bd107a 100644 --- a/Source/4-DigitDisplay/Driver/4-DigitDisplay.csproj +++ b/Source/4-DigitDisplay/Driver/4-DigitDisplay.csproj @@ -16,6 +16,6 @@ - + - \ No newline at end of file + diff --git a/Source/4-DigitDisplay/Sample/4-DigitDisplay_Sample/4-DigitDisplay_Sample.csproj b/Source/4-DigitDisplay/Sample/4-DigitDisplay_Sample/4-DigitDisplay_Sample.csproj index cf424be1..345f5bf4 100644 --- a/Source/4-DigitDisplay/Sample/4-DigitDisplay_Sample/4-DigitDisplay_Sample.csproj +++ b/Source/4-DigitDisplay/Sample/4-DigitDisplay_Sample/4-DigitDisplay_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Button/Driver/Button.csproj b/Source/Button/Driver/Button.csproj index a3cee253..f42f1ece 100644 --- a/Source/Button/Driver/Button.csproj +++ b/Source/Button/Driver/Button.csproj @@ -16,6 +16,6 @@ - + - \ No newline at end of file + diff --git a/Source/Button/Sample/Button_Sample/Button_Sample.csproj b/Source/Button/Sample/Button_Sample/Button_Sample.csproj index f7db8dba..ace38353 100644 --- a/Source/Button/Sample/Button_Sample/Button_Sample.csproj +++ b/Source/Button/Sample/Button_Sample/Button_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Buzzer/Driver/Buzzer.cs b/Source/Buzzer/Driver/Buzzer.cs index fbc7c69e..d3dc10d3 100644 --- a/Source/Buzzer/Driver/Buzzer.cs +++ b/Source/Buzzer/Driver/Buzzer.cs @@ -12,7 +12,7 @@ public class Buzzer : PiezoSpeaker /// /// Creates a new Buzzer driver /// - /// + /// The PwmPort used to drive the Buzzer public Buzzer(IPwmPort port) : base(port) { } @@ -20,16 +20,12 @@ public Buzzer(IPwmPort port) /// /// Creates a new Buzzer driver /// - /// - /// - /// - /// + /// The Pwm controller connected to the buzzer (typically Meadow) + /// The pin connected to the buzzer/param> public Buzzer( IPwmOutputController device, - IPin pin, - Frequency frequency, - float dutyCycle = 0) - : base(device, pin, frequency, dutyCycle) + IPin pin) + : base(device, pin, new Frequency(440)) { } } } \ No newline at end of file diff --git a/Source/Buzzer/Driver/Buzzer.csproj b/Source/Buzzer/Driver/Buzzer.csproj index e1cc738b..92491034 100644 --- a/Source/Buzzer/Driver/Buzzer.csproj +++ b/Source/Buzzer/Driver/Buzzer.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Buzzer/Sample/Buzzer_Sample/Buzzer_Sample.csproj b/Source/Buzzer/Sample/Buzzer_Sample/Buzzer_Sample.csproj index afeec98b..eaa938cb 100644 --- a/Source/Buzzer/Sample/Buzzer_Sample/Buzzer_Sample.csproj +++ b/Source/Buzzer/Sample/Buzzer_Sample/Buzzer_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Buzzer/Sample/Buzzer_Sample/MeadowApp.cs b/Source/Buzzer/Sample/Buzzer_Sample/MeadowApp.cs index d6d4a44b..cdce2050 100644 --- a/Source/Buzzer/Sample/Buzzer_Sample/MeadowApp.cs +++ b/Source/Buzzer/Sample/Buzzer_Sample/MeadowApp.cs @@ -1,6 +1,7 @@ using Meadow; using Meadow.Devices; using Meadow.Foundation.Grove.Audio; +using Meadow.Units; using System; using System.Threading.Tasks; @@ -17,7 +18,7 @@ public override Task Initialize() { Console.WriteLine("Initialize..."); - buzzer = new Buzzer(Device, Device.Pins.D13); + buzzer = new Buzzer(Device, Device.Pins.D13, new Frequency(440)); return Task.CompletedTask; } @@ -27,9 +28,9 @@ public override async Task Run() for (int i = 0; i < 5; i++) { Console.WriteLine("Playing A major triad starting at A4"); - await buzzer.PlayTone(440, 500); //A - await buzzer.PlayTone(554.37f, 500); //C# - await buzzer.PlayTone(659.25f, 500); //E + await buzzer.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //A + await buzzer.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //C# + await buzzer.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //E await Task.Delay(2500); } diff --git a/Source/FlameSensor/Driver/FlameSensor.csproj b/Source/FlameSensor/Driver/FlameSensor.csproj index 94875c48..43020430 100644 --- a/Source/FlameSensor/Driver/FlameSensor.csproj +++ b/Source/FlameSensor/Driver/FlameSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/FlameSensor/Sample/FlameSensor_Sample/FlameSensor_Sample.csproj b/Source/FlameSensor/Sample/FlameSensor_Sample/FlameSensor_Sample.csproj index b47aa258..fe2ebdff 100644 --- a/Source/FlameSensor/Sample/FlameSensor_Sample/FlameSensor_Sample.csproj +++ b/Source/FlameSensor/Sample/FlameSensor_Sample/FlameSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LCD/Samples/LCD_Sample/LCD_Sample.csproj b/Source/LCD/Samples/LCD_Sample/LCD_Sample.csproj index d27f89aa..2be0b30e 100644 --- a/Source/LCD/Samples/LCD_Sample/LCD_Sample.csproj +++ b/Source/LCD/Samples/LCD_Sample/LCD_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LEDButton/Driver/LEDButton.csproj b/Source/LEDButton/Driver/LEDButton.csproj index 239f943c..d69bc312 100644 --- a/Source/LEDButton/Driver/LEDButton.csproj +++ b/Source/LEDButton/Driver/LEDButton.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/LEDButton/Sample/LEDButton_Sample/LEDButton_Sample.csproj b/Source/LEDButton/Sample/LEDButton_Sample/LEDButton_Sample.csproj index bc6a3c57..4e6b97ae 100644 --- a/Source/LEDButton/Sample/LEDButton_Sample/LEDButton_Sample.csproj +++ b/Source/LEDButton/Sample/LEDButton_Sample/LEDButton_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LEDSocket/Driver/LEDSocket.csproj b/Source/LEDSocket/Driver/LEDSocket.csproj index 1999065c..6b389e06 100644 --- a/Source/LEDSocket/Driver/LEDSocket.csproj +++ b/Source/LEDSocket/Driver/LEDSocket.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/LEDSocket/Sample/LEDSocket_Sample/LEDSocket_Sample.csproj b/Source/LEDSocket/Sample/LEDSocket_Sample/LEDSocket_Sample.csproj index b0b44425..b52f8a13 100644 --- a/Source/LEDSocket/Sample/LEDSocket_Sample/LEDSocket_Sample.csproj +++ b/Source/LEDSocket/Sample/LEDSocket_Sample/LEDSocket_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LightSensor/Driver/LightSensor.csproj b/Source/LightSensor/Driver/LightSensor.csproj index 5f1f9945..9ba39707 100644 --- a/Source/LightSensor/Driver/LightSensor.csproj +++ b/Source/LightSensor/Driver/LightSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/LightSensor/Sample/LightSensor_Sample/LightSensor_Sample.csproj b/Source/LightSensor/Sample/LightSensor_Sample/LightSensor_Sample.csproj index 5815ef0b..6f22af3f 100644 --- a/Source/LightSensor/Sample/LightSensor_Sample/LightSensor_Sample.csproj +++ b/Source/LightSensor/Sample/LightSensor_Sample/LightSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LineFinder/Driver/LineFinder.csproj b/Source/LineFinder/Driver/LineFinder.csproj index beca1a9a..f01e8283 100644 --- a/Source/LineFinder/Driver/LineFinder.csproj +++ b/Source/LineFinder/Driver/LineFinder.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/LineFinder/Sample/LineFinder_Sample/LineFinder_Sample.csproj b/Source/LineFinder/Sample/LineFinder_Sample/LineFinder_Sample.csproj index 00e50b4e..a66349d2 100644 --- a/Source/LineFinder/Sample/LineFinder_Sample/LineFinder_Sample.csproj +++ b/Source/LineFinder/Sample/LineFinder_Sample/LineFinder_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/LoudnessSensor/Driver/LoudnessSensor.csproj b/Source/LoudnessSensor/Driver/LoudnessSensor.csproj index b9add1c6..ec7bf8d3 100644 --- a/Source/LoudnessSensor/Driver/LoudnessSensor.csproj +++ b/Source/LoudnessSensor/Driver/LoudnessSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/LoudnessSensor/Sample/LoudnessSensor_Sample/LoudnessSensor_Sample.csproj b/Source/LoudnessSensor/Sample/LoudnessSensor_Sample/LoudnessSensor_Sample.csproj index 66ec3215..2f26b3fe 100644 --- a/Source/LoudnessSensor/Sample/LoudnessSensor_Sample/LoudnessSensor_Sample.csproj +++ b/Source/LoudnessSensor/Sample/LoudnessSensor_Sample/LoudnessSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/MagneticSwitch/Driver/MagneticSwitch.csproj b/Source/MagneticSwitch/Driver/MagneticSwitch.csproj index 73d840d4..0350e95f 100644 --- a/Source/MagneticSwitch/Driver/MagneticSwitch.csproj +++ b/Source/MagneticSwitch/Driver/MagneticSwitch.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/MagneticSwitch/Sample/MagneticSwitch_Sample/MagneticSwitch_Sample.csproj b/Source/MagneticSwitch/Sample/MagneticSwitch_Sample/MagneticSwitch_Sample.csproj index b00d80af..f9d305bd 100644 --- a/Source/MagneticSwitch/Sample/MagneticSwitch_Sample/MagneticSwitch_Sample.csproj +++ b/Source/MagneticSwitch/Sample/MagneticSwitch_Sample/MagneticSwitch_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/MiniPIRMotionSensor/Driver/MiniPIRMotionSensor.cs b/Source/MiniPIRMotionSensor/Driver/MiniPIRMotionSensor.cs index 5f12df1d..9a3b40b7 100644 --- a/Source/MiniPIRMotionSensor/Driver/MiniPIRMotionSensor.cs +++ b/Source/MiniPIRMotionSensor/Driver/MiniPIRMotionSensor.cs @@ -1,5 +1,6 @@ using Meadow.Foundation.Sensors.Motion; using Meadow.Hardware; +using System; namespace Meadow.Foundation.Grove.Sensors.Motion { @@ -11,7 +12,7 @@ public class MiniPIRMotionSensor : ParallaxPir /// /// Creates a MiniPIRMotionSensor driver /// - /// + /// The port connected to the PIR public MiniPIRMotionSensor(IDigitalInputPort digitalInputPort) : base(digitalInputPort) { } @@ -19,27 +20,27 @@ public MiniPIRMotionSensor(IDigitalInputPort digitalInputPort) /// /// Creates a MiniPIRMotionSensor driver /// - /// - /// - /// - /// - /// - /// + /// The Meadow device + /// The pin connected to the PIR sensor + /// The interrupt mode of the pin + /// The resistor mode of the pin + /// The debounce duration + /// The glitch duration (can typically be set to zero) public MiniPIRMotionSensor( IDigitalInputController device, IPin pin, InterruptMode interruptMode, ResistorMode resistorMode, - int debounceDuration = 20, - int glitchFilterCycleCount = 0) + TimeSpan debounceDuration, + TimeSpan glitchDuration) : base( device, pin, interruptMode, resistorMode, debounceDuration, - glitchFilterCycleCount) + glitchDuration) { } } } \ No newline at end of file diff --git a/Source/MiniPIRMotionSensor/Sample/MiniPIRMotionSensor_Sample/MiniPIRMotionSensor_Sample.csproj b/Source/MiniPIRMotionSensor/Sample/MiniPIRMotionSensor_Sample/MiniPIRMotionSensor_Sample.csproj index d11363d6..d65dea55 100644 --- a/Source/MiniPIRMotionSensor/Sample/MiniPIRMotionSensor_Sample/MiniPIRMotionSensor_Sample.csproj +++ b/Source/MiniPIRMotionSensor/Sample/MiniPIRMotionSensor_Sample/MiniPIRMotionSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/MoistureSensor/Driver/MoistureSensor.csproj b/Source/MoistureSensor/Driver/MoistureSensor.csproj index b00a196e..d125c753 100644 --- a/Source/MoistureSensor/Driver/MoistureSensor.csproj +++ b/Source/MoistureSensor/Driver/MoistureSensor.csproj @@ -18,6 +18,6 @@ - + diff --git a/Source/MoistureSensor/Sample/MoistureSensor_Sample/MoistureSensor_Sample.csproj b/Source/MoistureSensor/Sample/MoistureSensor_Sample/MoistureSensor_Sample.csproj index 8c7aa038..6185b8c3 100644 --- a/Source/MoistureSensor/Sample/MoistureSensor_Sample/MoistureSensor_Sample.csproj +++ b/Source/MoistureSensor/Sample/MoistureSensor_Sample/MoistureSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/PIRMotionSensor/Driver/PIRMotionSensor.cs b/Source/PIRMotionSensor/Driver/PIRMotionSensor.cs index 5c6dec27..5bc88b30 100644 --- a/Source/PIRMotionSensor/Driver/PIRMotionSensor.cs +++ b/Source/PIRMotionSensor/Driver/PIRMotionSensor.cs @@ -1,5 +1,6 @@ using Meadow.Foundation.Sensors.Motion; using Meadow.Hardware; +using System; namespace Meadow.Foundation.Grove.Sensors.Motion { @@ -19,26 +20,26 @@ public PIRMotionSensor(IDigitalInputPort digitalInputPort) /// /// Creates a PIRMotionSensor driver /// - /// - /// - /// - /// - /// - /// + /// The Meadow device + /// The pin connected to the PIR sensor + /// The interrupt mode of the pin + /// The resistor mode of the pin + /// The debounce duration + /// The glitch duration (can typically be set to zero) public PIRMotionSensor( IDigitalInputController device, IPin pin, InterruptMode interruptMode, ResistorMode resistorMode, - int debounceDuration = 20, - int glitchFilterCycleCount = 0) + TimeSpan debounceDuration, + TimeSpan glitchDuration) : base( device, pin, interruptMode, resistorMode, debounceDuration, - glitchFilterCycleCount) + glitchDuration) { } } } \ No newline at end of file diff --git a/Source/PIRMotionSensor/Sample/PIRMotionSensor_Sample/PIRMotionSensor_Sample.csproj b/Source/PIRMotionSensor/Sample/PIRMotionSensor_Sample/PIRMotionSensor_Sample.csproj index 0fdf31b4..dc64104f 100644 --- a/Source/PIRMotionSensor/Sample/PIRMotionSensor_Sample/PIRMotionSensor_Sample.csproj +++ b/Source/PIRMotionSensor/Sample/PIRMotionSensor_Sample/PIRMotionSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/RTC/Sample/RTC_Sample/RTC_Sample.csproj b/Source/RTC/Sample/RTC_Sample/RTC_Sample.csproj index ffe59d85..bd56414a 100644 --- a/Source/RTC/Sample/RTC_Sample/RTC_Sample.csproj +++ b/Source/RTC/Sample/RTC_Sample/RTC_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Relay/Driver/Relay.csproj b/Source/Relay/Driver/Relay.csproj index 23122793..38b25640 100644 --- a/Source/Relay/Driver/Relay.csproj +++ b/Source/Relay/Driver/Relay.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Relay/Sample/Relay_Sample/Relay_Sample.csproj b/Source/Relay/Sample/Relay_Sample/Relay_Sample.csproj index 72104eeb..8cb83122 100644 --- a/Source/Relay/Sample/Relay_Sample/Relay_Sample.csproj +++ b/Source/Relay/Sample/Relay_Sample/Relay_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/RotaryAngleSensor/Driver/RotaryAngleSensor.csproj b/Source/RotaryAngleSensor/Driver/RotaryAngleSensor.csproj index e51e1343..cd6b329e 100644 --- a/Source/RotaryAngleSensor/Driver/RotaryAngleSensor.csproj +++ b/Source/RotaryAngleSensor/Driver/RotaryAngleSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/RotaryAngleSensor/Sample/RotaryAngleSensor_Sample/RotaryAngleSensor_Sample.csproj b/Source/RotaryAngleSensor/Sample/RotaryAngleSensor_Sample/RotaryAngleSensor_Sample.csproj index e0e53385..ed2b2681 100644 --- a/Source/RotaryAngleSensor/Sample/RotaryAngleSensor_Sample/RotaryAngleSensor_Sample.csproj +++ b/Source/RotaryAngleSensor/Sample/RotaryAngleSensor_Sample/RotaryAngleSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Servo/Sample/Servo_Sample/Servo_Sample.csproj b/Source/Servo/Sample/Servo_Sample/Servo_Sample.csproj index ed5e4014..4e9d4b2d 100644 --- a/Source/Servo/Sample/Servo_Sample/Servo_Sample.csproj +++ b/Source/Servo/Sample/Servo_Sample/Servo_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/SoundSensor/Driver/SoundSensor.csproj b/Source/SoundSensor/Driver/SoundSensor.csproj index 61d8af99..1d209709 100644 --- a/Source/SoundSensor/Driver/SoundSensor.csproj +++ b/Source/SoundSensor/Driver/SoundSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/SoundSensor/Sample/SoundSensor_Sample/SoundSensor_Sample.csproj b/Source/SoundSensor/Sample/SoundSensor_Sample/SoundSensor_Sample.csproj index 03e4d3e9..d23b3e82 100644 --- a/Source/SoundSensor/Sample/SoundSensor_Sample/SoundSensor_Sample.csproj +++ b/Source/SoundSensor/Sample/SoundSensor_Sample/SoundSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Speaker/Driver/Speaker.cs b/Source/Speaker/Driver/Speaker.cs index dfeb6166..c5e63d9c 100644 --- a/Source/Speaker/Driver/Speaker.cs +++ b/Source/Speaker/Driver/Speaker.cs @@ -1,6 +1,8 @@ using Meadow.Foundation.Audio; using Meadow.Hardware; using Meadow.Units; +using System; +using System.Threading; namespace Meadow.Foundation.Grove.Audio { @@ -20,20 +22,16 @@ public Speaker(IPwmPort port) /// /// Creates a Speaker driver /// - /// - /// - /// - /// + /// The Pwm controller connected to the buzzer (typically Meadow) + /// The pin connected to the buzzer/param> public Speaker( IPwmOutputController device, - IPin pin, - Frequency frequency, - float dutyCycle = 0) + IPin pin) : base( device, pin, - frequency, - dutyCycle) + new Frequency(440), + 0f) { } } } \ No newline at end of file diff --git a/Source/Speaker/Driver/Speaker.csproj b/Source/Speaker/Driver/Speaker.csproj index 1166cabf..3ce4b814 100644 --- a/Source/Speaker/Driver/Speaker.csproj +++ b/Source/Speaker/Driver/Speaker.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Speaker/Sample/Speaker_Sample/MeadowApp.cs b/Source/Speaker/Sample/Speaker_Sample/MeadowApp.cs index 37206ed4..96b87c20 100644 --- a/Source/Speaker/Sample/Speaker_Sample/MeadowApp.cs +++ b/Source/Speaker/Sample/Speaker_Sample/MeadowApp.cs @@ -1,6 +1,7 @@ using Meadow; using Meadow.Devices; using Meadow.Foundation.Grove.Audio; +using Meadow.Units; using System; using System.Threading.Tasks; @@ -17,7 +18,7 @@ public override Task Initialize() { Console.WriteLine("Initialize..."); - speaker = new Speaker(Device, Device.Pins.D13); + speaker = new Speaker(Device, Device.Pins.D13, new Frequency(440)); return Task.CompletedTask; } @@ -27,9 +28,9 @@ public override async Task Run() for (int i = 0; i < 5; i++) { Console.WriteLine("Playing A major triad starting at A4"); - await speaker.PlayTone(440, 500); //A - await speaker.PlayTone(554.37f, 500); //C# - await speaker.PlayTone(659.25f, 500); //E + await speaker.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //A + await speaker.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //C# + await speaker.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //E await Task.Delay(2500); } diff --git a/Source/Speaker/Sample/Speaker_Sample/Speaker_Sample.csproj b/Source/Speaker/Sample/Speaker_Sample/Speaker_Sample.csproj index 99f24f6e..2c7d5c9a 100644 --- a/Source/Speaker/Sample/Speaker_Sample/Speaker_Sample.csproj +++ b/Source/Speaker/Sample/Speaker_Sample/Speaker_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Switch(P)/Driver/Switch(P).csproj b/Source/Switch(P)/Driver/Switch(P).csproj index 6afe0c6d..d957b170 100644 --- a/Source/Switch(P)/Driver/Switch(P).csproj +++ b/Source/Switch(P)/Driver/Switch(P).csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Switch(P)/Sample/Switch(P)_Sample/Switch(P)_Sample.csproj b/Source/Switch(P)/Sample/Switch(P)_Sample/Switch(P)_Sample.csproj index b3389b43..9e5dd8da 100644 --- a/Source/Switch(P)/Sample/Switch(P)_Sample/Switch(P)_Sample.csproj +++ b/Source/Switch(P)/Sample/Switch(P)_Sample/Switch(P)_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/TemperatureHumiditySensor_HighAccuracyMini/Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample.csproj b/Source/TemperatureHumiditySensor_HighAccuracyMini/Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample.csproj index 0e2ea816..b31913d4 100644 --- a/Source/TemperatureHumiditySensor_HighAccuracyMini/Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample.csproj +++ b/Source/TemperatureHumiditySensor_HighAccuracyMini/Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample/TemperatureHumiditySensor_HighAccuracyMini_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/TemperatureSensor/Driver/TemperatureSensor.csproj b/Source/TemperatureSensor/Driver/TemperatureSensor.csproj index 2674321c..7daaa758 100644 --- a/Source/TemperatureSensor/Driver/TemperatureSensor.csproj +++ b/Source/TemperatureSensor/Driver/TemperatureSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/TemperatureSensor/Sample/TemperatureSensor_Sample/TemperatureSensor_Sample.csproj b/Source/TemperatureSensor/Sample/TemperatureSensor_Sample/TemperatureSensor_Sample.csproj index 026ff894..223a15ba 100644 --- a/Source/TemperatureSensor/Sample/TemperatureSensor_Sample/TemperatureSensor_Sample.csproj +++ b/Source/TemperatureSensor/Sample/TemperatureSensor_Sample/TemperatureSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/ThumbJoystick/Driver/ThumbJoystick.csproj b/Source/ThumbJoystick/Driver/ThumbJoystick.csproj index 4823db1b..87d6237d 100644 --- a/Source/ThumbJoystick/Driver/ThumbJoystick.csproj +++ b/Source/ThumbJoystick/Driver/ThumbJoystick.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/ThumbJoystick/Sample/ThumbJoystick_Sample/ThumbJoystick_Sample.csproj b/Source/ThumbJoystick/Sample/ThumbJoystick_Sample/ThumbJoystick_Sample.csproj index 79b72401..451f326b 100644 --- a/Source/ThumbJoystick/Sample/ThumbJoystick_Sample/ThumbJoystick_Sample.csproj +++ b/Source/ThumbJoystick/Sample/ThumbJoystick_Sample/ThumbJoystick_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Tilt/Driver/Tilt.csproj b/Source/Tilt/Driver/Tilt.csproj index 2c376733..731a9719 100644 --- a/Source/Tilt/Driver/Tilt.csproj +++ b/Source/Tilt/Driver/Tilt.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Tilt/Sample/Tilt_Sample/Tilt_Sample.csproj b/Source/Tilt/Sample/Tilt_Sample/Tilt_Sample.csproj index ff7072b9..0bf6c26b 100644 --- a/Source/Tilt/Sample/Tilt_Sample/Tilt_Sample.csproj +++ b/Source/Tilt/Sample/Tilt_Sample/Tilt_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/Touch/Driver/Touch.csproj b/Source/Touch/Driver/Touch.csproj index 0316287f..bda736e3 100644 --- a/Source/Touch/Driver/Touch.csproj +++ b/Source/Touch/Driver/Touch.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/Touch/Sample/Touch_Sample/Touch_Sample.csproj b/Source/Touch/Sample/Touch_Sample/Touch_Sample.csproj index 9e29e885..4ae2cca5 100644 --- a/Source/Touch/Sample/Touch_Sample/Touch_Sample.csproj +++ b/Source/Touch/Sample/Touch_Sample/Touch_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/VibrationMotor/Driver/VibrationMotor.csproj b/Source/VibrationMotor/Driver/VibrationMotor.csproj index 3bf942df..5a475ffd 100644 --- a/Source/VibrationMotor/Driver/VibrationMotor.csproj +++ b/Source/VibrationMotor/Driver/VibrationMotor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/VibrationMotor/Sample/VibrationMotor_Sample/VibrationMotor_Sample.csproj b/Source/VibrationMotor/Sample/VibrationMotor_Sample/VibrationMotor_Sample.csproj index a1cef070..6f486ced 100644 --- a/Source/VibrationMotor/Sample/VibrationMotor_Sample/VibrationMotor_Sample.csproj +++ b/Source/VibrationMotor/Sample/VibrationMotor_Sample/VibrationMotor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/VibrationSensor/Driver/VibrationSensor.csproj b/Source/VibrationSensor/Driver/VibrationSensor.csproj index a3d61528..6fee25fa 100644 --- a/Source/VibrationSensor/Driver/VibrationSensor.csproj +++ b/Source/VibrationSensor/Driver/VibrationSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/VibrationSensor/Sample/VibrationSensor_Sample/VibrationSensor_Sample.csproj b/Source/VibrationSensor/Sample/VibrationSensor_Sample/VibrationSensor_Sample.csproj index cdaf5499..965576ef 100644 --- a/Source/VibrationSensor/Sample/VibrationSensor_Sample/VibrationSensor_Sample.csproj +++ b/Source/VibrationSensor/Sample/VibrationSensor_Sample/VibrationSensor_Sample.csproj @@ -7,6 +7,6 @@ - + diff --git a/Source/WaterSensor/Driver/WaterSensor.csproj b/Source/WaterSensor/Driver/WaterSensor.csproj index c17060dd..6c1a43e4 100644 --- a/Source/WaterSensor/Driver/WaterSensor.csproj +++ b/Source/WaterSensor/Driver/WaterSensor.csproj @@ -16,6 +16,6 @@ - + diff --git a/Source/WaterSensor/Sample/WaterSensor_Sample/WaterSensor_Sample.csproj b/Source/WaterSensor/Sample/WaterSensor_Sample/WaterSensor_Sample.csproj index 1202d4c6..9d36716b 100644 --- a/Source/WaterSensor/Sample/WaterSensor_Sample/WaterSensor_Sample.csproj +++ b/Source/WaterSensor/Sample/WaterSensor_Sample/WaterSensor_Sample.csproj @@ -7,6 +7,6 @@ - +