diff --git a/configs/nucleo-l432kc/include/board.h b/configs/nucleo-l432kc/include/board.h index b7143bcb55..565c102ca1 100644 --- a/configs/nucleo-l432kc/include/board.h +++ b/configs/nucleo-l432kc/include/board.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/include/board.h * * Copyright (C) 2016, 2018 Gregory Nutt. All rights reserved. @@ -31,14 +31,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ #ifndef __CONFIGS_NUCLEO_L432KC_INCLUDE_BOARD_H #define __CONFIGS_NUCLEO_L432KC_INCLUDE_BOARD_H -/************************************************************************************ - * Included Files - ************************************************************************************/ +/******************************************************************************* + * Included File + ******************************************************************************/ #include #ifndef __ASSEMBLY__ @@ -49,19 +49,20 @@ #include #endif -/************************************************************************************ +/******************************************************************************* * Pre-processor Definitions - ************************************************************************************/ + ******************************************************************************/ -/* Clocking *************************************************************************/ +/* Clocking *******************************************************************/ #if defined(CONFIG_ARCH_CHIP_STM32L432KC) # include #endif -/* DMA Channel/Stream Selections ****************************************************/ -/* Stream selections are arbitrary for now but might become important in the future - * is we set aside more DMA channels/streams. +/* DMA Channel/Stream Selections **********************************************/ + +/* Stream selections are arbitrary for now but might become important in the + * future is we set aside more DMA channels/streams. */ /* Values defined in arch/arm/src/stm32l4/hardware/stm32l4x3xx_dma.h */ @@ -77,7 +78,7 @@ #define ADC1_DMA_CHAN DMACHAN_ADC1_1 -/* Alternate function pin selections ************************************************/ +/* Alternate function pin selections ******************************************/ /* USART1: * RXD: PA10 CN9 pin 3, CN10 pin 33 @@ -117,9 +118,9 @@ */ #define GPIO_I2C1_D4 \ - (GPIO_INPUT | GPIO_FLOAT | GPIO_PORTA | GPIO_PIN5) + (GPIO_INPUT | GPIO_FLOAT | GPIO_PORTB | GPIO_PIN7) #define GPIO_I2C1_D5 \ - (GPIO_INPUT | GPIO_FLOAT | GPIO_PORTA | GPIO_PIN6) + (GPIO_INPUT | GPIO_FLOAT | GPIO_PORTB | GPIO_PIN6) #define GPIO_I2C1_SCL \ (GPIO_I2C1_SCL_1 | GPIO_OPENDRAIN | GPIO_SPEED_50MHz | GPIO_OUTPUT_SET) #define GPIO_I2C1_SDA \ @@ -229,9 +230,9 @@ #define GPIO_TIM1_CH2OUT GPIO_TIM1_CH2OUT_1 #define GPIO_TIM1_CH2NOUT GPIO_TIM1_CH2N_1 -/************************************************************************************ +/******************************************************************************* * Public Data - ************************************************************************************/ + ******************************************************************************/ #ifndef __ASSEMBLY__ @@ -244,18 +245,19 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/******************************************************************************* * Public Function Prototypes - ************************************************************************************/ -/************************************************************************************ + ******************************************************************************/ + +/******************************************************************************* * Name: stm32l4_board_initialize * * Description: - * All STM32L4 architectures must provide the following entry point. This entry point - * is called early in the initialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All STM32L4 architectures must provide the following entry point. This + * entry point is called early in the initialization -- after all memory has + * been configured and mapped but before any devices have been initialized. * - ************************************************************************************/ + ******************************************************************************/ void stm32l4_board_initialize(void); diff --git a/configs/nucleo-l432kc/src/Makefile b/configs/nucleo-l432kc/src/Makefile index d78b537ea5..9354205948 100644 --- a/configs/nucleo-l432kc/src/Makefile +++ b/configs/nucleo-l432kc/src/Makefile @@ -64,6 +64,10 @@ ifeq ($(CONFIG_SENSORS_INA226),y) CSRCS += stm32_ina226.c endif +ifeq ($(CONFIG_SENSORS_INA219),y) +CSRCS += stm32_ina219.c +endif + ifeq ($(CONFIG_SENSORS_QENCODER),y) CSRCS += stm32_qencoder.c endif diff --git a/configs/nucleo-l432kc/src/nucleo-l432kc.h b/configs/nucleo-l432kc/src/nucleo-l432kc.h index 8b05cdc5e8..dfc463c6f4 100644 --- a/configs/nucleo-l432kc/src/nucleo-l432kc.h +++ b/configs/nucleo-l432kc/src/nucleo-l432kc.h @@ -195,6 +195,18 @@ int stm32_at45dbinitialize(int minor); int stm32_ina226initialize(FAR const char *devpath); #endif +/**************************************************************************** + * Name: stm32_ina219initialize + * + * Description: + * Initialize and register the INA219 driver. + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_INA219 +int stm32_ina219initialize(FAR const char *devpath); +#endif + /**************************************************************************** * Name: board_timer_driver_initialize * diff --git a/configs/nucleo-l432kc/src/stm32_adc.c b/configs/nucleo-l432kc/src/stm32_adc.c index c2aeaf3da7..d53e564cd4 100644 --- a/configs/nucleo-l432kc/src/stm32_adc.c +++ b/configs/nucleo-l432kc/src/stm32_adc.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32_adc.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -54,9 +54,9 @@ #ifdef CONFIG_STM32L4_ADC1 -/************************************************************************************ +/******************************************************************************* * Pre-processor Definitions - ************************************************************************************/ + ******************************************************************************/ /* The number of ADC channels in the conversion list */ @@ -66,9 +66,9 @@ # define ADC1_NCHANNELS 1 #endif -/************************************************************************************ +/******************************************************************************* * Private Data - ************************************************************************************/ + ******************************************************************************/ /* Identifying number of each ADC channel. */ #ifdef CONFIG_ADC_DMA @@ -77,7 +77,10 @@ static const uint8_t g_adc1_chanlist[ADC1_NCHANNELS] = {1, 2}; /* Configurations of pins used byte each ADC channels */ -static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1, GPIO_ADC1_IN2}; +static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = +{ + GPIO_ADC1_IN1, GPIO_ADC1_IN2 +}; #else /* Without DMA, only a single channel can be supported */ @@ -90,21 +93,21 @@ static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1}; #endif /* CONFIG_ADC_DMA */ -/************************************************************************************ +/******************************************************************************* * Private Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32l4_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ******************************************************************************/ int stm32l4_adc_setup(void) { diff --git a/configs/nucleo-l432kc/src/stm32_appinit.c b/configs/nucleo-l432kc/src/stm32_appinit.c index 8755a9350b..1f27deaf12 100644 --- a/configs/nucleo-l432kc/src/stm32_appinit.c +++ b/configs/nucleo-l432kc/src/stm32_appinit.c @@ -255,6 +255,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_SENSORS_INA219 + /* Initialize and register INA219 */ + + ret = stm32_ina219initialize("/dev/ina219"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_ina219initialize() failed: %d\n", ret); + } +#endif + #ifdef CONFIG_TIMER /* Initialize and register the timer driver */ diff --git a/configs/nucleo-l432kc/src/stm32_at45db.c b/configs/nucleo-l432kc/src/stm32_at45db.c index 099644f24e..8e9197a715 100644 --- a/configs/nucleo-l432kc/src/stm32_at45db.c +++ b/configs/nucleo-l432kc/src/stm32_at45db.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * config/nucleo-l432kc/src/stm32_at45.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -52,31 +52,31 @@ #include "stm32l4_spi.h" -/************************************************************************************ +/******************************************************************************* * Pre-processor Definitions - ************************************************************************************/ + ******************************************************************************/ #ifndef CONFIG_STM32L4_SPI1 # error "AT45DB driver requires CONFIG_STM32_SPI1 to be enabled" #endif -/************************************************************************************ +/******************************************************************************* * Private Definitions -************************************************************************************/ +******************************************************************************/ static const int AT45DB_SPI_PORT = 1; /* AT45DB is connected to SPI1 port */ -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32_at45dbinitialize * * Description: * Initialize and configure the AT45DB SPI Serial Flash Memory * - ************************************************************************************/ + ******************************************************************************/ int stm32_at45dbinitialize(int minor) { diff --git a/configs/nucleo-l432kc/src/stm32_boot.c b/configs/nucleo-l432kc/src/stm32_boot.c index c8f9b4e3de..f3e7b8596c 100644 --- a/configs/nucleo-l432kc/src/stm32_boot.c +++ b/configs/nucleo-l432kc/src/stm32_boot.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32l4_boot.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. @@ -32,11 +32,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -51,27 +51,27 @@ #include "up_arch.h" #include "nucleo-l432kc.h" -/************************************************************************************ +/******************************************************************************* * Pre-processor Definitions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Private Data - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32l4_board_initialize * * Description: - * All STM32L4 architectures must provide the following entry point. This entry point - * is called early in the initialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All STM32L4 architectures must provide the following entry point. This + * entry point is called early in the initialization -- after all memory has + * been configured and mapped but before any devices have been initialized. * - ************************************************************************************/ + ******************************************************************************/ void stm32l4_board_initialize(void) { @@ -81,11 +81,12 @@ void stm32l4_board_initialize(void) board_autoled_initialize(); #endif - /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function - * stm32l4_spiinitialize() has been brought into the link. + /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak + * function stm32l4_spiinitialize() has been brought into the link. */ -#if defined(CONFIG_STM32L4_SPI1) || defined(CONFIG_STM32L4_SPI2) || defined(CONFIG_STM32L4_SPI3) +#if defined(CONFIG_STM32L4_SPI1) || defined(CONFIG_STM32L4_SPI2) || \ + defined(CONFIG_STM32L4_SPI3) stm32l4_spiinitialize(); #endif diff --git a/configs/nucleo-l432kc/src/stm32_buttons.c b/configs/nucleo-l432kc/src/stm32_buttons.c index 5f380c0497..a248a95454 100644 --- a/configs/nucleo-l432kc/src/stm32_buttons.c +++ b/configs/nucleo-l432kc/src/stm32_buttons.c @@ -88,27 +88,27 @@ uint32_t board_buttons(void) return !released; } -/************************************************************************************ +/****************************************************************************** * Button support. * * Description: - * board_button_initialize() must be called to initialize button resources. After - * that, board_buttons() may be called to collect the current state of all - * buttons or board_button_irq() may be called to register button interrupt - * handlers. + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state of + * all buttons or board_button_irq() may be called to register button + * interrupt handlers. * - * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 32-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns a + * 32-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that will * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration + * button enumeration value that uniquely identifies a button resource. See + * the BUTTON_* definitions in board.h for the meaning of enumeration * value. * - ************************************************************************************/ + ******************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) @@ -117,7 +117,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id == BUTTON_USER) { - ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg); + ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, + arg); } return ret; diff --git a/configs/nucleo-l432kc/src/stm32_dac7571.c b/configs/nucleo-l432kc/src/stm32_dac7571.c index c51cec7d42..2d1384972d 100644 --- a/configs/nucleo-l432kc/src/stm32_dac7571.c +++ b/configs/nucleo-l432kc/src/stm32_dac7571.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32_dac7571.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -51,27 +51,28 @@ #include "chip.h" #include -#if defined(CONFIG_I2C) && defined(CONFIG_STM32L4_I2C1) && defined(CONFIG_DAC7571) +#if defined(CONFIG_I2C) && defined(CONFIG_STM32L4_I2C1) && \ + defined(CONFIG_DAC7571) -/************************************************************************************ +/******************************************************************************* * Preprocessor definitions - ************************************************************************************/ + ******************************************************************************/ #if !defined(CONFIG_DAC7571_ADDR) # define CONFIG_DAC7571_ADDR 0x4C /* A0 tied to ground */ #endif -/************************************************************************************ +/******************************************************************************* * Private Data - ************************************************************************************/ + ******************************************************************************/ static struct dac_dev_s *g_dac; -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32_dac7571initialize * * Description: @@ -83,7 +84,7 @@ static struct dac_dev_s *g_dac; * Returned Value: * Zero (OK) on success; a negated errno value on failure. * - ************************************************************************************/ + ******************************************************************************/ int stm32_dac7571initialize(FAR const char *devpath) { @@ -126,4 +127,5 @@ error: return ret; } -#endif /* defined(CONFIG_I2C) && defined(CONFIG_STM32_I2C1) && defined(CONFIG_DAC7571) */ +#endif /* defined(CONFIG_I2C) && defined(CONFIG_STM32_I2C1) && + defined(CONFIG_DAC7571) */ diff --git a/configs/nucleo-l432kc/src/stm32_ina226.c b/configs/nucleo-l432kc/src/stm32_ina226.c index 263acf8a04..2588186e91 100644 --- a/configs/nucleo-l432kc/src/stm32_ina226.c +++ b/configs/nucleo-l432kc/src/stm32_ina226.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32_ina226.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -51,11 +51,12 @@ #include "chip.h" #include -#if defined(CONFIG_I2C) && defined(CONFIG_STM32L4_I2C1) && defined(CONFIG_SENSORS_INA226) +#if defined(CONFIG_I2C) && defined(CONFIG_STM32L4_I2C1) && \ + defined(CONFIG_SENSORS_INA226) -/************************************************************************************ +/******************************************************************************* * Preprocessor definitions - ************************************************************************************/ + ******************************************************************************/ #if !defined(CONFIG_INA226_ADDR) # define CONFIG_INA226_ADDR 0x44 /* A0 tied to ground and A1 tied to VS */ @@ -65,15 +66,15 @@ # define CONFIG_INA226_SHUNTVAL 5000 #endif -/************************************************************************************ +/******************************************************************************* * Private Data - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32_ina226initialize * * Description: @@ -85,7 +86,7 @@ * Returned Value: * Zero (OK) on success; a negated errno value on failure. * - ************************************************************************************/ + ******************************************************************************/ int stm32_ina226initialize(FAR const char *devpath) { @@ -130,4 +131,5 @@ error: return ret; } -#endif /* defined(CONFIG_I2C) && defined(CONFIG_STM32_I2C1) && defined(CONFIG_SENSORS_INA226) */ +#endif /* defined(CONFIG_I2C) && defined(CONFIG_STM32_I2C1) && + defined(CONFIG_SENSORS_INA226) */ diff --git a/configs/nucleo-l432kc/src/stm32_pwm.c b/configs/nucleo-l432kc/src/stm32_pwm.c index 24a520324c..ae35c9f78e 100644 --- a/configs/nucleo-l432kc/src/stm32_pwm.c +++ b/configs/nucleo-l432kc/src/stm32_pwm.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32l4_pwm.c * * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved. @@ -34,11 +34,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -55,30 +55,31 @@ #include "stm32l4_pwm.h" #include "nucleo-l432kc.h" -/************************************************************************************ +/******************************************************************************* * Pre-processor Definitions - ************************************************************************************/ -/* Configuration *******************************************************************/ + ******************************************************************************/ + +/* Configuration **************************************************************/ /* PWM * * The STM3240G-Eval has no real on-board PWM devices, but the board can be - * configured to output a pulse train using variously unused pins on the board for - * PWM output (see board.h for details of pins). + * configured to output a pulse train using variously unused pins on the board + * for PWM output (see board.h for details of pins). */ #ifdef CONFIG_PWM -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32l4_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ******************************************************************************/ int stm32l4_pwm_setup(void) { @@ -94,9 +95,9 @@ int stm32l4_pwm_setup(void) /* PWM * - * The Nucleo-l432kc has no real on-board PWM devices, but the board can be - * configured to output a pulse train using TIM1 or 8, or others (see board.h). - * Let's figure out which the user has configured. + * The Nucleo-l432kc has no real on-board PWM devices, but the board can + * be configured to output a pulse train using TIM1 or 8, or others (see + * board.h). Let's figure out which the user has configured. */ #if defined(CONFIG_STM32L4_TIM1_PWM) diff --git a/configs/nucleo-l432kc/src/stm32_qencoder.c b/configs/nucleo-l432kc/src/stm32_qencoder.c index 3b11c120bf..1587f72537 100644 --- a/configs/nucleo-l432kc/src/stm32_qencoder.c +++ b/configs/nucleo-l432kc/src/stm32_qencoder.c @@ -1,4 +1,4 @@ -/************************************************************************************ +/******************************************************************************* * configs/nucleo-l432kc/src/stm32_qencoder.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. @@ -34,11 +34,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -53,18 +53,18 @@ #include "stm32l4_qencoder.h" #include "nucleo-l432kc.h" -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: qe_devinit * * Description: * All STM32L4 architectures must provide the following interface to work with * examples/qencoder. * - ************************************************************************************/ + ******************************************************************************/ int stm32l4_qencoder_initialize(FAR const char *devpath, int timer) { diff --git a/configs/nucleo-l432kc/src/stm32_spi.c b/configs/nucleo-l432kc/src/stm32_spi.c index 396735148d..869de0c5cd 100644 --- a/configs/nucleo-l432kc/src/stm32_spi.c +++ b/configs/nucleo-l432kc/src/stm32_spi.c @@ -33,9 +33,9 @@ * ****************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Included Files - ************************************************************************************/ + ******************************************************************************/ #include @@ -55,9 +55,9 @@ #if defined(CONFIG_STM32L4_SPI1) || defined(CONFIG_STM32L4_SPI2) -/************************************************************************************ +/******************************************************************************* * Public Data - ************************************************************************************/ + ******************************************************************************/ /* Global driver instances */ #ifdef CONFIG_STM32L4_SPI1 @@ -67,17 +67,17 @@ struct spi_dev_s *g_spi1; struct spi_dev_s *g_spi2; #endif -/************************************************************************************ +/******************************************************************************* * Public Functions - ************************************************************************************/ + ******************************************************************************/ -/************************************************************************************ +/******************************************************************************* * Name: stm32l4_spiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the Nucleo-L432KC board. * - ************************************************************************************/ + ******************************************************************************/ void stm32l4_spiinitialize(void) { @@ -122,18 +122,18 @@ void stm32l4_spiinitialize(void) * Name: stm32l4_spi1/2select and stm32l4_spi1/2status * * Description: - * The external functions, stm32l4_spi1/2select and stm32l4_spi1/2status must be - * provided by board-specific logic. They are implementations of the select - * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi/spi.h). All other methods (including up_spiinitialize()) - * are provided by common STM32 logic. To use this common SPI logic on your - * board: + * The external functions, stm32l4_spi1/2select and stm32l4_spi1/2status must + * be provided by board-specific logic. They are implementations of the + * select and status methods of the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). All other methods (including + * up_spiinitialize()) are provided by common STM32 logic. To use this common + * SPI logic on your board: * * 1. Provide logic in stm32l4_board_initialize() to configure SPI chip select * pins. - * 2. Provide stm32l4_spi1/2select() and stm32l4_spi1/2status() functions in your - * board-specific logic. These functions will perform chip selection and - * status operations using GPIOs in the way your board is configured. + * 2. Provide stm32l4_spi1/2select() and stm32l4_spi1/2status() functions in + * your board-specific logic. These functions will perform chip selection + * and status operations using GPIOs in the way your board is configured. * 3. Add a calls to up_spiinitialize() in your low level application * initialization logic * 4. The handle returned by up_spiinitialize() may then be used to bind the @@ -144,9 +144,11 @@ void stm32l4_spiinitialize(void) ****************************************************************************/ #ifdef CONFIG_STM32L4_SPI1 -void stm32l4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void stm32l4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %08X CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %08X CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #ifdef CONFIG_MTD_AT45DB if (devid == SPIDEV_FLASH(0)) @@ -163,9 +165,11 @@ uint8_t stm32l4_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #endif #ifdef CONFIG_STM32L4_SPI2 -void stm32l4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void stm32l4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); }