SPI constructor

SPI(
  1. int bus,
  2. int chip,
  3. SPImode mode,
  4. int maxSpeed,
)

Opens the SPI device at the path ("/dev/spidevbus.chip"), with the specified SPI mode, specified maxSpeed in hertz, and the defaults of MSB_FIRST bit order, and 8 bits per word.

SPI mode can be 0, 1, 2, or 3.

Implementation

SPI(this.bus, this.chip, this.mode, this.maxSpeed)
    : bitOrder = BitOrder.msbFirst,
      bitsPerWord = 8,
      extraFlags = 0,
      path = '/dev/spidev$bus.$chip' {
  _checkSPI(bus, chip);
  _spiHandle = _spiOpen(path, mode, maxSpeed);
}