setcfg function

Updated: May 06, 2022

The setcfg function changes the configuration of specific devices on the SPI bus. The prototype for this function is:

int setcfg( void *hdl,
            uint16_t device,
            spi_cfg_t *cfg );

The arguments are:

hdl
The handle of the low-level module that the init function returned.
device
The device ID.
cfg
A pointer to the configuration structure. This structure is defined as:
typedef struct {
    uint32_t    mode;
    uint32_t    clock_rate;
} spi_cfg_t;
  

This function must return EOK, or EINVAL if either the device ID or the configuration is invalid.