diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/configs/nxlines_oled/defconfig b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/configs/nxlines_oled/defconfig index 0cb14c1d6d3..2f5e02c000a 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/configs/nxlines_oled/defconfig +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/configs/nxlines_oled/defconfig @@ -11,6 +11,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="b-l072z-lrwan1" CONFIG_ARCH_BOARD_B_L072Z_LRWAN1=y +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_CHIP="stm32f0l0g0" CONFIG_ARCH_CHIP_STM32L072CZ=y CONFIG_ARCH_CHIP_STM32L072XX=y diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs index f28302f576e..1b2109f1535 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs @@ -49,7 +49,7 @@ CSRCS += stm32_adc.c endif ifeq ($(CONFIG_LCD_SSD1306),y) -CSRCS += stm32_ssd1306.c +CSRCS += stm32_lcd_ssd1306.c endif DEPPATH += --dep-path board diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_ssd1306.c b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_lcd_ssd1306.c similarity index 63% rename from boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_ssd1306.c rename to boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_lcd_ssd1306.c index 6aa73c210d6..a619319cef2 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_ssd1306.c +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_lcd_ssd1306.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_ssd1306.c + * boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_lcd_ssd1306.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,27 +29,11 @@ #include #include #include -#include #include "stm32.h" #include "b-l072z-lrwan1.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_LCD_MAXPOWER -# define CONFIG_LCD_MAXPOWER 1 -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -struct i2c_master_s *g_i2c; -struct lcd_dev_s *g_lcddev; +#include "stm32_ssd1306.h" /**************************************************************************** * Public Functions @@ -61,13 +45,13 @@ struct lcd_dev_s *g_lcddev; int board_lcd_initialize(void) { - /* Initialize I2C */ + int ret; - g_i2c = stm32_i2cbus_initialize(OLED_I2C_PORT); - if (!g_i2c) + ret = board_ssd1306_initialize(OLED_I2C_PORT); + if (ret < 0) { - lcderr("ERROR: Failed to initialize I2C port %d\n", OLED_I2C_PORT); - return -ENODEV; + lcderr("ERROR: Failed to initialize SSD1306\n"); + return ret; } return OK; @@ -79,24 +63,7 @@ int board_lcd_initialize(void) struct lcd_dev_s *board_lcd_getdev(int devno) { - /* Bind the I2C port to the OLED */ - - g_lcddev = ssd1306_initialize(g_i2c, NULL, devno); - if (!g_lcddev) - { - lcderr("ERROR: Failed to bind I2C port 1 to OLED %d\n", devno); - } - else - { - lcdinfo("Bound I2C port %d to OLED %d\n", OLED_I2C_PORT, devno); - - /* And turn the OLED on */ - - g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER); - return g_lcddev; - } - - return NULL; + return board_ssd1306_getdev(); } /****************************************************************************