-
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 #87 from WildernessLabs/develop
Merge to main for RC3
- Loading branch information
Showing
66 changed files
with
1,847 additions
and
1,543 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
using System; | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Information about an analog channel | ||
/// </summary> | ||
public class AnalogChannelInfo : ChannelInfoBase, IAnalogChannelInfo | ||
{ | ||
/// <summary> | ||
/// Information about an analog channel | ||
/// Whether or not the channel is capable of reading input (i.e. ADC). | ||
/// </summary> | ||
public class AnalogChannelInfo : ChannelInfoBase, IAnalogChannelInfo | ||
{ | ||
/// <summary> | ||
/// Whether or not the channel is capable of reading input (i.e. ADC). | ||
/// </summary> | ||
/// <value><c>true</c> if input capable; otherwise, <c>false</c>.</value> | ||
public bool InputCapable { get; protected set; } | ||
/// <summary> | ||
/// Whether or not the channel is capable of writing output (i.e. DAC). | ||
/// </summary> | ||
/// <value><c>true</c> if output capable; otherwise, <c>false</c>.</value> | ||
public bool OutputCapable { get; protected set; } | ||
/// <summary> | ||
/// Precision (in bits) of the channel | ||
/// </summary> | ||
public byte Precision { get; protected set; } | ||
|
||
/// <summary> | ||
/// Create an AnalogChannelInfo instance | ||
/// </summary> | ||
/// <param name="name">The channel name</param> | ||
/// <param name="precision">The precision (in bits) of the channel</param> | ||
/// <param name="inputCapable">Whether or not the channel is ADC capable</param> | ||
/// <param name="outputCapable">Whether or not the channel is DAC capable</param> | ||
public AnalogChannelInfo(string name, byte precision, bool inputCapable, bool outputCapable) | ||
: base (name) | ||
{ | ||
this.Precision = precision; | ||
this.InputCapable = inputCapable; | ||
this.OutputCapable = outputCapable; | ||
} | ||
/// <value><c>true</c> if input capable; otherwise, <c>false</c>.</value> | ||
public bool InputCapable { get; protected set; } | ||
/// <summary> | ||
/// Whether or not the channel is capable of writing output (i.e. DAC). | ||
/// </summary> | ||
/// <value><c>true</c> if output capable; otherwise, <c>false</c>.</value> | ||
public bool OutputCapable { get; protected set; } | ||
/// <summary> | ||
/// Precision (in bits) of the channel | ||
/// </summary> | ||
public byte Precision { get; protected set; } | ||
|
||
/// <summary> | ||
/// Create an AnalogChannelInfo instance | ||
/// </summary> | ||
/// <param name="name">The channel name</param> | ||
/// <param name="precision">The precision (in bits) of the channel</param> | ||
/// <param name="inputCapable">Whether or not the channel is ADC capable</param> | ||
/// <param name="outputCapable">Whether or not the channel is DAC capable</param> | ||
public AnalogChannelInfo(string name, byte precision, bool inputCapable, bool outputCapable) | ||
: base(name) | ||
{ | ||
this.Precision = precision; | ||
this.InputCapable = inputCapable; | ||
this.OutputCapable = outputCapable; | ||
} | ||
|
||
} |
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,15 +1,19 @@ | ||
using System; | ||
namespace Meadow.Hardware | ||
{ | ||
public class CanChannelInfo : DigitalChannelInfoBase, ICanChannelInfo | ||
{ | ||
public SerialDirectionType SerialDirection { get; protected set; } | ||
namespace Meadow.Hardware; | ||
|
||
public CanChannelInfo(string name, SerialDirectionType serialDirection) | ||
: base(name, true, true, true, true, true, false) | ||
{ | ||
this.SerialDirection = serialDirection; | ||
} | ||
/// <summary> | ||
/// Information about a Controller Area Network (CanChannelInfo) channel | ||
/// </summary> | ||
public class CanChannelInfo : DigitalChannelInfoBase, ICanChannelInfo | ||
{ | ||
/// <summary> | ||
/// Direction | ||
/// </summary> | ||
public SerialDirectionType SerialDirection { get; protected set; } | ||
|
||
public CanChannelInfo(string name, SerialDirectionType serialDirection) | ||
: base(name, true, true, true, true, true, false) | ||
{ | ||
this.SerialDirection = serialDirection; | ||
} | ||
|
||
} |
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,21 +1,33 @@ | ||
using System; | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Information about a digital channel's capabilities | ||
/// </summary> | ||
public class DigitalChannelInfo : DigitalChannelInfoBase | ||
{ | ||
public class DigitalChannelInfo : DigitalChannelInfoBase | ||
/// <summary> | ||
/// Creates a new DigitalChannelInfo instance | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="inputCapable"></param> | ||
/// <param name="outputCapable"></param> | ||
/// <param name="interruptCapable"></param> | ||
/// <param name="pullDownCapable"></param> | ||
/// <param name="pullUpCapable"></param> | ||
/// <param name="inverseLogic"></param> | ||
/// <param name="interruptGroup"></param> | ||
public DigitalChannelInfo( | ||
string name, | ||
bool inputCapable = true, | ||
bool outputCapable = true, | ||
bool interruptCapable = true, | ||
bool pullDownCapable = true, | ||
bool pullUpCapable = true, | ||
bool inverseLogic = false, | ||
int? interruptGroup = null | ||
) | ||
: base(name, inputCapable, outputCapable, interruptCapable, | ||
pullDownCapable, pullUpCapable, inverseLogic, interruptGroup) | ||
{ | ||
public DigitalChannelInfo( | ||
string name, | ||
bool inputCapable = true, | ||
bool outputCapable = true, | ||
bool interruptCapable = true, | ||
bool pullDownCapable = true, | ||
bool pullUpCapable = true, | ||
bool inverseLogic = false, | ||
int? interruptGroup = null | ||
) | ||
: base(name, inputCapable, outputCapable, interruptCapable, | ||
pullDownCapable, pullUpCapable, inverseLogic, interruptGroup) | ||
{ | ||
} | ||
} | ||
} |
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,33 +1,56 @@ | ||
using System; | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Information about a Pulse Width Modulation (PWM) channel | ||
/// </summary> | ||
public class PwmChannelInfo : DigitalChannelInfoBase, IPwmChannelInfo | ||
{ | ||
public class PwmChannelInfo : DigitalChannelInfoBase, IPwmChannelInfo | ||
{ | ||
public float MinimumFrequency { get; protected set; } | ||
public float MaximumFrequency { get; protected set; } | ||
public uint Timer { get; protected set; } | ||
public uint TimerChannel { get; protected set; } | ||
/// <summary> | ||
/// The minimum pulse frequency supported by the channel | ||
/// </summary> | ||
public float MinimumFrequency { get; protected set; } | ||
/// <summary> | ||
/// The maximium pulse frequency supported by the channel | ||
/// </summary> | ||
public float MaximumFrequency { get; protected set; } | ||
/// <summary> | ||
/// Gets the OS system timer number used to drive the PWM | ||
/// </summary> | ||
public uint Timer { get; protected set; } | ||
/// <summary> | ||
/// Gets the OS timer channel used to drive the PWM | ||
/// </summary> | ||
public uint TimerChannel { get; protected set; } | ||
|
||
public PwmChannelInfo(string name, | ||
uint timer, | ||
uint timerChannel, | ||
float minimumFrequency = 0, | ||
float maximumFrequency = 100000, | ||
bool pullDownCapable = false, // does this mean anything in PWM? | ||
bool pullUpCapable = false) // ibid | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
this.Timer = timer; | ||
this.TimerChannel = timerChannel; | ||
this.MinimumFrequency = minimumFrequency; | ||
this.MaximumFrequency = maximumFrequency; | ||
} | ||
/// <summary> | ||
/// Creates a PwmChannelInfo instance | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="timer"></param> | ||
/// <param name="timerChannel"></param> | ||
/// <param name="minimumFrequency"></param> | ||
/// <param name="maximumFrequency"></param> | ||
/// <param name="pullDownCapable"></param> | ||
/// <param name="pullUpCapable"></param> | ||
public PwmChannelInfo(string name, | ||
uint timer, | ||
uint timerChannel, | ||
float minimumFrequency = 0, | ||
float maximumFrequency = 100000, | ||
bool pullDownCapable = false, // does this mean anything in PWM? | ||
bool pullUpCapable = false) // ibid | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
Timer = timer; | ||
TimerChannel = timerChannel; | ||
MinimumFrequency = minimumFrequency; | ||
MaximumFrequency = maximumFrequency; | ||
} | ||
} |
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,24 +1,23 @@ | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
//TODO: what else should this have? allowed speeds? | ||
public class I2cChannelInfo : DigitalChannelInfoBase, II2cChannelInfo | ||
{ | ||
//TODO: what else should this have? allowed speeds? | ||
public class I2cChannelInfo : DigitalChannelInfoBase, II2cChannelInfo | ||
{ | ||
public I2cChannelFunctionType ChannelFunction { get; protected set; } | ||
public I2cChannelFunctionType ChannelFunction { get; protected set; } | ||
|
||
public I2cChannelInfo(string name, | ||
I2cChannelFunctionType channelFunction, | ||
bool pullDownCapable = false, | ||
bool pullUpCapable = false) | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
this.ChannelFunction = channelFunction; | ||
} | ||
public I2cChannelInfo(string name, | ||
I2cChannelFunctionType channelFunction, | ||
bool pullDownCapable = false, | ||
bool pullUpCapable = false) | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
this.ChannelFunction = channelFunction; | ||
} | ||
} |
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,23 +1,22 @@ | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
public class SpiChannelInfo : DigitalChannelInfoBase, ISpiChannelInfo | ||
{ | ||
public class SpiChannelInfo : DigitalChannelInfoBase, ISpiChannelInfo | ||
{ | ||
public SpiLineType LineTypes { get; protected set; } | ||
public SpiLineType LineTypes { get; protected set; } | ||
|
||
public SpiChannelInfo(string name, | ||
SpiLineType lineTypes, | ||
bool pullDownCapable = false, | ||
bool pullUpCapable = false) | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
LineTypes = lineTypes; | ||
} | ||
public SpiChannelInfo(string name, | ||
SpiLineType lineTypes, | ||
bool pullDownCapable = false, | ||
bool pullUpCapable = false) | ||
: base( | ||
name, | ||
inputCapable: true, | ||
outputCapable: true, | ||
interruptCapable: false, // ?? i mean, technically, yes, but will we have events? | ||
pullDownCapable: pullDownCapable, | ||
pullUpCapable: pullUpCapable, | ||
inverseLogic: false) //TODO: switch to C# 7.2+ to get rid of trailing names | ||
{ | ||
LineTypes = lineTypes; | ||
} | ||
} |
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,12 +1,20 @@ | ||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// The types of antenna that can be selected. | ||
/// </summary> | ||
public enum AntennaType | ||
{ | ||
/// <summary> | ||
/// The types of antenna that can be selected. | ||
/// Unknown | ||
/// </summary> | ||
public enum AntennaType | ||
{ | ||
NotKnown = 0, | ||
OnBoard = 1, | ||
External = 2 | ||
}; | ||
} | ||
NotKnown = 0, | ||
/// <summary> | ||
/// On-board antenna | ||
/// </summary> | ||
OnBoard = 1, | ||
/// <summary> | ||
/// External antenna | ||
/// </summary> | ||
External = 2 | ||
}; |
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,11 +1,16 @@ | ||
namespace Meadow | ||
namespace Meadow; | ||
|
||
/// <summary> | ||
/// Describes the byte ordering for muli-byte words. | ||
/// </summary> | ||
public enum ByteOrder | ||
{ | ||
/// <summary> | ||
/// Describes the byte ordering for muli-byte words. | ||
/// Little-endian byte ordering | ||
/// </summary> | ||
public enum ByteOrder | ||
{ | ||
LittleEndian, | ||
BigEndian | ||
}; | ||
} | ||
LittleEndian, | ||
/// <summary> | ||
/// Big-endian byte ordering | ||
/// </summary> | ||
BigEndian | ||
}; |
Oops, something went wrong.