Skip to main content

Spi Class

Package: GHIElectronics.Endpoint.Core
Namespace: GHIElectronics.Endpoint.Core

The SPI buses bundled with EPM815, for .NET's System.Device.Spi. Spi.Initialize connects the bus's pins and loads the SPI driver; then use SpiDevice as usual. Each constant is the bus number for SpiConnectionSettings (/dev/spidevN.0), fixed by the firmware. Chip select is not driven by the bus: use any GPIO pin.

class Spi: ...

Methods​

Initialize(int bus, int bufferSize)​

@staticmethod
def Initialize(bus: int, bufferSize: int) -> None:

Connects the bus's pins and loads the SPI driver (spidev) if needed

ParameterTypeDescription
busintSpi1, Spi4 or Spi5
bufferSizeintThe largest transfer in bytes. It is set when the driver loads, so for all buses: the first Initialize after boot decides it.

UnInitialize(int bus)​

@staticmethod
def UnInitialize(bus: int) -> None:

Gives the bus's pins back, as they were before Initialize

Fields​

DefaultBufferSize​

DefaultBufferSize: int = 4096

The largest transfer when none is given (the system's default)

Spi1​

Spi1: int = 0

SPI1: PZ0 (SCK), PZ1 (MISO), PZ2 (MOSI); /dev/spidev0.0

Spi4​

Spi4: int = 1

SPI4: PE12 (SCK), PE13 (MISO), PE14 (MOSI); /dev/spidev1.0

Spi5​

Spi5: int = 2

SPI5: PF7 (SCK), PF8 (MISO), PF9 (MOSI); /dev/spidev2.0