TsctlSPIEdgeSetDesc
From embeddedTS Manuals
This function changes the edge on which SPI data is clocked.
The posedge parameter encodes both the standard CPOL and CPHA parameters, which are defined as follows:
- CPOL is the base (inactive) clock state
- CPHA is the edge to sample on (0=1st or leading, 1=2nd or trailing). Data changes on the opposite edge than it is sampled on. MOSI and MISO change on the same clock edge.
When positive, the posedge parameter primarily denotes the value of CPOL. When negative, the logical bit-wise note of this parameter denotes the value of CPOL. (-1 means CPOL=0 and -2 means CPOL=1)
When posedge is non-negative, CPHA=0. When it is negative, CPHA=1.
The following table summarizes these relationships:
posedge | CPOL | CPHA |
1 | 1 | 0 |
0 | 0 | 0 |
-1 | 0 | 1 |
-2 | 1 | 1 |
Note:The TS-4500/TS-4700/TS-4800 have only CPHA=0, with the posedge parameter being equal to CPOL.
A positive value is returned on success, and a negative value on failure (i.e. if the device does not support the requested posedge value).