diff --git a/configs/clicker2-stm32/src/clicker2-stm32.h b/configs/clicker2-stm32/src/clicker2-stm32.h index 24dd9e54dc..5def0fdce8 100644 --- a/configs/clicker2-stm32/src/clicker2-stm32.h +++ b/configs/clicker2-stm32/src/clicker2-stm32.h @@ -233,6 +233,17 @@ * Public Functions ************************************************************************************/ +/**************************************************************************** + * Name: stm32_spidev_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the Mikroe Clicker2 STM32 + * board. + * + ****************************************************************************/ + +void weak_function stm32_spidev_initialize(void); + /************************************************************************************ * Name: stm32_bringup * @@ -254,7 +265,7 @@ int stm32_bringup(void); * * Description: * Called from stm32_boardinitialize very early in inialization to setup USB-related - * GPIO pins for the Olimex STM32 P407 board. + * GPIO pins for the Mikroe Clicker2 STM32 board. * ************************************************************************************/ diff --git a/configs/clicker2-stm32/src/stm32_boot.c b/configs/clicker2-stm32/src/stm32_boot.c index fff7bb8764..e87d316572 100644 --- a/configs/clicker2-stm32/src/stm32_boot.c +++ b/configs/clicker2-stm32/src/stm32_boot.c @@ -63,6 +63,17 @@ void stm32_boardinitialize(void) { +#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function + * stm32_spidev_initialize() has been brought into the link. + */ + + if (stm32_spidev_initialize) + { + stm32_spidev_initialize(); + } +#endif + #ifdef CONFIG_STM32_OTGFS /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usb_configure() has been brought diff --git a/configs/clicker2-stm32/src/stm32_spi.c b/configs/clicker2-stm32/src/stm32_spi.c index 87e6e8d1d1..9780fcdb42 100644 --- a/configs/clicker2-stm32/src/stm32_spi.c +++ b/configs/clicker2-stm32/src/stm32_spi.c @@ -135,7 +135,18 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - /* To be provided */ + + switch(devid) + { +#ifdef CONFIG_IEEE802154_MRF24J40 + case SPIDEV_IEEE802154: + /* Set the GPIO low to select and high to de-select */ + stm32_gpiowrite(GPIO_MB1_CS, !selected); + break; +#endif + default: + break; + } } uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)