no-OS
mbed_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
38 #ifndef MBED_SPI_H_
39 #define MBED_SPI_H_
40 
41 // Platform support needs to be C-compatible to work with other drivers
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 /******************************************************************************/
48 /***************************** Include Files **********************************/
49 /******************************************************************************/
50 #include <stdio.h>
51 #include <stdbool.h>
52 
53 /******************************************************************************/
54 /********************** Variables and User defined data types *****************/
55 /******************************************************************************/
56 
57 /*
58  * Note: The structure members are not strongly typed, as this file is included
59  * in application specific '.c' files. The mbed code structure does not
60  * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files.
61  * All the members are hence typecasted to mbed specific type during
62  * spi init and read/write operations.
63  **/
64 
70  uint16_t spi_miso_pin; // SPI MISO pin (PinName)
71  uint16_t spi_mosi_pin; // SPI MOSI pin (PinName)
72  uint16_t spi_clk_pin; // SPI CLK pin (PinName)
73  bool use_sw_csb; // Software/Hardware control of CSB pin
74 };
75 
80 struct mbed_spi_desc {
81  void *spi_port; // SPI port instance (mbed::SPI)
82  void *csb_gpio; // SPI chip select gpio instance (DigitalOut)
83  bool use_sw_csb; // Software/Hardware control of CSB pin
84 };
85 
89 extern const struct no_os_spi_platform_ops mbed_spi_ops;
90 
91 /******************************************************************************/
92 /************************ Functions Declarations ******************************/
93 /******************************************************************************/
94 
95 #ifdef __cplusplus // Closing extern c
96 }
97 #endif
98 
99 #endif /* MBED_SPI_H_ */
mbed_spi_desc::use_sw_csb
bool use_sw_csb
Definition: mbed_spi.h:83
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:153
mbed_spi_init_param::spi_miso_pin
uint16_t spi_miso_pin
Definition: mbed_spi.h:70
mbed_spi_init_param
Structure holding the SPI init parameters for mbed platform.
Definition: mbed_spi.h:69
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:82
mbed_spi_desc
SPI specific descriptor for the mbed platform.
Definition: mbed_spi.h:80
mbed_spi_init_param::spi_mosi_pin
uint16_t spi_mosi_pin
Definition: mbed_spi.h:71
mbed_spi_init_param::use_sw_csb
bool use_sw_csb
Definition: mbed_spi.h:73
mbed_spi_init_param::spi_clk_pin
uint16_t spi_clk_pin
Definition: mbed_spi.h:72
mbed_spi_desc::spi_port
void * spi_port
Definition: mbed_spi.h:81