no-OS
pico_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef _PICO_SPI_H_
34 #define _PICO_SPI_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 
40 #include "no_os_spi.h"
41 #include "hardware/spi.h"
42 
43 /******************************************************************************/
44 /*************************** Types Declarations *******************************/
45 /******************************************************************************/
46 
50 enum spi_tx_gp {
51  /* SPI0 available configurations */
55  /* SPI1 available configurations */
58 };
59 
63 enum spi_rx_gp {
64  /* SPI0 available configurations */
68  /* SPI1 available configurations */
71 };
72 
76 enum spi_sck_gp {
77  /* SPI0 available configurations */
81  /* SPI1 available configurations */
84 };
85 
89 enum spi_cs_gp {
90  /* SPI0 available configurations */
94  /* SPI1 available configurations */
97 };
98 
105  spi_inst_t *spi_instance;
114 };
115 
128 };
129 
133 extern const struct no_os_spi_platform_ops pico_spi_ops;
134 
135 #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:302
pico_spi_desc::spi_sck_pin
enum spi_sck_gp spi_sck_pin
Definition: pico_spi.h:111
NO_OS_SPI_MODE_1
@ NO_OS_SPI_MODE_1
Definition: no_os_spi.h:63
pico_spi_desc::spi_instance
spi_inst_t * spi_instance
Definition: pico_spi.h:105
SPI0_SCK_GP18
@ SPI0_SCK_GP18
Definition: pico_spi.h:80
no_os_alloc.h
SPI0_TX_GP3
@ SPI0_TX_GP3
Definition: pico_spi.h:52
SPI1_RX_GP12
@ SPI1_RX_GP12
Definition: pico_spi.h:70
no_os_spi_desc::device_id
uint32_t device_id
Definition: no_os_spi.h:196
pico_spi.h
Header file for the pico spi driver.
PICO_SPI_MAX_INSTANCES
#define PICO_SPI_MAX_INSTANCES
Definition: pico_spi.c:50
no_os_spi.h
Header file of SPI Interface.
pico_spi_desc
pico platform specific SPI descriptor
Definition: pico_spi.h:103
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:215
no_os_spi_msg
Definition: no_os_spi.h:100
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:222
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:123
spi_rx_gp
spi_rx_gp
Available GP config for SPI RX.
Definition: pico_spi.h:63
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
NO_OS_SPI_MODE_2
@ NO_OS_SPI_MODE_2
Definition: no_os_spi.h:65
spi_sck_gp
spi_sck_gp
Available GP config for SPI SCK.
Definition: pico_spi.h:76
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
SPI0_CS_GP17
@ SPI0_CS_GP17
Definition: pico_spi.h:93
NO_OS_SPI_MODE_3
@ NO_OS_SPI_MODE_3
Definition: no_os_spi.h:67
pico_spi_init_param::spi_cs_pin
enum spi_cs_gp spi_cs_pin
Definition: pico_spi.h:127
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:102
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:142
no_os_spi_desc::chip_select
uint8_t chip_select
Definition: no_os_spi.h:200
no_os_error.h
Error codes definition.
SPI1_CS_GP13
@ SPI1_CS_GP13
Definition: pico_spi.h:96
pico_spi_ops
const struct no_os_spi_platform_ops pico_spi_ops
pico specific SPI platform ops structure
Definition: pico_spi.c:302
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:135
no_os_spi_msg::rx_buff
uint8_t * rx_buff
Definition: no_os_spi.h:104
spi_tx_gp
spi_tx_gp
Available GP config for SPI TX.
Definition: pico_spi.h:50
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:204
pico_spi_init_param
Additional SPI config parameters.
Definition: pico_spi.h:119
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
SPI0_RX_GP0
@ SPI0_RX_GP0
Definition: pico_spi.h:65
SPI0_SCK_GP6
@ SPI0_SCK_GP6
Definition: pico_spi.h:79
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:212
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:192
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:144
SPI0_CS_GP5
@ SPI0_CS_GP5
Definition: pico_spi.h:92
pico_spi_init_param::spi_sck_pin
enum spi_sck_gp spi_sck_pin
Definition: pico_spi.h:125
SPI0_RX_GP16
@ SPI0_RX_GP16
Definition: pico_spi.h:67
SPI1_TX_GP11
@ SPI1_TX_GP11
Definition: pico_spi.h:56
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
NO_OS_SPI_BIT_ORDER_MSB_FIRST
@ NO_OS_SPI_BIT_ORDER_MSB_FIRST
Definition: no_os_spi.h:76
spi_cs_gp
spi_cs_gp
Available GP config for SPI CS.
Definition: pico_spi.h:89
SPI1_SCK_GP14
@ SPI1_SCK_GP14
Definition: pico_spi.h:83
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
pico_spi_desc::spi_tx_pin
enum spi_tx_gp spi_tx_pin
Definition: pico_spi.h:107
SPI0_TX_GP7
@ SPI0_TX_GP7
Definition: pico_spi.h:53
SPI1_TX_GP15
@ SPI1_TX_GP15
Definition: pico_spi.h:57
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:279
SPI0_RX_GP4
@ SPI0_RX_GP4
Definition: pico_spi.h:66
SPI0_CS_GP1
@ SPI0_CS_GP1
Definition: pico_spi.h:91
SPI1_RX_GP8
@ SPI1_RX_GP8
Definition: pico_spi.h:69
SPI0_SCK_GP2
@ SPI0_SCK_GP2
Definition: pico_spi.h:78
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
SPI0_TX_GP19
@ SPI0_TX_GP19
Definition: pico_spi.h:54
pico_spi_desc::spi_rx_pin
enum spi_rx_gp spi_rx_pin
Definition: pico_spi.h:109
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:113
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:224
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:158
NO_OS_SPI_MODE_0
@ NO_OS_SPI_MODE_0
Definition: no_os_spi.h:61
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
SPI1_SCK_GP10
@ SPI1_SCK_GP10
Definition: pico_spi.h:82
pico_spi_init_param::spi_tx_pin
enum spi_tx_gp spi_tx_pin
Definition: pico_spi.h:121
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
SPI1_CS_GP9
@ SPI1_CS_GP9
Definition: pico_spi.h:95