configs/flipnclick-pic32mz and -sam3x: Generalize naming. HiletGo is one SSD1306 LCD, but the logic should work with any SSD1306. Naming need to be generalized to SSD1306 to make this reusability clear.

This commit is contained in:
Gregory Nutt
2018-02-13 19:16:57 -06:00
parent e07f12954c
commit 2284d045ff
16 changed files with 147 additions and 149 deletions
+11 -11
View File
@@ -5,29 +5,29 @@
if ARCH_BOARD_FLIPNCLICK_PIC32MZ if ARCH_BOARD_FLIPNCLICK_PIC32MZ
config FLIPNCLICK_PIC32MZ_HILETGO config FLIPNCLICK_PIC32MZ_SSD1306
bool "HiletGo Click Present" bool "SSD1306 Click Present"
default n default n
depends on LCD_HILETGO depends on LCD_SSD1306
select NXSTART_EXTERNINIT if NX select NXSTART_EXTERNINIT if NX
choice choice
prompt "HiletGo mikroBUS" prompt "SSD1306 mikroBUS"
default FLIPNCLICK_PIC32MZ_HILETGO_MBA default FLIPNCLICK_PIC32MZ_SSD1306_MBA
depends on FLIPNCLICK_PIC32MZ_HILETGO depends on FLIPNCLICK_PIC32MZ_SSD1306
config FLIPNCLICK_PIC32MZ_HILETGO_MBA config FLIPNCLICK_PIC32MZ_SSD1306_MBA
bool "mikroBUS A" bool "mikroBUS A"
config FLIPNCLICK_PIC32MZ_HILETGO_MBB config FLIPNCLICK_PIC32MZ_SSD1306_MBB
bool "mikroBUS B" bool "mikroBUS B"
config FLIPNCLICK_PIC32MZ_HILETGO_MBC config FLIPNCLICK_PIC32MZ_SSD1306_MBC
bool "mikroBUS C" bool "mikroBUS C"
config FLIPNCLICK_PIC32MZ_HILETGO_MBD config FLIPNCLICK_PIC32MZ_SSD1306_MBD
bool "mikroBUS D" bool "mikroBUS D"
endchoice # HiletGo mikroBUS endchoice # SSD1306 mikroBUS
endif # ARCH_BOARD_FLIPNCLICK_PIC32MZ endif # ARCH_BOARD_FLIPNCLICK_PIC32MZ
+2 -2
View File
@@ -17,7 +17,7 @@ Contents
Serial Console Serial Console
SPI SPI
LEDs LEDs
HiletGo OLED SSD1306 OLED
Configurations Configurations
Port Status Port Status
@@ -326,7 +326,7 @@ LEDs and Buttons
The switches have external pull-up resistors. The switches are pulled high The switches have external pull-up resistors. The switches are pulled high
(+3.3V) and grounded when pressed. (+3.3V) and grounded when pressed.
HiletGo OLED SSD1306 OLED
============ ============
Hardware Hardware
+1 -1
View File
@@ -17,7 +17,7 @@ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
CONFIG_EXAMPLES_NXLINES_BPP=1 CONFIG_EXAMPLES_NXLINES_BPP=1
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
CONFIG_EXAMPLES_NXLINES=y CONFIG_EXAMPLES_NXLINES=y
CONFIG_FLIPNCLICK_PIC32MZ_HILETGO=y CONFIG_FLIPNCLICK_PIC32MZ_SSD1306=y
CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y CONFIG_HOST_WINDOWS=y
CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_IDLETHREAD_STACKSIZE=2048
+2 -2
View File
@@ -50,8 +50,8 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += pic32mz_buttons.c CSRCS += pic32mz_buttons.c
endif endif
ifeq ($(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO),y) ifeq ($(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306),y)
CSRCS += pic32mz_hiletgo.c CSRCS += pic32mz_ssd1306.c
endif endif
include $(TOPDIR)/configs/Board.mk include $(TOPDIR)/configs/Board.mk
@@ -48,21 +48,20 @@
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
#define HAVE_HILETGO 1 #define HAVE_SSD1306 1
/* The HiletGo LCD must be selected, installed on the Flip&Click, and must /* The SSD1306 LCD must be selected, installed on the Flip&Click, and must
* be configured to use the SPI interface. * be configured to use the SPI interface.
*/ */
#if !defined(CONFIG_LCD_HILETGO) || \ #if !defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306) || \
!defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO) || \
!defined(CONFIG_LCD_SSD1306_SPI) !defined(CONFIG_LCD_SSD1306_SPI)
# undef HAVE_HILETGO # undef HAVE_SSD1306
# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO # undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306
# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA # undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA
# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB # undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB
# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC # undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC
# undef CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD # undef CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD
#endif #endif
/* LEDs *********************************************************************/ /* LEDs *********************************************************************/
@@ -143,7 +142,7 @@
#define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12) #define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12)
#define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13) #define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13)
/* HiletGo OLED /* SSD1306 OLED
* *
* The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI
* is the default and is what is used here). I have mounted the OLED on a * is the default and is what is used here). I have mounted the OLED on a
@@ -174,45 +173,45 @@
* DC INT1 RD5 DC INT2 RD4 * DC INT1 RD5 DC INT2 RD4
*/ */
#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA)
# ifndef CONFIG_PIC32MZ_SPI2 # ifndef CONFIG_PIC32MZ_SPI2
# error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" # error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 2 # define SSD1306_SPI_BUS 2
# define GPIO_HILETGO_CS GPIO_MBA_CS # define GPIO_SSD1306_CS GPIO_MBA_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | GPIO_PIN2) # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | GPIO_PIN2)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN9) # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN9)
#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) #elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB)
# ifndef CONFIG_PIC32MZ_SPI2 # ifndef CONFIG_PIC32MZ_SPI2
# error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration" # error "The OLED driver requires CONFIG_PIC32MZ_SPI2 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 2 # define SSD1306_SPI_BUS 2
# define GPIO_HILETGO_CS GPIO_MBB_CS # define GPIO_SSD1306_CS GPIO_MBB_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN13) # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN13)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN1) # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN1)
#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) #elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC)
# ifndef CONFIG_PIC32MZ_SPI1 # ifndef CONFIG_PIC32MZ_SPI1
# error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" # error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 1 # define SSD1306_SPI_BUS 1
# define GPIO_HILETGO_CS GPIO_MBC_CS # define GPIO_SSD1306_CS GPIO_MBC_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN14) # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN14)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN5) # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN5)
#elif defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) #elif defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD)
# ifndef CONFIG_PIC32MZ_SPI1 # ifndef CONFIG_PIC32MZ_SPI1
# error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration" # error "The OLED driver requires CONFIG_PIC32MZ_SPI1 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 1 # define SSD1306_SPI_BUS 1
# define GPIO_HILETGO_CS GPIO_MBD_CS # define GPIO_SSD1306_CS GPIO_MBD_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN12) # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTG | GPIO_PIN12)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN4) # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTD | GPIO_PIN4)
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -277,11 +276,11 @@ int pic32mz_bringup(void);
* Description: * Description:
* Called by either NX initialization logic (via board_graphics_setup) or * Called by either NX initialization logic (via board_graphics_setup) or
* directly from the board bring-up logic in order to configure the * directly from the board bring-up logic in order to configure the
* HiletGo OLED. * SSD1306 OLED.
* *
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
struct lcd_dev_s; /* Forward reference */ struct lcd_dev_s; /* Forward reference */
FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno); FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno);
#endif #endif
@@ -72,12 +72,12 @@ int pic32mz_bringup(void)
} }
#endif #endif
#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) #if defined(HAVE_SSD1306) && !defined(CONFIG_NXSTART_EXTERNINIT)
/* Configure the HiletGo OLED */ /* Configure the SSD1306 OLED */
if (pic32mz_graphics_setup(0) == NULL) if (pic32mz_graphics_setup(0) == NULL)
{ {
syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n");
} }
#endif #endif
+16 -16
View File
@@ -68,11 +68,11 @@
void weak_function pic32mz_spidev_initialize(void) void weak_function pic32mz_spidev_initialize(void)
{ {
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
/* Configure the HiletGo chip select and command/data GPIOs */ /* Configure the SSD1306 chip select and command/data GPIOs */
(void)pic32mz_configgpio(GPIO_HILETGO_CS); (void)pic32mz_configgpio(GPIO_SSD1306_CS);
(void)pic32mz_configgpio(GPIO_HILETGO_DC); (void)pic32mz_configgpio(GPIO_SSD1306_DC);
#endif #endif
} }
@@ -111,15 +111,15 @@ void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) || \
defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD)
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* Low: the display is selected /* Low: the display is selected
* High: the display is deselected * High: the display is deselected
*/ */
pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); pic32mz_gpiowrite(GPIO_SSD1306_CS, !selected);
} }
#endif #endif
} }
@@ -132,15 +132,15 @@ uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
#ifdef CONFIG_SPI_CMDDATA #ifdef CONFIG_SPI_CMDDATA
int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{ {
#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBC) || \ #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) || \
defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBD) defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD)
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* High: the inputs are treated as display data. /* High: the inputs are treated as display data.
* Low: the inputs are transferred to the command registers. * Low: the inputs are transferred to the command registers.
*/ */
pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); pic32mz_gpiowrite(GPIO_SSD1306_DC, !cmd);
} }
#endif #endif
@@ -154,15 +154,15 @@ void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte
{ {
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) || \
defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB)
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* Low: the display is selected /* Low: the display is selected
* High: the display is deselected * High: the display is deselected
*/ */
pic32mz_gpiowrite(GPIO_HILETGO_CS, !selected); pic32mz_gpiowrite(GPIO_SSD1306_CS, !selected);
} }
#endif #endif
} }
@@ -175,15 +175,15 @@ uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
#ifdef CONFIG_SPI_CMDDATA #ifdef CONFIG_SPI_CMDDATA
int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{ {
#if defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBA) || \ #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) || \
defined(CONFIG_FLIPNCLICK_PIC32MZ_HILETGO_MBB) defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB)
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* High: the inputs are treated as display data. /* High: the inputs are treated as display data.
* Low: the inputs are transferred to the command registers. * Low: the inputs are transferred to the command registers.
*/ */
pic32mz_gpiowrite(GPIO_HILETGO_DC, !cmd); pic32mz_gpiowrite(GPIO_SSD1306_DC, !cmd);
} }
#endif #endif
@@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* config/flipnclick-pic32mz/src/pic32mz_hiletgo.c * config/flipnclick-pic32mz/src/pic32mz_ssd1306.c
* *
* Copyright (C) 2018 Gregory Nutt. All rights reserved. * Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@@ -33,7 +33,7 @@
* *
****************************************************************************/ ****************************************************************************/
/* HiletGo OLED /* SSD1306 OLED
* *
* The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI
* is the default and is what is used here). I have mounted the OLED on a * is the default and is what is used here). I have mounted the OLED on a
@@ -72,7 +72,7 @@
#include "flipnclick-pic32mz.h" #include "flipnclick-pic32mz.h"
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@@ -93,7 +93,7 @@
* Description: * Description:
* Called by either NX initialization logic (via board_graphics_setup) or * Called by either NX initialization logic (via board_graphics_setup) or
* directly from the board bring-up logic in order to configure the * directly from the board bring-up logic in order to configure the
* HiletGo OLED. * SSD1306 OLED.
* *
****************************************************************************/ ****************************************************************************/
@@ -106,16 +106,16 @@ FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno)
* putting the OLED into reset state. * putting the OLED into reset state.
*/ */
(void)pic32mz_configgpio(GPIO_HILETGO_RST); (void)pic32mz_configgpio(GPIO_SSD1306_RST);
/* Wait a bit then release the OLED from the reset state */ /* Wait a bit then release the OLED from the reset state */
up_mdelay(20); up_mdelay(20);
pic32mz_gpiowrite(GPIO_HILETGO_RST, true); pic32mz_gpiowrite(GPIO_SSD1306_RST, true);
/* Get the SPI1 port interface */ /* Get the SPI1 port interface */
spi = pic32mz_spibus_initialize(HILETGO_SPI_BUS); spi = pic32mz_spibus_initialize(SSD1306_SPI_BUS);
if (!spi) if (!spi)
{ {
lcderr("ERROR: Failed to initialize SPI port 1\n"); lcderr("ERROR: Failed to initialize SPI port 1\n");
@@ -169,4 +169,4 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
} }
#endif #endif
#endif /* HAVE_HILETGO */ #endif /* HAVE_SSD1306 */
+11 -11
View File
@@ -5,29 +5,29 @@
if ARCH_BOARD_FLIPNCLICK_SAM3X if ARCH_BOARD_FLIPNCLICK_SAM3X
config FLIPNCLICK_SAM3X_HILETGO config FLIPNCLICK_SAM3X_SSD1306
bool "HiletGo Click Present" bool "SSD1306 Click Present"
default n default n
depends on LCD_HILETGO depends on LCD_SSD1306
select NXSTART_EXTERNINIT if NX select NXSTART_EXTERNINIT if NX
choice choice
prompt "HiletGo mikroBUS" prompt "SSD1306 mikroBUS"
default FLIPNCLICK_SAM3X_HILETGO_MBA default FLIPNCLICK_SAM3X_SSD1306_MBA
depends on FLIPNCLICK_SAM3X_HILETGO depends on FLIPNCLICK_SAM3X_SSD1306
config FLIPNCLICK_SAM3X_HILETGO_MBA config FLIPNCLICK_SAM3X_SSD1306_MBA
bool "mikroBUS A" bool "mikroBUS A"
config FLIPNCLICK_SAM3X_HILETGO_MBB config FLIPNCLICK_SAM3X_SSD1306_MBB
bool "mikroBUS B" bool "mikroBUS B"
config FLIPNCLICK_SAM3X_HILETGO_MBC config FLIPNCLICK_SAM3X_SSD1306_MBC
bool "mikroBUS C" bool "mikroBUS C"
config FLIPNCLICK_SAM3X_HILETGO_MBD config FLIPNCLICK_SAM3X_SSD1306_MBD
bool "mikroBUS D" bool "mikroBUS D"
endchoice # HiletGo mikroBUS endchoice # SSD1306 mikroBUS
endif endif
+2 -2
View File
@@ -16,7 +16,7 @@ Contents
- Serial Consoles - Serial Consoles
- SPI - SPI
- I2C - I2C
- HiletGo OLED - SSD1306 OLED
- Loading Code - Loading Code
- Flip&Click SAM3X-specific Configuration Options - Flip&Click SAM3X-specific Configuration Options
- Configurations - Configurations
@@ -188,7 +188,7 @@ I2C
SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 SCL I2C1_SCL PB13 SCL I2C1_SCL PB13
SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 SDA I2C1_SDA PB12 SDA I2C1_SDA PB12
HiletGo OLED SSD1306 OLED
============ ============
Hardware Hardware
+2 -2
View File
@@ -16,8 +16,8 @@ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
CONFIG_EXAMPLES_NXLINES_BPP=1 CONFIG_EXAMPLES_NXLINES_BPP=1
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
CONFIG_EXAMPLES_NXLINES=y CONFIG_EXAMPLES_NXLINES=y
CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB=y CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB=y
CONFIG_FLIPNCLICK_SAM3X_HILETGO=y CONFIG_FLIPNCLICK_SAM3X_SSD1306=y
CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y CONFIG_HAVE_CXXINITIALIZE=y
+2 -2
View File
@@ -52,8 +52,8 @@ ifeq ($(CONFIG_SAM34_SPI0),y)
CSRCS += sam_spi0.c CSRCS += sam_spi0.c
endif endif
ifeq ($(CONFIG_FLIPNCLICK_SAM3X_HILETGO),y) ifeq ($(CONFIG_FLIPNCLICK_SAM3X_SSD1306),y)
CSRCS += sam_hiletgo.c CSRCS += sam_ssd1306.c
endif endif
include $(TOPDIR)/configs/Board.mk include $(TOPDIR)/configs/Board.mk
+36 -37
View File
@@ -55,21 +55,20 @@
************************************************************************************/ ************************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
#define HAVE_HILETGO 1 #define HAVE_SSD1306 1
/* The HiletGo LCD must be selected, installed on the Flip&Click, and must /* The SSD1306 LCD must be selected, installed on the Flip&Click, and must
* be configured to use the SPI interface. * be configured to use the SPI interface.
*/ */
#if !defined(CONFIG_LCD_HILETGO) || \ #if !defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306) || \
!defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO) || \
!defined(CONFIG_LCD_SSD1306_SPI) !defined(CONFIG_LCD_SSD1306_SPI)
# undef HAVE_HILETGO # undef HAVE_SSD1306
# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO # undef CONFIG_FLIPNCLICK_SAM3X_SSD1306
# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA # undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBA
# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB # undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB
# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC # undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBC
# undef CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD # undef CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBD
#endif #endif
/* There are four LEDs on the top, blue side of the board. Only one can be /* There are four LEDs on the top, blue side of the board. Only one can be
@@ -147,7 +146,7 @@
GPIO_PORT_PIOB | GPIO_PIN23) GPIO_PORT_PIOB | GPIO_PIN23)
#define MBD_CSNUM 3 #define MBD_CSNUM 3
/* HiletGo OLED /* SSD1306 OLED
* *
* The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI
* is the default and is what is used here). I have mounted the OLED on a * is the default and is what is used here). I have mounted the OLED on a
@@ -178,56 +177,56 @@
* DC INTC PD3 DC INTD PD6 * DC INTC PD3 DC INTD PD6
*/ */
#if defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBA) #if defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBA)
# ifndef CONFIG_SAM34_SPI0 # ifndef CONFIG_SAM34_SPI0
# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 0 # define SSD1306_SPI_BUS 0
# define HILETGO_CSNUM MBA_CSNUM # define SSD1306_CSNUM MBA_CSNUM
# define GPIO_HILETGO_CS GPIO_MBA_CS # define GPIO_SSD1306_CS GPIO_MBA_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN1) GPIO_PORT_PIOC | GPIO_PIN1)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOD | GPIO_PIN1) GPIO_PORT_PIOD | GPIO_PIN1)
#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBB) #elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBB)
# ifndef CONFIG_SAM34_SPI0 # ifndef CONFIG_SAM34_SPI0
# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 0 # define SSD1306_SPI_BUS 0
# define HILETGO_CSNUM MBB_CSNUM # define SSD1306_CSNUM MBB_CSNUM
# define GPIO_HILETGO_CS GPIO_MBB_CS # define GPIO_SSD1306_CS GPIO_MBB_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN2) GPIO_PORT_PIOC | GPIO_PIN2)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOD | GPIO_PIN2) GPIO_PORT_PIOD | GPIO_PIN2)
#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBC) #elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBC)
# ifndef CONFIG_SAM34_SPI0 # ifndef CONFIG_SAM34_SPI0
# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 0 # define SSD1306_SPI_BUS 0
# define HILETGO_CSNUM MBC_CSNUM # define SSD1306_CSNUM MBC_CSNUM
# define GPIO_HILETGO_CS GPIO_MBC_CS # define GPIO_SSD1306_CS GPIO_MBC_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN3) GPIO_PORT_PIOC | GPIO_PIN3)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOD | GPIO_PIN3) GPIO_PORT_PIOD | GPIO_PIN3)
#elif defined(CONFIG_FLIPNCLICK_SAM3X_HILETGO_MBD) #elif defined(CONFIG_FLIPNCLICK_SAM3X_SSD1306_MBD)
# ifndef CONFIG_SAM34_SPI0 # ifndef CONFIG_SAM34_SPI0
# error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration" # error "The OLED driver requires CONFIG_SAM34_SPI0 in the configuration"
# endif # endif
# define HILETGO_SPI_BUS 0 # define SSD1306_SPI_BUS 0
# define HILETGO_CSNUM MBD_CSNUM # define SSD1306_CSNUM MBD_CSNUM
# define GPIO_HILETGO_CS GPIO_MBD_CS # define GPIO_SSD1306_CS GPIO_MBD_CS
# define GPIO_HILETGO_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_RST (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN4) GPIO_PORT_PIOC | GPIO_PIN4)
# define GPIO_HILETGO_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ # define GPIO_SSD1306_DC (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOD | GPIO_PIN6) GPIO_PORT_PIOD | GPIO_PIN6)
#endif #endif
@@ -267,11 +266,11 @@ int sam_bringup(void);
* Description: * Description:
* Called by either NX initialization logic (via board_graphics_setup) or * Called by either NX initialization logic (via board_graphics_setup) or
* directly from the board bring-up logic in order to configure the * directly from the board bring-up logic in order to configure the
* HiletGo OLED. * SSD1306 OLED.
* *
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
struct lcd_dev_s; /* Forward reference */ struct lcd_dev_s; /* Forward reference */
FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno); FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno);
#endif #endif
+3 -3
View File
@@ -84,12 +84,12 @@ int sam_bringup(void)
} }
#endif #endif
#if defined(HAVE_HILETGO) && !defined(CONFIG_NXSTART_EXTERNINIT) #if defined(HAVE_SSD1306) && !defined(CONFIG_NXSTART_EXTERNINIT)
/* Configure the HiletGo OLED */ /* Configure the SSD1306 OLED */
if (sam_graphics_setup(0) == NULL) if (sam_graphics_setup(0) == NULL)
{ {
syslog(LOG_ERR,"ERROR: Failed to configure the HiletGo OLED\n"); syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n");
} }
#endif #endif
+8 -8
View File
@@ -70,11 +70,11 @@
void weak_function sam_spidev_initialize(void) void weak_function sam_spidev_initialize(void)
{ {
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
/* Configure the HiletGo chip select and command/data GPIOs */ /* Configure the SSD1306 chip select and command/data GPIOs */
sam_configgpio(GPIO_HILETGO_CS); sam_configgpio(GPIO_SSD1306_CS);
sam_configgpio(GPIO_HILETGO_DC); sam_configgpio(GPIO_SSD1306_DC);
#endif #endif
} }
@@ -141,14 +141,14 @@ void sam_spi0select(uint32_t devid, bool selected)
spiinfo("devid: %08x CS: %s\n", spiinfo("devid: %08x CS: %s\n",
(unsigned int)devid, selected ? "assert" : "de-assert"); (unsigned int)devid, selected ? "assert" : "de-assert");
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* Low: the display is selected /* Low: the display is selected
* High: the display is deselected * High: the display is deselected
*/ */
sam_gpiowrite(GPIO_HILETGO_CS, !selected); sam_gpiowrite(GPIO_SSD1306_CS, !selected);
} }
#endif #endif
} }
@@ -201,14 +201,14 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{ {
spiinfo("devid: %08x %s\n", (unsigned int)devid, cmd ? "cmd" : "data"); spiinfo("devid: %08x %s\n", (unsigned int)devid, cmd ? "cmd" : "data");
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
if (devid == SPIDEV_DISPLAY(0)) if (devid == SPIDEV_DISPLAY(0))
{ {
/* High: the inputs are treated as display data. /* High: the inputs are treated as display data.
* Low: the inputs are transferred to the command registers. * Low: the inputs are transferred to the command registers.
*/ */
sam_gpiowrite(GPIO_HILETGO_DC, !cmd); sam_gpiowrite(GPIO_SSD1306_DC, !cmd);
} }
#endif #endif
@@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* config/flipnclick-sam3x/src/sam_hiletgo.c * config/flipnclick-sam3x/src/sam_ssd1306.c
* *
* Copyright (C) 2018 Gregory Nutt. All rights reserved. * Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@@ -33,7 +33,7 @@
* *
****************************************************************************/ ****************************************************************************/
/* HiletGo OLED /* SSD1306 OLED
* *
* The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI
* is the default and is what is used here). I have mounted the OLED on a * is the default and is what is used here). I have mounted the OLED on a
@@ -72,7 +72,7 @@
#include "flipnclick-sam3x.h" #include "flipnclick-sam3x.h"
#ifdef HAVE_HILETGO #ifdef HAVE_SSD1306
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@@ -93,7 +93,7 @@
* Description: * Description:
* Called by either NX initialization logic (via board_graphics_setup) or * Called by either NX initialization logic (via board_graphics_setup) or
* directly from the board bring-up logic in order to configure the * directly from the board bring-up logic in order to configure the
* HiletGo OLED. * SSD1306 OLED.
* *
****************************************************************************/ ****************************************************************************/
@@ -106,16 +106,16 @@ FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno)
* putting the OLED into reset state. * putting the OLED into reset state.
*/ */
sam_configgpio(GPIO_HILETGO_RST); sam_configgpio(GPIO_SSD1306_RST);
/* Wait a bit then release the OLED from the reset state */ /* Wait a bit then release the OLED from the reset state */
up_mdelay(20); up_mdelay(20);
sam_gpiowrite(GPIO_HILETGO_RST, true); sam_gpiowrite(GPIO_SSD1306_RST, true);
/* Get the SPI1 port interface */ /* Get the SPI1 port interface */
spi = sam_spibus_initialize(GPIO_HILETGO_CS); spi = sam_spibus_initialize(GPIO_SSD1306_CS);
if (!spi) if (!spi)
{ {
lcderr("ERROR: Failed to initialize SPI port 1\n"); lcderr("ERROR: Failed to initialize SPI port 1\n");
@@ -169,4 +169,4 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
} }
#endif #endif
#endif /* HAVE_HILETGO */ #endif /* HAVE_SSD1306 */