Description

setDataMode() sets the SPI data mode, which defines the clock polarity (CPOL) and clock phase (CPHA). See the Wikipedia article on SPI for details.

This function is part of the SPI library. See the SPI main page for more information.

Syntax

  • SPI.setDataMode(mode)
  • SPI.setDataMode(chipSelectPin, mode) (Arduino Due only)

Parameters

  • mode: the SPI data mode. Allowed values:
    • SPI_MODE0: CPOL = 0, CPHA = 0
    • SPI_MODE1: CPOL = 0, CPHA = 1
    • SPI_MODE2: CPOL = 1, CPHA = 0
    • SPI_MODE3: CPOL = 1, CPHA = 1
  • chipSelectPin: peripheral device chip select pin (Arduino Due only).

Returns

Nothing.

Notes and Warnings

This function is deprecated and should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters.