Unosquare
    Show / Hide Table of Contents

    Class BoardPeripheralsService

    Provides methods to open communication links on the available buses such as SPI, I2C, and UART.

    Inheritance
    Object
    BoardPeripheralsService
    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 BoardPeripheralsService

    Methods

    OpenI2cDevice(Byte)

    Opens an I2C device on Bus 1 (the default I2C Bus).

    Declaration
    public I2cDevice OpenI2cDevice(byte address)
    Parameters
    Type Name Description
    Byte address

    The address.

    Returns
    Type Description
    I2cDevice

    The I2C device.

    OpenI2cDevice(I2cBusId, Byte)

    Opens an I2C device on the given bus.

    Declaration
    public I2cDevice OpenI2cDevice(I2cBusId bus, byte address)
    Parameters
    Type Name Description
    I2cBusId bus

    The bus.

    Byte address

    The address.

    Returns
    Type Description
    I2cDevice

    The I2C device.

    OpenSoftI2cBus(GpioPin, GpioPin)

    Opens a software based I2C bus.

    Declaration
    public SoftI2cBus OpenSoftI2cBus(GpioPin dataPin, GpioPin clockPin)
    Parameters
    Type Name Description
    GpioPin dataPin

    The data pin.

    GpioPin clockPin

    The clock pin.

    Returns
    Type Description
    SoftI2cBus

    I2C Bus Accessor.

    OpenSoftI2cBus(GpioPin, GpioPin, Int32)

    Opens a software based I2C bus.

    Declaration
    public SoftI2cBus OpenSoftI2cBus(GpioPin dataPin, GpioPin clockPin, int baudRate)
    Parameters
    Type Name Description
    GpioPin dataPin

    The data pin.

    GpioPin clockPin

    The clock pin.

    Int32 baudRate

    The baud rate from 50 t 500,000 bits per second.

    Returns
    Type Description
    SoftI2cBus

    I2C Bus Accessor.

    OpenSoftSerialPort(GpioPin, GpioPin, UartRate)

    Opens a software (bit-banged) serial port.

    Declaration
    public SoftSerialPort OpenSoftSerialPort(GpioPin receivePin, GpioPin transmitPin, UartRate baudRate)
    Parameters
    Type Name Description
    GpioPin receivePin

    The receive pin.

    GpioPin transmitPin

    The transmit pin.

    UartRate baudRate

    The baud rate.

    Returns
    Type Description
    SoftSerialPort

    The software serial port.

    OpenSoftSerialPort(GpioPin, GpioPin, UartRate, Int32, Boolean)

    Opens a software (bit-banged) serial port.

    Declaration
    public SoftSerialPort OpenSoftSerialPort(GpioPin receivePin, GpioPin transmitPin, UartRate baudRate, int dataBits, bool invert)
    Parameters
    Type Name Description
    GpioPin receivePin

    The receive pin.

    GpioPin transmitPin

    The transmit pin.

    UartRate baudRate

    The baud rate.

    Int32 dataBits

    The data bits.

    Boolean invert

    if set to true [invert].

    Returns
    Type Description
    SoftSerialPort

    The software serial port.

    OpenSoftSpiChannel(GpioPin, GpioPin, GpioPin, GpioPin)

    Opens a software based (bit-banged) SPI channel.

    Declaration
    public SoftSpiChannel OpenSoftSpiChannel(GpioPin csPin, GpioPin misoPin, GpioPin mosiPin, GpioPin clockPin)
    Parameters
    Type Name Description
    GpioPin csPin

    The cs pin.

    GpioPin misoPin

    The miso pin.

    GpioPin mosiPin

    The mosi pin.

    GpioPin clockPin

    The clock pin.

    Returns
    Type Description
    SoftSpiChannel

    The SPI channel.

    OpenSoftSpiChannel(GpioPin, GpioPin, GpioPin, GpioPin, Int32)

    Opens a software based (bit-banged) SPI channel.

    Declaration
    public SoftSpiChannel OpenSoftSpiChannel(GpioPin csPin, GpioPin misoPin, GpioPin mosiPin, GpioPin clockPin, int baudRate)
    Parameters
    Type Name Description
    GpioPin csPin

    The cs pin.

    GpioPin misoPin

    The miso pin.

    GpioPin mosiPin

    The mosi pin.

    GpioPin clockPin

    The clock pin.

    Int32 baudRate

    The baud rate.

    Returns
    Type Description
    SoftSpiChannel

    The SPI channel.

    OpenSoftSpiChannel(GpioPin, GpioPin, GpioPin, GpioPin, Int32, SoftSpiFlags)

    Opens a software based (bit-banged) SPI channel.

    Declaration
    public SoftSpiChannel OpenSoftSpiChannel(GpioPin csPin, GpioPin misoPin, GpioPin mosiPin, GpioPin clockPin, int baudRate, SoftSpiFlags flags)
    Parameters
    Type Name Description
    GpioPin csPin

    The cs pin.

    GpioPin misoPin

    The miso pin.

    GpioPin mosiPin

    The mosi pin.

    GpioPin clockPin

    The clock pin.

    Int32 baudRate

    The baud rate.

    SoftSpiFlags flags

    The flags.

    Returns
    Type Description
    SoftSpiChannel

    The SPI channel.

    OpenSpiChannel(SpiChannelId)

    Opens the given SPI channel using the default flags and a baud rate of 512k bits per second.

    Declaration
    public SpiChannel OpenSpiChannel(SpiChannelId channel)
    Parameters
    Type Name Description
    SpiChannelId channel

    The channel.

    Returns
    Type Description
    SpiChannel

    The peripheral service.

    OpenSpiChannel(SpiChannelId, Int32)

    Opens the given SPI channel using the default flags.

    Declaration
    public SpiChannel OpenSpiChannel(SpiChannelId channel, int baudRate)
    Parameters
    Type Name Description
    SpiChannelId channel

    The channel.

    Int32 baudRate

    The baud rate.

    Returns
    Type Description
    SpiChannel

    The peripheral service.

    OpenSpiChannel(SpiChannelId, Int32, SpiFlags)

    Opens the given SPI channel.

    Declaration
    public SpiChannel OpenSpiChannel(SpiChannelId channel, int baudRate, SpiFlags flags)
    Parameters
    Type Name Description
    SpiChannelId channel

    The channel.

    Int32 baudRate

    The baud rate.

    SpiFlags flags

    The flags.

    Returns
    Type Description
    SpiChannel

    The peripheral service.

    OpenUartPort(String, UartRate)

    Opens the specified UART port.

    Declaration
    public UartPort OpenUartPort(string portName, UartRate baudRate)
    Parameters
    Type Name Description
    String portName

    Name of the port.

    UartRate baudRate

    The baud rate.

    Returns
    Type Description
    UartPort

    The UART port object.

    ScanI2cBus()

    Scans the default I2C bus for devices.

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

    The found device addresses.

    ScanI2cBus(I2cBusId)

    Scans the I2C bus for devices.

    Declaration
    public byte[] ScanI2cBus(I2cBusId bus)
    Parameters
    Type Name Description
    I2cBusId bus

    The bus.

    Returns
    Type Description
    Byte[]

    A list of device addresses.

    Comments

    Back to top Copyright © 2017-2019 Unosquare