Add spi_init_direct() function to HAL API

pull/11892/head
Przemyslaw Stekiel 2019-08-20 13:11:18 +02:00
parent 5aae19792f
commit fd05ebf96d
1 changed files with 19 additions and 9 deletions

View File

@ -51,16 +51,18 @@ typedef struct {
*/
typedef struct spi_s spi_t;
#endif
typedef struct {
const int peripheral;
const PinName mosi_pin;
const int mosi_function;
const PinName miso_pin;
const int miso_function;
const PinName sclk_pin;
const int sclk_function;
const PinName ssel_pin;
const int ssel_function;
int peripheral;
PinName mosi_pin;
int mosi_function;
PinName miso_pin;
int miso_function;
PinName sclk_pin;
int sclk_function;
PinName ssel_pin;
int ssel_function;
} spi_pinmap_t;
/**
@ -167,6 +169,14 @@ SPIName spi_get_peripheral_name(PinName mosi, PinName miso, PinName mclk);
*/
void spi_get_capabilities(PinName ssel, bool slave, spi_capabilities_t *cap);
/** Initialize the SPI peripheral
*
* Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral
* @param[out] obj The SPI object to initialize
* @param[in] pinmap pointer to strucure which holds static pinmap
*/
void spi_init_direct(spi_t *obj, const spi_pinmap_t *pinmap);
/** Initialize the SPI peripheral
*
* Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral