|
Synopsis
int sub_sdio_transfer( sub_handle hndl, char* out_buf, char* in_buf,
int out_sz, int in_sz, int ss_config )
Perform 3-Wire compatible SPI master transaction like one shown below.

| 1. | SS changes according to ss_config parameter. |
| 2. | out_sz bytes are transmitted via MOSI. MOSI will be in output state during transfer. |
| 3. | MOSI state is changed to HiZ after last bit transmitted. If required SS changes. |
| 4. | in_sz bytes received from MISO input. MOSI left in HiZ state. |
| 5. | SS changes according to ss_config parameter |
SPI Clock - SCK phase and polarity can be configured with sub_spi_config.
Above implementation of SPI transaction allows using of the SUB-20 as 3-Wire SPI master. In this case connection to 3-Wire device should be as following:

Parameters
| • | out_buf - Output data buffer. |
| • | in_buf - Input buffer to store read data. |
| • | out_sz - Number of bytes to transmit in range 0..60. |
| • | in_sz - Number of bytes to receive in range 0..60. |
| • | ss_config - Determines selection and operation of SS pin. ss_config value must be created with macro |
SS_CONF(SS_N,SS_MODE) ,
where SS_N is SS pin number and SS_MODE is one of the following flags:
SS_HL
|
SS goes high and stays high during transmit stage, after that it goes low
|
SS_HI
|
SS goes high and stays high during entire transaction (transmit and receive), after that it goes low
|
|
|
SS_LH
|
SS goes low and stays low during transmit stage, after that it goes high
|
SS_LO
|
SS goes low and stays low during entire transaction (transmit and receive), after that it goes high
|
|
|
SS_HiZ
|
SS stays in HiZ mode (Except SS0)
|
If ss_config is zero there will be no SS activity (changes).
Return value
On success function returns 0. Otherwise error code.
Example
/* Transmit one byte and receive 3 bytes */
/* SS1 goes low during transaction */
sub_sdio_transfer( hndl, out_buf, in_buf, 1, 3, SS_CONF(1,SS_LO) );
Compatibility
FW version
|
0.1.9 or grater
|
Library version
|
0.1.12.11 or grater
|
|