You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @brief This is a configuration for a SPI slave device that is connected to one of the SPI buses.
80
80
*/
81
81
typedefstruct {
82
-
uint8_tcommand_bits; ///< Amount of bits in command phase (0-16)
83
-
uint8_taddress_bits; ///< Amount of bits in address phase (0-64)
84
-
uint8_tdummy_bits; ///< Amount of dummy bits to insert between address and data phase
85
-
uint8_tmode; ///< SPI mode (0-3)
86
-
uint8_tduty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128.
87
-
uint8_tcs_ena_pretrans; ///< Amount of SPI bit-cycles the cs should be activated before the transmission (0-16). This only works on half-duplex transactions.
88
-
uint8_tcs_ena_posttrans; ///< Amount of SPI bit-cycles the cs should stay active after the transmission (0-16)
89
-
intclock_speed_hz; ///< Clock speed, in Hz
90
-
intspics_io_num; ///< CS GPIO pin for this device, handled by hardware; set to -1 if not used
91
-
intspics_ext_io_num; ///< CS GPIO pin for this device, handled by software (spi_lobo_device_select/spi_lobo_device_deselect); only used if spics_io_num=-1
92
-
uint32_tflags; ///< Bitwise OR of SPI_DEVICE_* flags
93
-
transaction_cb_tpre_cb;///< Callback to be called before a transmission is started. This callback from 'spi_lobo_transfer_data' function.
94
-
transaction_cb_tpost_cb;///< Callback to be called after a transmission has completed. This callback from 'spi_lobo_transfer_data' function.
95
-
uint8_tselected; ///< **INTERNAL** 1 if the device's CS pin is active
82
+
uint8_tcommand_bits; ///< Amount of bits in command phase (0-16)
83
+
uint8_taddress_bits; ///< Amount of bits in address phase (0-64)
84
+
uint8_tdummy_bits; ///< Amount of dummy bits to insert between address and data phase
85
+
uint8_tmode; ///< SPI mode (0-3)
86
+
uint8_tduty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128.
87
+
uint8_tcs_ena_pretrans; ///< Amount of SPI bit-cycles the cs should be activated before the transmission (0-16). This only works on half-duplex transactions.
88
+
uint8_tcs_ena_posttrans; ///< Amount of SPI bit-cycles the cs should stay active after the transmission (0-16)
89
+
intclock_speed_hz; ///< Clock speed, in Hz
90
+
intspics_io_num; ///< CS GPIO pin for this device, handled by hardware; set to -1 if not used
91
+
intspics_ext_io_num; ///< CS GPIO pin for this device, handled by software (spi_lobo_device_select/spi_lobo_device_deselect); only used if spics_io_num=-1
92
+
uint32_tflags; ///< Bitwise OR of LB_SPI_DEVICE_* flags
93
+
spi_lobo_transaction_cb_tpre_cb; ///< Callback to be called before a transmission is started. This callback from 'spi_lobo_transfer_data' function.
94
+
spi_lobo_transaction_cb_tpost_cb; ///< Callback to be called after a transmission has completed. This callback from 'spi_lobo_transfer_data' function.
95
+
uint8_tselected; ///< **INTERNAL** 1 if the device's CS pin is active
96
96
} spi_lobo_device_interface_config_t;
97
97
98
98
99
-
#defineSPI_TRANS_MODE_DIO (1<<0) ///< Transmit/receive data in 2-bit mode
100
-
#defineSPI_TRANS_MODE_QIO (1<<1) ///< Transmit/receive data in 4-bit mode
101
-
#defineSPI_TRANS_MODE_DIOQIO_ADDR (1<<2) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
102
-
#defineSPI_TRANS_USE_RXDATA (1<<3) ///< Receive into rx_data member of spi_lobo_transaction_t instead into memory at rx_buffer.
103
-
#defineSPI_TRANS_USE_TXDATA (1<<4) ///< Transmit tx_data member of spi_lobo_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
99
+
#defineLB_SPI_TRANS_MODE_DIO (1<<0) ///< Transmit/receive data in 2-bit mode
100
+
#defineLB_SPI_TRANS_MODE_QIO (1<<1) ///< Transmit/receive data in 4-bit mode
101
+
#defineLB_SPI_TRANS_MODE_DIOQIO_ADDR (1<<2) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
102
+
#defineLB_SPI_TRANS_USE_RXDATA (1<<3) ///< Receive into rx_data member of spi_lobo_transaction_t instead into memory at rx_buffer.
103
+
#defineLB_SPI_TRANS_USE_TXDATA (1<<4) ///< Transmit tx_data member of spi_lobo_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
104
104
105
105
/**
106
106
* This structure describes one SPI transmission
107
107
*/
108
108
structspi_lobo_transaction_t {
109
-
uint32_tflags; ///< Bitwise OR of SPI_TRANS_* flags
109
+
uint32_tflags; ///< Bitwise OR of LB_SPI_TRANS_* flags
110
110
uint16_tcommand; ///< Command data. Specific length was given when device was added to the bus.
111
111
uint64_taddress; ///< Address. Specific length was given when device was added to the bus.
112
112
size_tlength; ///< Total data length to be transmitted to the device, in bits; if 0, no data is transmitted
@@ -281,8 +281,8 @@ void spi_lobo_get_native_pins(int host, int *sdi, int *sdo, int *sck);
281
281
* Lengths must be 8-bit multiples!
282
282
* If trans->rx_buffer is NULL or trans->rx_length is 0, only transmits data
283
283
* If trans->tx_buffer is NULL or trans->length is 0, only receives data
284
-
* If the device is in duplex mode (SPI_DEVICE_HALFDUPLEX flag NOT set), data are transmitted and received simultaneously.
285
-
* If the device is in half duplex mode (SPI_DEVICE_HALFDUPLEX flag IS set), data are received after transmission
284
+
* If the device is in duplex mode (LB_SPI_DEVICE_HALFDUPLEX flag NOT set), data are transmitted and received simultaneously.
285
+
* If the device is in half duplex mode (LB_SPI_DEVICE_HALFDUPLEX flag IS set), data are received after transmission
286
286
* 'address', 'command' and 'dummy bits' are transmitted before data phase IF set in device's configuration
287
287
* and IF 'trans->length' and 'trans->rx_length' are NOT both 0
288
288
* If device was not previously selected, it will be selected before transmission and deselected after transmission.
0 commit comments