-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from WildernessLabs/v1.12.8
Release 1.12.8
- Loading branch information
Showing
26 changed files
with
503 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
|
||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Reasons a platform might have been reset | ||
/// </summary> | ||
[Flags] | ||
public enum ResetReason | ||
{ | ||
/// <summary> | ||
/// The reset reason is not determined | ||
/// </summary> | ||
Unknown = 0, | ||
/// <summary> | ||
/// Power was too low to maintain operation (brown out) | ||
/// </summary> | ||
InsufficientPower = 1 << 1, | ||
/// <summary> | ||
/// Reset pin/interrupt detected | ||
/// </summary> | ||
HardwareReset = 1 << 2, | ||
/// <summary> | ||
/// Normal power-on reset | ||
/// </summary> | ||
PowerOnReset = 1 << 3, | ||
/// <summary> | ||
/// Software-triggered reset | ||
/// </summary> | ||
SoftwareReset = 1 << 4, | ||
/// <summary> | ||
/// An independent watchdog timer expired | ||
/// </summary> | ||
IndependentWatchdog = 1 << 5, | ||
/// <summary> | ||
/// An window watchdog timer expired | ||
/// </summary> | ||
WindowWatchdog = 1 << 6, | ||
/// <summary> | ||
/// A reset due to low power | ||
/// </summary> | ||
LowPower = 1 << 7 | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
Source/Meadow.Contracts/Exceptions/MeadowCloudSystemErrorInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace Meadow; | ||
|
||
/// <summary> | ||
/// Contains information about a Meadow Cloud system error | ||
/// </summary> | ||
public class MeadowCloudSystemErrorInfo : MeadowSystemErrorInfo | ||
{ | ||
/// <summary> | ||
/// Creates a MeadowCloudSystemErrorInfo object | ||
/// </summary> | ||
/// <param name="exception">The exception from Meadow Cloud</param> | ||
public MeadowCloudSystemErrorInfo(Exception exception) | ||
: base("Meadow Cloud Error", SystemErrorNumber.MeadowCloudError, exception) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,81 @@ | ||
using Meadow.Units; | ||
using System; | ||
|
||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Represents a base class for PWM ports. | ||
/// </summary> | ||
public abstract class PwmPortBase : DigitalPortBase, IPwmPort | ||
{ | ||
/// <summary> | ||
/// Represents a base class for PWM ports. | ||
/// Gets or sets the PWM channel information associated with the port. | ||
/// </summary> | ||
public abstract class PwmPortBase : DigitalPortBase, IPwmPort | ||
public new IPwmChannelInfo Channel | ||
{ | ||
/// <summary> | ||
/// Gets or sets the PWM channel information associated with the port. | ||
/// </summary> | ||
public new IPwmChannelInfo Channel | ||
{ | ||
get => (IPwmChannelInfo)base.Channel; | ||
protected set { base.Channel = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="PwmPortBase"/> class. | ||
/// </summary> | ||
/// <param name="pin">The pin associated with the PWM port.</param> | ||
/// <param name="channel">The PWM channel information for the port.</param> | ||
/// <param name="frequency">The PWM frequency.</param> | ||
/// <param name="dutyCycle">The initial PWM duty cycle (default is 0).</param> | ||
/// <param name="inverted">A value indicating whether the PWM signal is inverted (default is false).</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="pin"/> or <paramref name="channel"/> is <c>null</c>.</exception> | ||
protected PwmPortBase( | ||
IPin pin, | ||
IPwmChannelInfo channel, | ||
Frequency frequency, | ||
float dutyCycle = 0, | ||
bool inverted = false | ||
) : base(pin, channel) | ||
{ | ||
Inverted = inverted; | ||
Frequency = frequency; | ||
DutyCycle = dutyCycle; | ||
} | ||
get => (IPwmChannelInfo)base.Channel; | ||
protected set { base.Channel = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the time scale in which time-based properties (Period and Duration) are expressed. | ||
/// </summary> | ||
public TimeScale TimeScale { get; set; } | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="PwmPortBase"/> class. | ||
/// </summary> | ||
/// <param name="pin">The pin associated with the PWM port.</param> | ||
/// <param name="channel">The PWM channel information for the port.</param> | ||
/// <param name="frequency">The PWM frequency.</param> | ||
/// <param name="dutyCycle">The initial PWM duty cycle (default is 0).</param> | ||
/// <param name="inverted">A value indicating whether the PWM signal is inverted (default is false).</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="pin"/> or <paramref name="channel"/> is <c>null</c>.</exception> | ||
protected PwmPortBase( | ||
IPin pin, | ||
IPwmChannelInfo channel, | ||
Frequency frequency, | ||
float dutyCycle = 0, | ||
bool inverted = false | ||
) : base(pin, channel) | ||
{ | ||
Inverted = inverted; | ||
Frequency = frequency; | ||
DutyCycle = dutyCycle; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the PWM signal is inverted. | ||
/// </summary> | ||
public abstract bool Inverted { get; set; } | ||
/// <summary> | ||
/// Gets or sets a value indicating whether the PWM signal is inverted. | ||
/// </summary> | ||
public abstract bool Inverted { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the duty cycle of the PWM signal. | ||
/// </summary> | ||
public abstract float DutyCycle { get; set; } | ||
/// <summary> | ||
/// Gets or sets the duty cycle of the PWM signal. | ||
/// </summary> | ||
public abstract double DutyCycle { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the frequency of the PWM signal. | ||
/// </summary> | ||
public abstract Frequency Frequency { get; set; } | ||
/// <summary> | ||
/// Gets or sets the frequency of the PWM signal. | ||
/// </summary> | ||
public abstract Frequency Frequency { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the duration of the PWM pulse. | ||
/// </summary> | ||
public abstract float Duration { get; set; } | ||
/// <summary> | ||
/// Gets or sets the duration of the PWM pulse. | ||
/// </summary> | ||
public abstract TimePeriod Duration { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the period of the PWM signal. | ||
/// </summary> | ||
public abstract float Period { get; set; } | ||
/// <summary> | ||
/// Gets or sets the period of the PWM signal. | ||
/// </summary> | ||
public abstract TimePeriod Period { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the state of the PWM signal. | ||
/// </summary> | ||
public abstract bool State { get; } | ||
/// <summary> | ||
/// Gets the state of the PWM signal. | ||
/// </summary> | ||
public abstract bool State { get; } | ||
|
||
/// <summary> | ||
/// Starts the PWM signal. | ||
/// </summary> | ||
public abstract void Start(); | ||
/// <summary> | ||
/// Starts the PWM signal. | ||
/// </summary> | ||
public abstract void Start(); | ||
|
||
/// <summary> | ||
/// Stops the PWM signal. | ||
/// </summary> | ||
public abstract void Stop(); | ||
} | ||
/// <summary> | ||
/// Stops the PWM signal. | ||
/// </summary> | ||
public abstract void Stop(); | ||
} |
1 change: 1 addition & 0 deletions
1
Source/Meadow.Contracts/Hardware/Contracts/Connectors/Connector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Source/Meadow.Contracts/Hardware/Contracts/Connectors/ConnectorCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Represents a Collection of IConnectors | ||
/// </summary> | ||
public class ConnectorCollection : IEnumerable<IConnector> | ||
{ | ||
private List<IConnector> _connectors = new(); | ||
|
||
/// <summary> | ||
/// Creates a new ConnectorCollection | ||
/// </summary> | ||
protected ConnectorCollection() { } | ||
|
||
/// <inheritdoc/> | ||
public IEnumerator<IConnector> GetEnumerator() | ||
{ | ||
return _connectors.GetEnumerator(); | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
{ | ||
return GetEnumerator(); | ||
} | ||
|
||
/// <summary> | ||
/// Adds a connector to the collection | ||
/// </summary> | ||
/// <param name="connector">The Connector instance to add</param> | ||
protected void Add(IConnector connector) | ||
{ | ||
_connectors.Add(connector); | ||
} | ||
|
||
/// <summary> | ||
/// Retrieves an empty ConnectorCollection | ||
/// </summary> | ||
public static ConnectorCollection Empty | ||
{ | ||
get => new ConnectorCollection(); | ||
} | ||
} |
Oops, something went wrong.