CTL_STATUS_t ctl_spi_set_protocol(CTL_SPI_DEVICE_t *self, int mode, int width, unsigned long speed, int idle);
ctl_spi_set_protocol sets the SPI parameters parameters for the device self. You can set the operating parameters of a device whether it is attached to an SPI bus or not.
ctl_spi_set_protocol returns a standard status code.
If the device is already attached to a bus and is selected, ctl_spi_set_protocol will change the operating parameters of the bus immediately. In this case, if the parameters are invalid or cannot be honored by the underlying SPI bus, ctl_spi_set_protocol will return an error indication immediately. If the device is not attached to a bus or is not selected, the parameters are stored and the bus protocol set when the device is selected. In this case, ctl_spi_set_protocol will return a success indication, leaving validation of the parameters to the time when the device is selected onto the bus using ctl_spi_select_device.