-
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 #249 from WildernessLabs/feature/channel-info
improving I2C channel info
- Loading branch information
Showing
4 changed files
with
50 additions
and
50 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
79 changes: 39 additions & 40 deletions
79
Source/Meadow.Contracts/Hardware/Contracts/PortsAndBuses/ISpiBus.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 |
---|---|---|
@@ -1,50 +1,49 @@ | ||
using System; | ||
|
||
namespace Meadow.Hardware | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Represents an SPI bus. | ||
/// </summary> | ||
public interface ISpiBus | ||
{ | ||
/// <summary> | ||
/// Represents an SPI bus. | ||
/// Gets an array of all supported speeds of the SPI bus. | ||
/// </summary> | ||
public interface ISpiBus | ||
{ | ||
/// <summary> | ||
/// Gets an array of all supported speeds of the SPI bus. | ||
/// </summary> | ||
Units.Frequency[] SupportedSpeeds { get; } | ||
Units.Frequency[] SupportedSpeeds { get; } | ||
|
||
/// <summary> | ||
/// Gets the current SPI clock configuration. | ||
/// </summary> | ||
SpiClockConfiguration Configuration { get; } | ||
/// <summary> | ||
/// Gets the current SPI clock configuration. | ||
/// </summary> | ||
SpiClockConfiguration Configuration { get; } | ||
|
||
/// <summary> | ||
/// Reads data from the SPI bus into the specified buffer. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the bus.</param> | ||
/// <param name="readBuffer">The buffer to read data into.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Read(IDigitalOutputPort? chipSelect, | ||
Span<byte> readBuffer, | ||
ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
/// <summary> | ||
/// Reads data from the SPI bus into the specified buffer. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the bus.</param> | ||
/// <param name="readBuffer">The buffer to read data into.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Read(IDigitalOutputPort? chipSelect, | ||
Span<byte> readBuffer, | ||
ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
|
||
/// <summary> | ||
/// Writes data to the SPI bus. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the peripheral.</param> | ||
/// <param name="writeBuffer">The buffer containing data to write.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Write( | ||
IDigitalOutputPort? chipSelect, | ||
Span<byte> writeBuffer, | ||
ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
/// <summary> | ||
/// Writes data to the SPI bus. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the peripheral.</param> | ||
/// <param name="writeBuffer">The buffer containing data to write.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Write( | ||
IDigitalOutputPort? chipSelect, | ||
Span<byte> writeBuffer, | ||
ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
|
||
/// <summary> | ||
/// Writes data from the write buffer to a peripheral on the bus while reading return data into the read buffer. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the peripheral.</param> | ||
/// <param name="writeBuffer">The buffer containing data to write.</param> | ||
/// <param name="readBuffer">The buffer to read returning data into.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Exchange(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
} | ||
/// <summary> | ||
/// Writes data from the write buffer to a peripheral on the bus while reading return data into the read buffer. | ||
/// </summary> | ||
/// <param name="chipSelect">The chip select port to activate the peripheral.</param> | ||
/// <param name="writeBuffer">The buffer containing data to write.</param> | ||
/// <param name="readBuffer">The buffer to read returning data into.</param> | ||
/// <param name="csMode">The chip select mode that activates the peripheral.</param> | ||
void Exchange(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow); | ||
} |