Types
Hardware SPI data types. More...
Data Structures |
|
struct | gos_spi_message_t |
SPI data message used by
gos_spi_master_transfer()
More...
|
|
struct | gos_spi_device_t |
SPI slave context used by
gos_spi_master_transfer()
More...
|
|
Typedefs |
|
typedef void(* | gos_spi_cs_callback_t ) (void *arg, bool asserted) |
SPI CS assert/de-assert callback.
More...
|
|
Enumerations |
|
enum |
gos_spi_flag_t
{
GOS_SPI_CLOCK_RISING_EDGE = ( 1 << 0 ), GOS_SPI_CLOCK_FALLING_EDGE = ( 0 << 0 ), GOS_SPI_CLOCK_IDLE_HIGH = ( 1 << 1 ), GOS_SPI_CLOCK_IDLE_LOW = ( 0 << 1 ), GOS_SPI_MSB_FIRST = ( 1 << 2 ), GOS_SPI_LSB_FIRST = ( 0 << 2 ), GOS_SPI_READ_AFTER_WRITE = ( 1 << 3 ), GOS_SPI_NO_READ_AFTER_WRITE = ( 0 << 3 ), GOS_SPI_KEEP_ASSERTED = ( 1 << 4 ), GOS_SPI_DONT_KEEP_ASSERTED = ( 0 << 4 ), GOS_SPI_HEXIFY = ( 1 << 5 ), GOS_SPI_NO_HEXIFY = ( 0 << 5 ), GOS_SPI_SLAVE_HW_NSS = ( 1 << 6 ), GOS_SPI_SLAVE_NO_HW_NSS = ( 0 << 6 ), GOS_SPI_QUAD_ENABLED = ( 1 << 6 ), GOS_SPI_QUAD_DISABLED = ( 0 << 6 ), GOS_SPI_MASTER_MODE = ( 0 << 7 ), GOS_SPI_SLAVE_MODE = ( 1 << 7 ), GOS_SPI_LOOPBACK_MODE = ( 1 << 8 ), GOS_SPI_LCD_9BIT_MODE = ( 1 << 9 ), GOS_SPI_CS_ACTIVE_HIGH = ( 1 << 11 ), GOS_SPI_CS_ACTIVE_LOW = ( 0 << 11 ) } |
enum |
gos_spi_t
{
GOS_SPI_0 , GOS_SPI_MAX } |
Detailed Description
Hardware SPI data types.
Typedef Documentation
◆ gos_spi_cs_callback_t
typedef void(* gos_spi_cs_callback_t) (void *arg, bool asserted) |
SPI CS assert/de-assert callback.
This callback is invoked by the SPI driver when the chip select (CS) signal should be asserted/de-asserted.
This is useful for cases when the CS signal is not directly connected to a GPIO (e.g. IO expander).
- Parameters
-
[in] arg
Optional argument specified in gos_spi_device_t [in] asserted
true if CS should be asserted, false else
Enumeration Type Documentation
◆ gos_spi_flag_t
enum gos_spi_flag_t |
SPI device flags
Enumerator | |
---|---|
GOS_SPI_CLOCK_RISING_EDGE |
Data is valid on rising edge. |
GOS_SPI_CLOCK_FALLING_EDGE |
Data is valid on falling edge. |
GOS_SPI_CLOCK_IDLE_HIGH |
Clock idles high. |
GOS_SPI_CLOCK_IDLE_LOW |
Clock idles low. |
GOS_SPI_MSB_FIRST |
Shift Most-Significant Bit first. |
GOS_SPI_LSB_FIRST |
Shift Least-Significant Bit first. |
GOS_SPI_READ_AFTER_WRITE |
Allow for reading after writing flag When this is specified, when data is written to the SPI slave, the simultaneously read data is buffered. If this flag is not specified, when data is written, the read data is dropped.
|
GOS_SPI_NO_READ_AFTER_WRITE |
Don't read after writing. (i.e. drop read data while writing)
|
GOS_SPI_KEEP_ASSERTED |
Keep the slave-select signal asserted after the API call For the 'stream' API, this have has the following behavior: Sometimes it is necessary to keep the slave-select asserted between reads/writes. If this flag is not specified (i.e. GOS_SPI_DONT_KEEP_ASSERTED ) the slave-select is de-asserted after a read/write command. When this flag is specified, after a slave-select is asserted for a read/write command, it remains asserted until one of the events occurs:
|
GOS_SPI_DONT_KEEP_ASSERTED |
De-select the slave-select signal after the API call. |
GOS_SPI_HEXIFY |
When set, input data to the write command is converted from a hex string to binary. Output data from the read command is converted from binary to a hex string.
|
GOS_SPI_NO_HEXIFY |
Read/write data is always binary. |
GOS_SPI_SLAVE_HW_NSS |
GOS_SPI_SLAVE_HW_NSS. |
GOS_SPI_SLAVE_NO_HW_NSS |
GOS_SPI_SLAVE_NO_HW_NSS. |
GOS_SPI_QUAD_ENABLED |
GOS_SPI_QUAD_ENABLED. |
GOS_SPI_QUAD_DISABLED |
GOS_SPI_QUAD_DISABLED. |
GOS_SPI_MASTER_MODE |
GOS_SPI_MASTER_MODE. |
GOS_SPI_SLAVE_MODE |
GOS_SPI_SLAVE_MODE. |
GOS_SPI_LOOPBACK_MODE |
Local loopback mode enable. |
GOS_SPI_LCD_9BIT_MODE |
9 bit LCD mode. When set, this will set the number of bits per frame to 9, but will send and receive 8 bit data chunks for the application. The 9th bit (bit position 8) is controlled by the lcd_bit8 setting in gos_spi_device_t . |
GOS_SPI_CS_ACTIVE_HIGH |
The chip-select is asserted when the GPIO is driven HIGH. |
GOS_SPI_CS_ACTIVE_LOW |
The chip-select is asserted when the GPIO is driven LOW. |
◆ gos_spi_t
enum gos_spi_t |