Skip to content

Commit

Permalink
Merge pull request #215 from WildernessLabs/feature/electrical-sensors
Browse files Browse the repository at this point in the history
Added interfaces for electrical sensors
  • Loading branch information
adrianstevens authored Apr 4, 2024
2 parents 7ca098a + 4da2881 commit 9ed4dc2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Source/Meadow.Contracts/Hardware/Contracts/IPinExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ public static IDigitalInterruptPort CreateDigitalInterruptPort(this IPin pin, In
throw new ArgumentException("Pin is not digital input capable");
}

/// <summary>
/// Creates a digital interrupt port for the specified pin with specified configurations.
/// </summary>
/// <param name="pin">The pin to create a digital interrupt port for.</param>
/// <param name="interruptMode">The interrupt mode for the digital interrupt port.</param>
/// <param name="resistorMode">The resistor mode for the digital interrupt port.</param>
/// <param name="debounceDuration">The debounce duration for the digital interrupt port.</param>
/// <returns>The created digital interrupt port.</returns>
public static IDigitalInterruptPort CreateDigitalInterruptPort(this IPin pin, InterruptMode interruptMode, ResistorMode resistorMode, TimeSpan debounceDuration)
{
return pin.CreateDigitalInterruptPort(interruptMode, resistorMode, debounceDuration, TimeSpan.Zero);
}

/// <summary>
/// Creates a digital input port for the specified pin with the specified resistor mode.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Meadow.Units;

namespace Meadow.Peripherals.Sensors;

/// <summary>
/// Electrical Current sensor interface requirements.
/// </summary>
public interface ICurrentSensor : ISamplingSensor<Current>
{
/// <summary>
/// Last value read from the Current sensor.
/// </summary>
public Current? Current { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Meadow.Units;

namespace Meadow.Peripherals.Sensors;

/// <summary>
/// Electrical Power sensor interface requirements.
/// </summary>
public interface IPowerSensor : ISamplingSensor<Power>
{
/// <summary>
/// Last value read from the Power sensor.
/// </summary>
public Power? Power { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Meadow.Units;

namespace Meadow.Peripherals.Sensors;

/// <summary>
/// Voltage sensor interface requirements.
/// </summary>
public interface IVoltageSensor : ISamplingSensor<Voltage>
{
/// <summary>
/// Last value read from the Voltage sensor.
/// </summary>
public Voltage? Voltage { get; }
}
2 changes: 1 addition & 1 deletion Source/Meadow.Contracts/Platform OS/IPlatformOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public partial interface IPlatformOS : IPowerController


/// <summary>
/// Gets the amount of storage space in use on the primarys storage device
/// Gets the amount of storage space in use on the primary storage device
/// </summary>
DigitalStorage GetPrimaryDiskSpaceInUse();

Expand Down

0 comments on commit 9ed4dc2

Please sign in to comment.