Unosquare
    Show / Hide Table of Contents

    Class GpioBank

    Provides access to bulk GPIO read and write operations.

    Inheritance
    Object
    GpioBank
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unosquare.PiGpio.ManagedModel
    Syntax
    public sealed class GpioBank

    Properties

    BankNumber

    Gets the bank number; 1 or 2.

    Declaration
    public int BankNumber { get; }
    Property Value
    Type Description
    Int32

    GpioCount

    Gets the number of gpio pins for this bank.

    Declaration
    public int GpioCount { get; }
    Property Value
    Type Description
    Int32

    MaxGpioIndex

    Gets the maximum index of the gpio bank.

    Declaration
    public int MaxGpioIndex { get; }
    Property Value
    Type Description
    Int32

    MinGpioIndex

    Gets the minimum index of the gpio bank.

    Declaration
    public int MinGpioIndex { get; }
    Property Value
    Type Description
    Int32

    Methods

    ClearBits(BitMask)

    Clears the bits according to the bit mask. For bank 1, the starting index is GPIO 00. For bank 2, the starting index is GPIO 32. This means that for bank 2, bit 33 is addressed as Bit01 in the bit mask.

    Declaration
    public void ClearBits(BitMask bitMask)
    Parameters
    Type Name Description
    BitMask bitMask

    The bit mask.

    ReadBinLiteral()

    Reads from the bank and returns a series of 0s and 1s from MSB to LSB. Please note the output of the Bit Array is reversed so that the MSB is the first character.

    Declaration
    public string ReadBinLiteral()
    Returns
    Type Description
    String

    A string containing 0s and 1s.

    ReadBits()

    Reads the value of all the GPIO pins at once, where the 0th index of the array is the lowest pin index (LSB) and the 31st index of the array is the highes pin index (MSB).

    Declaration
    public BitArray ReadBits()
    Returns
    Type Description
    BitArray

    The bits read.

    ReadBytes()

    Reads the value of all the GPIO pins at once as an array of 4 bytes. The 0th index of the result is the Least Significant Byte (low index pins pins). The 3rd index of the result is the Most Significant Byte (high index pins).

    Declaration
    public byte[] ReadBytes()
    Returns
    Type Description
    Byte[]

    The bytes that were read.

    ReadHexLiteral()

    Reads from the bank and returns a series of hexadecimal chars from MSB to LSB. Please note the output of the byte array is reversed so that the left-most characters are the MSB.

    Declaration
    public string ReadHexLiteral()
    Returns
    Type Description
    String

    A string containing the hexadecimal chars.

    ReadValue()

    Reads the value of all the GPIO pins at once as an unsigned, 32-bit integer.

    Declaration
    public uint ReadValue()
    Returns
    Type Description
    UInt32

    The current value of all pins.

    SetBits(BitMask)

    Sets the bits according to the bit mask. For bank 1, the starting index is GPIO 00. For bank 2, the starting index is GPIO 32. This means that for bank 2, bit 33 is addressed as Bit01 in the bit mask.

    Declaration
    public void SetBits(BitMask bitMask)
    Parameters
    Type Name Description
    BitMask bitMask

    The bit mask.

    ToBinLiteral(BitArray)

    Returns a series of 0s and 1s from MSB to LSB. Please note the output of the Bit Array is reversed.

    Declaration
    public static string ToBinLiteral(BitArray bits)
    Parameters
    Type Name Description
    BitArray bits

    The bits.

    Returns
    Type Description
    String

    A string containing 0s and 1s.

    ToHexLiteral(Byte[])

    Returns a series of hexadecimal chars from MSB to LSB. Please note the output of the byte array is reversed.

    Declaration
    public static string ToHexLiteral(byte[] bytes)
    Parameters
    Type Name Description
    Byte[] bytes

    The bytes.

    Returns
    Type Description
    String

    A string containing the hexadecimal chars.

    Comments

    Back to top Copyright © 2017-2019 Unosquare