using System;
namespace Unosquare.RaspberryIO.Abstractions {
///
/// Interface for GPIO Pin on a RaspberryPi board.
///
public interface IGpioPin {
///
/// Gets the .
///
///
/// The pin number.
///
BcmPin BcmPin {
get;
}
///
/// Gets the BCM chip (hardware) pin number.
///
///
/// The pin number.
///
Int32 BcmPinNumber {
get;
}
///
/// Gets the physical (header) pin number.
///
Int32 PhysicalPinNumber {
get;
}
///
/// Gets the pin's header (physical board) location.
///
GpioHeader Header {
get;
}
///
/// Gets or sets the pin operating mode.
///
///
/// The pin mode.
///
GpioPinDriveMode PinMode {
get; set;
}
///
/// This sets or gets the pull-up or pull-down resistor mode on the pin, which should be set as an input.
/// Unlike the Arduino, the BCM2835 has both pull-up an down internal resistors.
/// The parameter pud should be; PUD_OFF, (no pull up/down), PUD_DOWN (pull to ground) or PUD_UP (pull to 3.3v)
/// The internal pull up/down resistors have a value of approximately 50KΩ on the Raspberry Pi.
///
GpioPinResistorPullMode InputPullMode {
get; set;
}
///
/// Gets or sets a value indicating whether this is value.
///
///
/// true if value; otherwise, false.
///
Boolean Value {
get; set;
}
///
/// Reads the digital value on the pin as a boolean value.
///
/// The state of the pin.
Boolean Read();
///
/// Writes the specified bit value.
/// This method performs a digital write.
///
/// if set to true [value].
void Write(Boolean value);
///
/// Writes the specified pin value.
/// This method performs a digital write.
///
/// The value.
void Write(GpioPinValue value);
///
/// Wait for specific pin status.
///
/// status to check.
/// timeout to reach status.
/// true/false.
Boolean WaitForValue(GpioPinValue status, Int32 timeOutMillisecond);
///
/// Registers the interrupt callback on the pin. Pin mode has to be set to Input.
///
/// The edge detection.
/// The callback function. This function is called whenever
/// the interrupt occurs.
void RegisterInterruptCallback(EdgeDetection edgeDetection, Action callback);
///
/// Registers the interrupt callback on the pin. Pin mode has to be set to Input.
///
/// The edge detection.
/// The callback function. This function is called whenever the interrupt occurs.
/// The function is passed the GPIO, the current level, and the current tick
/// (The number of microseconds since boot).
void RegisterInterruptCallback(EdgeDetection edgeDetection, Action callback);
}
}