drivers/lcd: Add JD9851 driver

Added support for the JD9851 TFT controller based on ST7789

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina
2023-05-24 17:59:02 +08:00
committed by Xiang Xiao
parent 73832ab0a4
commit 0b8d5e993d
5 changed files with 1133 additions and 0 deletions
+55
View File
@@ -805,6 +805,61 @@ if LCD_GC9A01
endif # LCD_GC9A01
config LCD_JD9851
bool "Fitipower JD9851 TFT Controller"
default n
if LCD_JD9851
config LCD_JD9851_XRES
int "JD9851 X Resolution"
default 240
---help---
Specifies the X resolution of the LCD.
config LCD_JD9851_YRES
int "JD9851 Y Resolution"
default 320
---help---
Specifies the Y resolution of the LCD.
config LCD_JD9851_XOFFSET
int "JD9851 X Offset"
default 0
---help---
Specifies the X offset of the LCD.
config LCD_JD9851_YOFFSET
int "JD9851 Y Offset"
default 0
---help---
Specifies the Y offset of the LCD.
config LCD_JD9851_BGR
bool "Swap R & B channel"
default n
config LCD_JD9851_BPP
int "Bit Per Pixel (16)"
default 16
config LCD_JD9851_SPIMODE
int "SPI Mode"
default 0
config LCD_JD9851_FREQUENCY
int "SPI Frequency"
default 1000000
config LCD_JD9851_INVERT
bool "Enter into display inversion mode"
default n
config LCD_JD9851_TE
bool "Tearing effect line on"
default n
endif # LCD_JD9851
config LCD_PCD8544
bool "Nokia 5110 LCD Display (Philips PCD8544)"
default n
+4
View File
@@ -145,6 +145,10 @@ ifeq ($(CONFIG_LCD_GC9A01),y)
CSRCS += gc9a01.c
endif
ifeq ($(CONFIG_LCD_JD9851),y)
CSRCS += jd9851.c
endif
endif # CONFIG_LCD
ifeq ($(CONFIG_SLCD),y)
File diff suppressed because it is too large Load Diff
+86
View File
@@ -0,0 +1,86 @@
/****************************************************************************
* drivers/lcd/jd9851.h
*
* 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.
*
****************************************************************************/
#ifndef __DRIVERS_LCD_JD9851_H
#define __DRIVERS_LCD_JD9851_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define JD9851_SLEEP_IN 0x10 /* Sleep in */
#define JD9851_SLEEP_OUT 0x11 /* Sleep out */
#define JD9851_INVERSION_ON 0x21 /* Display inversion on */
#define JD9851_DISOFF 0x28 /* Display off */
#define JD9851_DISON 0x29 /* Display on */
#define JD9851_CASET 0x2A /* Column address set */
#define JD9851_PASET 0x2B /* Page address set */
#define JD9851_RAMWR 0x2C /* Memory Write */
#define JD9851_RAMRD 0x2E /* Memory read */
#define JD9851_TEOFF 0x34 /* Tearing effect line off */
#define JD9851_TEON 0x35 /* Tearing effect line on */
#define JD9851_TE_MODE0 0x00
#define JD9851_TE_MODE1 0x01
#define JD9851_COLMOD 0x3A /* Pixel format set */
#define JD9851_COLMOD_16BIT 0x55
#define JD9851_MADCTL 0x36 /* Memory Data Access Control */
#define JD9851_MADCTL_MY (1<<7) /* Page Address Order */
#define JD9851_MADCTL_MX (1<<6) /* Column Address Order */
#define JD9851_MADCTL_MV (1<<5) /* Page/Column Order */
#define JD9851_MADCTL_ML (1<<4) /* Line Address Order */
#define JD9851_MADCTL_BGR (1<<3) /* Set Panel Order BGR */
#define JD9851_SET_PAGE_CMD 0xDE /* Change page */
#define JD9851_PAGE_0 0x00
#define JD9851_PAGE_2 0x02
#define JD9851_PASSWORD 0xDF /* Set password to access inhouse reg */
/* PAGE_0 */
#define JD9851_GAMMA_SET_CMD 0xB7
#define JD9851_R_GAMMA_SET_CMD 0xC8
#define JD9851_POWER_CTRL 0xB9 /* Control engineer mode of power related setting */
#define JD9851_DCDC_SET 0xBB /* Set charge pump related setting */
#define JD9851_VDDD_CTRL 0xBC /* Control inrernal logic voltage setting */
#define JD9851_SETSTBA 0xC0 /* Set source output driving ability */
#define JD9851_SETPANEL 0xC1 /* Set panel related reg, page_0/2 */
#define JD9851_SETRGBCYC 0xC3 /* Set internal SD output timing */
#define JD9851_SETTCON 0xC4 /* Set timing control */
#define JD9851_SETGD 0xD0 /* Set Gate function */
#define JD9851_SETRGBIF 0xBD /* Set RGB interface related setting */
#define JD9851_RAM_CTRL 0xD7 /* Set interface related setting */
/* PAGE_2 */
#define JD9851_DCDC_SET2 0xB8 /* Set internal OTP program related setting */
#define JD9851_OSCM_SET 0xC5 /* Set oscillator M. OSCM */
#define JD9851_SETMIPI_2 0xCA
FAR struct lcd_dev_s *jd9851_lcdinitialize(FAR struct spi_dev_s *spi);
#endif /* __DRIVERS_LCD_JD9851_H */
+72
View File
@@ -0,0 +1,72 @@
/****************************************************************************
* include/nuttx/lcd/jd9851.h
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_LCD_JD9851_H
#define __INCLUDE_NUTTX_LCD_JD9851_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: jd9851_initialize
*
* Description:
* Initialize the JD9851 video hardware. The initial state of the
* LCD is fully initialized, display memory cleared, and the LCD ready
* to use, but with the power setting at 0 (full off == sleep mode).
*
* Returned Value:
*
* On success, this function returns a reference to the LCD object for
* the specified LCD. NULL is returned on any failure.
*
****************************************************************************/
FAR struct lcd_dev_s *jd9851_lcdinitialize(FAR struct spi_dev_s *spi);
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_LCD_JD9851_H */