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; typedef struct spi_s spi_t;
#endif
typedef struct { typedef struct {
const int peripheral; int peripheral;
const PinName mosi_pin; PinName mosi_pin;
const int mosi_function; int mosi_function;
const PinName miso_pin; PinName miso_pin;
const int miso_function; int miso_function;
const PinName sclk_pin; PinName sclk_pin;
const int sclk_function; int sclk_function;
const PinName ssel_pin; PinName ssel_pin;
const int ssel_function; int ssel_function;
} spi_pinmap_t; } 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); 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 /** Initialize the SPI peripheral
* *
* Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral * Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral