no-OS
mbed_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
32 #ifndef MBED_SPI_H_
33 #define MBED_SPI_H_
34 
35 // Platform support needs to be C-compatible to work with other drivers
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 /******************************************************************************/
42 /***************************** Include Files **********************************/
43 /******************************************************************************/
44 #include <stdio.h>
45 #include <stdbool.h>
46 
47 /******************************************************************************/
48 /********************** Variables and User defined data types *****************/
49 /******************************************************************************/
50 
51 /*
52  * Note: The structure members are not strongly typed, as this file is included
53  * in application specific '.c' files. The mbed code structure does not
54  * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files.
55  * All the members are hence typecasted to mbed specific type during
56  * spi init and read/write operations.
57  **/
58 
64  uint16_t spi_miso_pin; // SPI MISO pin (PinName)
65  uint16_t spi_mosi_pin; // SPI MOSI pin (PinName)
66  uint16_t spi_clk_pin; // SPI CLK pin (PinName)
67  bool use_sw_csb; // Software/Hardware control of CSB pin
68 };
69 
74 struct mbed_spi_desc {
75  void *spi_port; // SPI port instance (mbed::SPI)
76  void *csb_gpio; // SPI chip select gpio instance (DigitalOut)
77  bool use_sw_csb; // Software/Hardware control of CSB pin
78 };
79 
83 extern const struct no_os_spi_platform_ops mbed_spi_ops;
84 
85 /******************************************************************************/
86 /************************ Functions Declarations ******************************/
87 /******************************************************************************/
88 
89 #ifdef __cplusplus // Closing extern c
90 }
91 #endif
92 
93 #endif /* MBED_SPI_H_ */
mbed_spi_desc::use_sw_csb
bool use_sw_csb
Definition: mbed_spi.h:77
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:222
mbed_spi_init_param::spi_miso_pin
uint16_t spi_miso_pin
Definition: mbed_spi.h:64
mbed_spi_init_param
Structure holding the SPI init parameters for mbed platform.
Definition: mbed_spi.h:63
mbed_spi_ops
const struct no_os_spi_platform_ops mbed_spi_ops
Mbed platform specific SPI platform ops structure.
mbed_spi_desc::csb_gpio
void * csb_gpio
Definition: mbed_spi.h:76
mbed_spi_desc
SPI specific descriptor for the mbed platform.
Definition: mbed_spi.h:74
mbed_spi_init_param::spi_mosi_pin
uint16_t spi_mosi_pin
Definition: mbed_spi.h:65
mbed_spi_init_param::use_sw_csb
bool use_sw_csb
Definition: mbed_spi.h:67
mbed_spi_init_param::spi_clk_pin
uint16_t spi_clk_pin
Definition: mbed_spi.h:66
mbed_spi_desc::spi_port
void * spi_port
Definition: mbed_spi.h:75