no-OS
pico_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _PICO_SPI_H_
40 #define _PICO_SPI_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include "no_os_spi.h"
47 #include "hardware/spi.h"
48 
49 /******************************************************************************/
50 /*************************** Types Declarations *******************************/
51 /******************************************************************************/
52 
56 enum spi_tx_gp {
57  /* SPI0 available configurations */
61  /* SPI1 available configurations */
64 };
65 
69 enum spi_rx_gp {
70  /* SPI0 available configurations */
74  /* SPI1 available configurations */
77 };
78 
82 enum spi_sck_gp {
83  /* SPI0 available configurations */
87  /* SPI1 available configurations */
90 };
91 
95 enum spi_cs_gp {
96  /* SPI0 available configurations */
100  /* SPI1 available configurations */
103 };
104 
111  spi_inst_t *spi_instance;
120 };
121 
134 };
135 
139 extern const struct no_os_spi_platform_ops pico_spi_ops;
140 
141 #endif // _PICO_SPI_H_
pico_spi_ops
const struct no_os_spi_platform_ops pico_spi_ops
pico platform specific SPI platform ops structure
Definition: pico_spi.c:297
pico_spi_desc::spi_sck_pin
enum spi_sck_gp spi_sck_pin
Definition: pico_spi.h:117
NO_OS_SPI_MODE_1
@ NO_OS_SPI_MODE_1
Definition: no_os_spi.h:68
pico_spi_desc::spi_instance
spi_inst_t * spi_instance
Definition: pico_spi.h:111
SPI0_SCK_GP18
@ SPI0_SCK_GP18
Definition: pico_spi.h:86
SPI0_TX_GP3
@ SPI0_TX_GP3
Definition: pico_spi.h:58
SPI1_RX_GP12
@ SPI1_RX_GP12
Definition: pico_spi.h:76
no_os_spi_desc::device_id
uint32_t device_id
Definition: no_os_spi.h:145
pico_spi.h
Header file for the pico spi driver.
PICO_SPI_MAX_INSTANCES
#define PICO_SPI_MAX_INSTANCES
Definition: pico_spi.c:55
no_os_spi.h
Header file of SPI Interface.
pico_spi_desc
pico platform specific SPI descriptor
Definition: pico_spi.h:109
pico_spi_transfer
int32_t pico_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Write/read multiple messages to/from SPI.
Definition: pico_spi.c:220
no_os_spi_msg
Definition: no_os_spi.h:90
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:166
no_os_delay.h
Header file of Delay functions.
pico_spi_init_param::spi_rx_pin
enum spi_rx_gp spi_rx_pin
Definition: pico_spi.h:129
spi_rx_gp
spi_rx_gp
Available GP config for SPI RX.
Definition: pico_spi.h:69
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:129
NO_OS_SPI_MODE_2
@ NO_OS_SPI_MODE_2
Definition: no_os_spi.h:70
spi_sck_gp
spi_sck_gp
Available GP config for SPI SCK.
Definition: pico_spi.h:82
SPI0_CS_GP17
@ SPI0_CS_GP17
Definition: pico_spi.h:99
NO_OS_SPI_MODE_3
@ NO_OS_SPI_MODE_3
Definition: no_os_spi.h:72
pico_spi_init_param::spi_cs_pin
enum spi_cs_gp spi_cs_pin
Definition: pico_spi.h:133
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:92
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:123
no_os_spi_desc::chip_select
uint8_t chip_select
Definition: no_os_spi.h:149
no_os_error.h
Error codes definition.
SPI1_CS_GP13
@ SPI1_CS_GP13
Definition: pico_spi.h:102
pico_spi_ops
const struct no_os_spi_platform_ops pico_spi_ops
pico specific SPI platform ops structure
Definition: pico_spi.c:297
pico_spi_init
int32_t pico_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: pico_spi.c:140
no_os_spi_msg::rx_buff
uint8_t * rx_buff
Definition: no_os_spi.h:94
spi_tx_gp
spi_tx_gp
Available GP config for SPI TX.
Definition: pico_spi.h:56
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:153
pico_spi_init_param
Additional SPI config parameters.
Definition: pico_spi.h:125
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:143
SPI0_RX_GP0
@ SPI0_RX_GP0
Definition: pico_spi.h:71
SPI0_SCK_GP6
@ SPI0_SCK_GP6
Definition: pico_spi.h:85
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:96
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:156
pico_spi_remove
int32_t pico_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: pico_spi.c:197
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:125
SPI0_CS_GP5
@ SPI0_CS_GP5
Definition: pico_spi.h:98
pico_spi_init_param::spi_sck_pin
enum spi_sck_gp spi_sck_pin
Definition: pico_spi.h:131
SPI0_RX_GP16
@ SPI0_RX_GP16
Definition: pico_spi.h:73
SPI1_TX_GP11
@ SPI1_TX_GP11
Definition: pico_spi.h:62
NO_OS_SPI_BIT_ORDER_MSB_FIRST
@ NO_OS_SPI_BIT_ORDER_MSB_FIRST
Definition: no_os_spi.h:81
spi_cs_gp
spi_cs_gp
Available GP config for SPI CS.
Definition: pico_spi.h:95
SPI1_SCK_GP14
@ SPI1_SCK_GP14
Definition: pico_spi.h:89
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
pico_spi_desc::spi_tx_pin
enum spi_tx_gp spi_tx_pin
Definition: pico_spi.h:113
SPI0_TX_GP7
@ SPI0_TX_GP7
Definition: pico_spi.h:59
SPI1_TX_GP15
@ SPI1_TX_GP15
Definition: pico_spi.h:63
pico_spi_write_and_read
int32_t pico_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: pico_spi.c:274
SPI0_RX_GP4
@ SPI0_RX_GP4
Definition: pico_spi.h:72
SPI0_CS_GP1
@ SPI0_CS_GP1
Definition: pico_spi.h:97
SPI1_RX_GP8
@ SPI1_RX_GP8
Definition: pico_spi.h:75
SPI0_SCK_GP2
@ SPI0_SCK_GP2
Definition: pico_spi.h:84
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:147
SPI0_TX_GP19
@ SPI0_TX_GP19
Definition: pico_spi.h:60
pico_spi_desc::spi_rx_pin
enum spi_rx_gp spi_rx_pin
Definition: pico_spi.h:115
no_os_util.h
Header file of utility functions.
pico_spi_desc::spi_cs_pin
enum spi_cs_gp spi_cs_pin
Definition: pico_spi.h:119
no_os_spi_platform_ops::init
int32_t(* init)(struct no_os_spi_desc **, const struct no_os_spi_init_param *)
Definition: no_os_spi.h:168
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:134
NO_OS_SPI_MODE_0
@ NO_OS_SPI_MODE_0
Definition: no_os_spi.h:66
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:151
SPI1_SCK_GP10
@ SPI1_SCK_GP10
Definition: pico_spi.h:88
pico_spi_init_param::spi_tx_pin
enum spi_tx_gp spi_tx_pin
Definition: pico_spi.h:127
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:121
SPI1_CS_GP9
@ SPI1_CS_GP9
Definition: pico_spi.h:101