Esp32 lilygo t5v2 fixed Data/Command line support.
This commit is contained in:
parent
cfebb5a5c1
commit
7df798991c
@ -60,35 +60,6 @@ choice ESP32_SPIFLASH_FS
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
if LCD_SSD1680
|
|
||||||
config SSD1680_GPIO_PIN_RST
|
|
||||||
int "Pin that handles the reset line (output)"
|
|
||||||
default "12" if ARCH_BOARD_TTGO_T5V2_ESP32
|
|
||||||
|
|
||||||
config SSD1680_GPIO_PIN_BUSY
|
|
||||||
int "Pin that handles the busy line (input)"
|
|
||||||
default "4" if ARCH_BOARD_TTGO_T5V2_ESP32
|
|
||||||
|
|
||||||
config SSD1680_GPIO_PIN_PWR
|
|
||||||
int "Pin that handles the pwr on/off line (output)"
|
|
||||||
default "-1" if ARCH_BOARD_TTGO_T5V2_ESP32
|
|
||||||
|
|
||||||
config SSD1680_GPIO_PIN_CS
|
|
||||||
int "Pin that select the chip on SPI bus"
|
|
||||||
default "5" if ARCH_BOARD_TTGO_T5V2_ESP32
|
|
||||||
|
|
||||||
config SSD1680_GPIO_PIN_DTA_CMD
|
|
||||||
int "Pin that switch between command and data on 4-wire SPI bus"
|
|
||||||
default "19" if ARCH_BOARD_TTGO_T5V2_ESP32
|
|
||||||
|
|
||||||
config SSD1680_SPI_BUS
|
|
||||||
int "Spi Bus Number"
|
|
||||||
range 2 3
|
|
||||||
default "3"
|
|
||||||
depends on ESP32_SPI
|
|
||||||
|
|
||||||
endif #LCD_SSD1680
|
|
||||||
|
|
||||||
config ESP32_LCD_OVERCLOCK
|
config ESP32_LCD_OVERCLOCK
|
||||||
bool "Run LCD at higher clock speed than allowed"
|
bool "Run LCD at higher clock speed than allowed"
|
||||||
default n
|
default n
|
||||||
|
@ -52,7 +52,7 @@ static inline uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_LCD_ILI9341
|
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680)
|
||||||
if (devid == SPIDEV_DISPLAY(0))
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
status |= SPI_STATUS_PRESENT;
|
status |= SPI_STATUS_PRESENT;
|
||||||
@ -71,7 +71,7 @@ static inline uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid)
|
|||||||
static inline int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
|
static inline int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
|
||||||
bool cmd)
|
bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_LCD_ILI9341
|
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680)
|
||||||
if (devid == SPIDEV_DISPLAY(0))
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* This is the Data/Command control pad which determines whether the
|
/* This is the Data/Command control pad which determines whether the
|
||||||
@ -79,7 +79,6 @@ static inline int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
esp32_gpiowrite(DISPLAY_DC, !cmd);
|
esp32_gpiowrite(DISPLAY_DC, !cmd);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,36 +35,27 @@
|
|||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
#include "esp32_gpio.h"
|
#include "esp32_gpio.h"
|
||||||
#include "esp32_spi.h"
|
#include "esp32_spi.h"
|
||||||
|
|
||||||
#ifdef CONFIG_LCD_SSD1680
|
#ifdef CONFIG_LCD_SSD1680
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
|
#ifdef DISPLAY_VCC
|
||||||
static bool ssd1680_set_vcc(bool state)
|
static bool ssd1680_set_vcc(bool state);
|
||||||
{
|
|
||||||
esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
|
#ifdef DISPLAY_RST
|
||||||
static bool ssd1680_set_rst(bool state)
|
static bool ssd1680_set_rst(bool state);
|
||||||
{
|
|
||||||
esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
|
#ifdef DISPLAY_BUSY
|
||||||
static bool ssd1680_check_busy(void)
|
static bool ssd1680_check_busy(void);
|
||||||
{
|
|
||||||
return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -72,79 +63,107 @@ static bool ssd1680_check_busy(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static struct lcd_dev_s *g_lcddev;
|
static struct lcd_dev_s *g_lcddev;
|
||||||
struct ssd1680_priv_s g_ssd1680_priv =
|
|
||||||
|
static struct ssd1680_priv_s g_ssd1680_priv =
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
|
#ifdef DISPLAY_VCC
|
||||||
.set_vcc = ssd1680_set_vcc,
|
.set_vcc = ssd1680_set_vcc,
|
||||||
#else
|
|
||||||
.set_vcc = NULL,
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
|
#ifdef DISPLAY_RST
|
||||||
.set_rst = ssd1680_set_rst,
|
.set_rst = ssd1680_set_rst,
|
||||||
#else
|
|
||||||
.set_rst = NULL,
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
|
#ifdef DISPLAY_BUSY
|
||||||
.check_busy = ssd1680_check_busy,
|
.check_busy = ssd1680_check_busy,
|
||||||
#else
|
|
||||||
.check_busy = NULL,
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef DISPLAY_VCC
|
||||||
|
static bool ssd1680_set_vcc(bool state)
|
||||||
|
{
|
||||||
|
esp32_gpiowrite(DISPLAY_VCC, state);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DISPLAY_RST
|
||||||
|
static bool ssd1680_set_rst(bool state)
|
||||||
|
{
|
||||||
|
esp32_gpiowrite(DISPLAY_RST, state);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DISPLAY_BUSY
|
||||||
|
static bool ssd1680_check_busy(void)
|
||||||
|
{
|
||||||
|
return esp32_gpioread(DISPLAY_BUSY);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_lcd_getdev
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct lcd_dev_s *board_lcd_getdev(int devno)
|
||||||
|
{
|
||||||
|
return g_lcddev;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: board_lcd_initialize
|
* Name: board_lcd_initialize
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int board_lcd_initialize(void)
|
int board_lcd_initialize(void)
|
||||||
{
|
{
|
||||||
|
int ret = ERROR;
|
||||||
|
|
||||||
struct spi_dev_s *spi;
|
struct spi_dev_s *spi;
|
||||||
|
|
||||||
/* Initialize additional I/O for e-ink display */
|
/* Initialize additional I/O for e-ink display */
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
|
esp32_configgpio(DISPLAY_DC, OUTPUT);
|
||||||
(CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
|
|
||||||
esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
|
#ifdef DISPLAY_VCC
|
||||||
|
esp32_configgpio(DISPLAY_VCC, OUTPUT);
|
||||||
|
lcdinfo("Using pin %d as VCC control\n", DISPLAY_VCC);
|
||||||
|
#else
|
||||||
|
lcdinfo("VCC line is disabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
|
#ifdef DISPLAY_RST
|
||||||
esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
|
esp32_configgpio(DISPLAY_RST, OUTPUT);
|
||||||
lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
|
lcdinfo("Using pin %d as RESET\n", DISPLAY_RST);
|
||||||
#else
|
#else
|
||||||
lcdinfo("PWR control line is disabled\n");
|
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
|
|
||||||
esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
|
|
||||||
lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
|
|
||||||
#elif
|
|
||||||
lcdinfo("RESET line is disabled\n");
|
lcdinfo("RESET line is disabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
|
#ifdef DISPLAY_BUSY
|
||||||
(CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
|
esp32_configgpio(DISPLAY_BUSY, INPUT | PULLUP);
|
||||||
esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
|
|
||||||
lcdinfo("Using pin %d for reading busy state\n",
|
lcdinfo("Using pin %d for reading busy state\n",
|
||||||
CONFIG_SSD1680_GPIO_PIN_BUSY);
|
DISPLAY_BUSY);
|
||||||
#elif
|
#else
|
||||||
lcdinfo("Read busy line is disabled\n");
|
lcdinfo("Read busy line is disabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize SPI */
|
/* Initialize SPI */
|
||||||
|
|
||||||
spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
|
spi = esp32_spibus_initialize(DISPLAY_SPI_BUS);
|
||||||
if (!spi)
|
if (!spi)
|
||||||
{
|
{
|
||||||
lcderr("ERROR: Failed to initialize SPI port %d\n",
|
lcderr("ERROR: Failed to initialize SPI port %d\n", DISPLAY_SPI_BUS);
|
||||||
CONFIG_SSD1680_SPI_BUS);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcdinfo("Using SPI bus %d. SPI is initialized\n",
|
lcdinfo("Using SPI bus %d. SPI is initialized\n", DISPLAY_SPI_BUS);
|
||||||
CONFIG_SSD1680_SPI_BUS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bind the SPI port to the E-PAPER display */
|
/* Bind the SPI port to the E-PAPER display */
|
||||||
@ -153,37 +172,30 @@ int board_lcd_initialize(void)
|
|||||||
if (!g_lcddev)
|
if (!g_lcddev)
|
||||||
{
|
{
|
||||||
lcderr("ERROR: Failed to bind SPI port %d to E-paper display\n",
|
lcderr("ERROR: Failed to bind SPI port %d to E-paper display\n",
|
||||||
CONFIG_SSD1680_SPI_BUS);
|
DISPLAY_SPI_BUS);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcdinfo("Bound SPI port %d to E-PAPER\n", CONFIG_SSD1680_SPI_BUS);
|
lcdinfo("Bound SPI port %d to E-PAPER\n", DISPLAY_SPI_BUS);
|
||||||
|
|
||||||
/* And turn the OLED on.
|
/* And turn the E-PAPER display on in order to clear.
|
||||||
* Must be because setpower(1) function invokes the chip configuration
|
* Must be because setpower(1) function invokes the chip configuration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
|
g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_lcd_uninitialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_lcd_uninitialize(void)
|
||||||
|
{
|
||||||
|
/* TO-FIX */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_ssd1680_getdev
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Get the SSD1680 device driver instance
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* Pointer to the instance
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
struct lcd_dev_s *board_ssd1680_getdev(void)
|
|
||||||
{
|
|
||||||
return g_lcddev;
|
|
||||||
}
|
|
||||||
|
@ -82,4 +82,12 @@
|
|||||||
#define BOARD_NGPIOIN 1 /* Amount of GPIO Input without Interruption */
|
#define BOARD_NGPIOIN 1 /* Amount of GPIO Input without Interruption */
|
||||||
#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */
|
#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */
|
||||||
|
|
||||||
|
/* E-INK SSD1680 */
|
||||||
|
|
||||||
|
#define DISPLAY_DC 19
|
||||||
|
#define DISPLAY_RST 12
|
||||||
|
#define DISPLAY_BUSY 4
|
||||||
|
#define DISPLAY_CS 5
|
||||||
|
#define DISPLAY_SPI_BUS 3
|
||||||
|
|
||||||
#endif /* __BOARDS_XTENSA_ESP32_TTGO_EINK_5_V2_INCLUDE_BOARD_H */
|
#endif /* __BOARDS_XTENSA_ESP32_TTGO_EINK_5_V2_INCLUDE_BOARD_H */
|
||||||
|
@ -31,10 +31,6 @@ CSRCS += esp32_reset.c
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_VIDEO_FB),y)
|
|
||||||
CSRCS += esp32_lcd_ssd1680.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_MMCSD),y)
|
ifeq ($(CONFIG_MMCSD),y)
|
||||||
CSRCS += esp32_mmcsd.c
|
CSRCS += esp32_mmcsd.c
|
||||||
endif
|
endif
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_lcd_ssd1680.c
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership. The
|
|
||||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance with the
|
|
||||||
* License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <nuttx/board.h>
|
|
||||||
#include <nuttx/lcd/lcd.h>
|
|
||||||
#include <nuttx/lcd/ssd1680.h>
|
|
||||||
|
|
||||||
#include "esp32_ssd1680.h"
|
|
||||||
|
|
||||||
#include "ttgo_eink5_v2.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_lcd_getdev
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
struct lcd_dev_s *board_lcd_getdev(int devno)
|
|
||||||
{
|
|
||||||
return board_ssd1680_getdev();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_lcd_uninitialize
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void board_lcd_uninitialize(void)
|
|
||||||
{
|
|
||||||
/* TO-FIX */
|
|
||||||
}
|
|
@ -45,8 +45,6 @@
|
|||||||
|
|
||||||
#define SND 25
|
#define SND 25
|
||||||
|
|
||||||
/* E-INK SSD1680 Out */
|
|
||||||
|
|
||||||
/* LED
|
/* LED
|
||||||
*
|
*
|
||||||
* This is an externally connected LED used for testing.
|
* This is an externally connected LED used for testing.
|
||||||
|
@ -1557,8 +1557,8 @@ config SSD1680_SPIMODE
|
|||||||
|
|
||||||
config SSD1680_FREQUENCY
|
config SSD1680_FREQUENCY
|
||||||
int "SSD1680 SPI Frequency"
|
int "SSD1680 SPI Frequency"
|
||||||
default 2000000
|
default 5000000
|
||||||
range 100000 2000000
|
range 100000 20000000
|
||||||
---help---
|
---help---
|
||||||
Selects the SPI bus frequency used with the SSD1680 device.
|
Selects the SPI bus frequency used with the SSD1680 device.
|
||||||
Max for read mode is 2.5 MHz, for write mode is 20 HHz
|
Max for read mode is 2.5 MHz, for write mode is 20 HHz
|
||||||
|
Loading…
Reference in New Issue
Block a user