SPISettingsThe SPISettings object is used to configure the SPI port for your SPI device. All 3 parameters are combined to a single SPISettings object, which is given to SPI.beginTransaction(). SPISettings spi_settings = SPISettings(speed, dataOrder, spiMode); speed 8000000, 4000000, 2000000 or 1000000 MHz. Speed of communication. Z-Uno supports only 8MHz, 4MHz, 2MHz and 1MHz. Z-Uno will automatically use the best speed that is equal to or less than one of the supported. dataOrder MSBFIRST or LSBFIRST. spiMode SPI_MODE0, SPI_MODE1, SPI_MODE2, SPI_MODE3 — SPI mode number. Please refer to SPI modes description.
SPISettings spi_settings = SPISettings(8000000, MSBFIRST, SPI_MODE0); SPI.beginTransaction(&spi_settings);