RaspberryIO/Unosquare.RaspberryIO/Native/WiringPi.Shift.cs
2019-12-03 18:43:54 +01:00

36 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Runtime.InteropServices;
namespace Unosquare.RaspberryIO.Native {
public partial class WiringPi {
#region WiringPi - Shift Library
/// <summary>
/// This shifts an 8-bit data value in with the data appearing on the dPin and the clock being sent out on the cPin.
/// Order is either LSBFIRST or MSBFIRST. The data is sampled after the cPin goes high.
/// (So cPin high, sample data, cPin low, repeat for 8 bits) The 8-bit value is returned by the function.
/// </summary>
/// <param name="dPin">The d pin.</param>
/// <param name="cPin">The c pin.</param>
/// <param name="order">The order.</param>
/// <returns>The result</returns>
[DllImport(WiringPiLibrary, EntryPoint = "shiftIn", SetLastError = true)]
public static extern Byte ShiftIn(Byte dPin, Byte cPin, Byte order);
/// <summary>
/// The shifts an 8-bit data value val out with the data being sent out on dPin and the clock being sent out on the cPin.
/// order is as above. Data is clocked out on the rising or falling edge ie. dPin is set, then cPin is taken high then low
/// repeated for the 8 bits.
/// </summary>
/// <param name="dPin">The d pin.</param>
/// <param name="cPin">The c pin.</param>
/// <param name="order">The order.</param>
/// <param name="val">The value.</param>
[DllImport(WiringPiLibrary, EntryPoint = "shiftOut", SetLastError = true)]
public static extern void ShiftOut(Byte dPin, Byte cPin, Byte order, Byte val);
#endregion
}
}