diff --git a/hal/spi_api.h b/hal/spi_api.h index 91fc36059e..ca8a09e99d 100644 --- a/hal/spi_api.h +++ b/hal/spi_api.h @@ -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