Arrow3-MBN-APP
 
Loading...
Searching...
No Matches
lcd_init.c File Reference

source file that has LCD display drivers - ST7291 More...

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <linux/gpio.h>
#include <fcntl.h>
#include <linux/spi/spidev.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/eventfd.h>
#include <sys/epoll.h>
#include <stdint.h>
#include <time.h>
#include <getopt.h>
#include <sys/time.h>
#include <linux/types.h>
Include dependency graph for lcd_init.c:

Data Structures

struct  lv_color_t
 

Macros

#define ST7291_SW_RESET   0x01
 
#define ST7291_SLPOUT   0x11
 
#define ST7291_FRMCTR1   0xB1
 
#define ST7291_FRMCTR2   0xB2
 
#define ST7291_FRMCTR3   0xB3
 
#define ST7291_INVCTR   0xB4
 
#define ST7291_PWCTR1   0xC0
 
#define ST7291_PWCTR2   0xC1
 
#define ST7291_PWCTR3   0xC2
 
#define ST7291_PWCTR4   0xC3
 
#define ST7291_PWCTR5   0xC4
 
#define ST7291_VMCTR1   0xC5
 
#define ST7291_COLMOD   0x3A
 
#define ST7291_MADCTL   0x36 /* Memory Data Access Control */
 
#define ST7291_CASET   0x2A
 
#define ST7291_RASET   0x2B
 
#define ST7291_GMSET   0xF2 /* Gammas Adjustment. */
 
#define ST7291_GMCTRP1   0xE0
 
#define ST7291_GMCTRN1   0xE1
 
#define ST7291_DISPOFF   0x28
 
#define ST7291_DISPON   0x29
 
#define ST7291_NORON   0x13
 
#define ST7291_RAMWR   0x2C
 
#define LCD_RED   0xF800
 
#define LCD_GREEN   0x07E0
 
#define LCD_AMBER   0x0BFC
 
#define LCD_BLUE   0x001F
 
#define LCD_WHITE   0xFFFF
 
#define LCD_BLACK   0x0000
 
#define LCD_SPICS_GPIO   379
 
#define LCD_RST_GPIO   380
 
#define LCD_DATACMD_GPIO   383
 
#define LCD_IO_CONTROL_PIN   467
 
#define ST7735_SCREEN_WIDTH   160
 
#define ST7735_SCREEN_HEIGHT   132
 
#define ST7735_SCREEN_HEIGHT   132
 
#define MAX_BUFFER_SIZE   ((ST7735_SCREEN_WIDTH * ST7735_SCREEN_HEIGHT * 3) + 16)
 
#define MAX_CHUCK_SIZE   1024
 
#define DRAW_BUFFER_NUM_LINESS   10
 
#define MY_DISP_HOR_RESS   132
 
#define MY_DISP_VER_RESS   132
 

Functions

int GPIO_pin_SetValue (int GPIONUM, int Value)
 Gpio set value high or low.
 
int LCD_SPI_DATAWRITE (uint8_t data)
 
int LCD_SPI_CMDWRITE (uint8_t cmd)
 
int LCD_SPI_BUFFDATAWRITE (uint8_t *data, uint16_t datalen)
 
int LCD_SPI_BUFFWRITE (uint8_t *data, uint16_t datalen)
 
void lcd_init (void)
 Function to perform LCD functionality.
 
void LCD_RST (void)
 LCD reset.
 
uint8_t ST7291_setScreenColor (uint16_t screenBasecolor, uint32_t pixcelNum)
 function to fill the screen color
 
uint8_t ST7291_fillScreenColor (uint16_t screenBasecolor)
 Function to fill the screen colour pixel by pixel.
 
uint8_t ST7291_setScreenWindow (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
 function to setting the window color
 
int ST7291_init (void)
 Initialization of the LCD ST7291_chip.
 
int LCD_SET_DATACMD (char mode)
 Sets the data/cmd line to receive the data nased on the modes.
 
void lcd_refresh (lv_color_t *framebuf)
 Refreshes the screen.
 
void lcd_send_data (uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint8_t *p)
 Send data pixelwise.
 
void lcd_refreshbuf (lv_color_t *framebuf)
 Refreshes the screen.
 

Variables

int32_t colours [6] = { LCD_RED, LCD_GREEN, LCD_AMBER,LCD_BLUE, LCD_WHITE,LCD_BLACK}
 
char errbuf [100] ={0}
 
int lcd_status = 1
 

Detailed Description

source file that has LCD display drivers - ST7291

Macro Definition Documentation

◆ DRAW_BUFFER_NUM_LINESS

#define DRAW_BUFFER_NUM_LINESS   10

◆ LCD_AMBER

#define LCD_AMBER   0x0BFC

◆ LCD_BLACK

#define LCD_BLACK   0x0000

◆ LCD_BLUE

#define LCD_BLUE   0x001F

◆ LCD_DATACMD_GPIO

#define LCD_DATACMD_GPIO   383

◆ LCD_GREEN

#define LCD_GREEN   0x07E0

◆ LCD_IO_CONTROL_PIN

#define LCD_IO_CONTROL_PIN   467

◆ LCD_RED

#define LCD_RED   0xF800

◆ LCD_RST_GPIO

#define LCD_RST_GPIO   380

◆ LCD_SPICS_GPIO

#define LCD_SPICS_GPIO   379

◆ LCD_WHITE

#define LCD_WHITE   0xFFFF

◆ MAX_BUFFER_SIZE

#define MAX_BUFFER_SIZE   ((ST7735_SCREEN_WIDTH * ST7735_SCREEN_HEIGHT * 3) + 16)

◆ MAX_CHUCK_SIZE

#define MAX_CHUCK_SIZE   1024

◆ MY_DISP_HOR_RESS

#define MY_DISP_HOR_RESS   132

◆ MY_DISP_VER_RESS

#define MY_DISP_VER_RESS   132

◆ ST7291_CASET

#define ST7291_CASET   0x2A

◆ ST7291_COLMOD

#define ST7291_COLMOD   0x3A

◆ ST7291_DISPOFF

#define ST7291_DISPOFF   0x28

◆ ST7291_DISPON

#define ST7291_DISPON   0x29

◆ ST7291_FRMCTR1

#define ST7291_FRMCTR1   0xB1

◆ ST7291_FRMCTR2

#define ST7291_FRMCTR2   0xB2

◆ ST7291_FRMCTR3

#define ST7291_FRMCTR3   0xB3

◆ ST7291_GMCTRN1

#define ST7291_GMCTRN1   0xE1

◆ ST7291_GMCTRP1

#define ST7291_GMCTRP1   0xE0

◆ ST7291_GMSET

#define ST7291_GMSET   0xF2 /* Gammas Adjustment. */

◆ ST7291_INVCTR

#define ST7291_INVCTR   0xB4

◆ ST7291_MADCTL

#define ST7291_MADCTL   0x36 /* Memory Data Access Control */

◆ ST7291_NORON

#define ST7291_NORON   0x13

◆ ST7291_PWCTR1

#define ST7291_PWCTR1   0xC0

◆ ST7291_PWCTR2

#define ST7291_PWCTR2   0xC1

◆ ST7291_PWCTR3

#define ST7291_PWCTR3   0xC2

◆ ST7291_PWCTR4

#define ST7291_PWCTR4   0xC3

◆ ST7291_PWCTR5

#define ST7291_PWCTR5   0xC4

◆ ST7291_RAMWR

#define ST7291_RAMWR   0x2C

◆ ST7291_RASET

#define ST7291_RASET   0x2B

◆ ST7291_SLPOUT

#define ST7291_SLPOUT   0x11

◆ ST7291_SW_RESET

#define ST7291_SW_RESET   0x01

◆ ST7291_VMCTR1

#define ST7291_VMCTR1   0xC5

◆ ST7735_SCREEN_HEIGHT [1/2]

#define ST7735_SCREEN_HEIGHT   132

◆ ST7735_SCREEN_HEIGHT [2/2]

#define ST7735_SCREEN_HEIGHT   132

◆ ST7735_SCREEN_WIDTH

#define ST7735_SCREEN_WIDTH   160

Function Documentation

◆ GPIO_pin_SetValue()

int GPIO_pin_SetValue ( int GPIONUM,
int Value )
extern

Gpio set value high or low.

Parameters
GPIONUMgpio pin number
Value[1- high] [0- low]
Returns
API_SUCCESSS_test on success or AP_FAILURE_test on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lcd_init()

void lcd_init ( void )

Function to perform LCD functionality.

Parameters
NULL
Returns
API_SUCCESSS_test on success or API_FAILURE_test on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lcd_refresh()

void lcd_refresh ( lv_color_t * framebuf)

Refreshes the screen.

Parameters
*framebufpointer to the buffer value
Here is the call graph for this function:

◆ lcd_refreshbuf()

void lcd_refreshbuf ( lv_color_t * framebuf)

Refreshes the screen.

Parameters
*framebufpointer to the buffer value
Here is the call graph for this function:

◆ LCD_RST()

void LCD_RST ( void )

LCD reset.

Parameters
none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lcd_send_data()

void lcd_send_data ( uint16_t x_start,
uint16_t y_start,
uint16_t x_end,
uint16_t y_end,
uint8_t * p )

Send data pixelwise.

Parameters
x_startstarting address of x axis
y_startstarting address of y axis
x_endending address of the x axis
y_endending address of the y axis
*ppixel
Here is the call graph for this function:

◆ LCD_SET_DATACMD()

int LCD_SET_DATACMD ( char mode)

Sets the data/cmd line to receive the data nased on the modes.

Parameters
mode[0- command], [1- data]
Returns
API_SUCCESSS_test on success or AP_FAILURE_test on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LCD_SPI_BUFFDATAWRITE()

int LCD_SPI_BUFFDATAWRITE ( uint8_t * data,
uint16_t datalen )
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LCD_SPI_BUFFWRITE()

int LCD_SPI_BUFFWRITE ( uint8_t * data,
uint16_t datalen )
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LCD_SPI_CMDWRITE()

int LCD_SPI_CMDWRITE ( uint8_t cmd)
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LCD_SPI_DATAWRITE()

int LCD_SPI_DATAWRITE ( uint8_t data)
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ST7291_fillScreenColor()

uint8_t ST7291_fillScreenColor ( uint16_t screenBasecolor)

Function to fill the screen colour pixel by pixel.

Parameters
screenBasecolorRGB value of the colour to be filled
pixcelNumTotal number of pixcel on the LCD screen
Returns
1 on completion
Here is the call graph for this function:

◆ ST7291_init()

int ST7291_init ( void )

Initialization of the LCD ST7291_chip.

Parameters
none
Returns
0 on completion
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ST7291_setScreenColor()

uint8_t ST7291_setScreenColor ( uint16_t screenBasecolor,
uint32_t pixcelNum )

function to fill the screen color

Parameters
screenBasecolor- hex value of the color
pixcelNum- pixel number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ST7291_setScreenWindow()

uint8_t ST7291_setScreenWindow ( uint16_t x1,
uint16_t y1,
uint16_t x2,
uint16_t y2 )

function to setting the window color

Parameters
x1- start x position
y1- start y position
x2- end x position
y2- end y position
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ colours

int32_t colours[6] = { LCD_RED, LCD_GREEN, LCD_AMBER,LCD_BLUE, LCD_WHITE,LCD_BLACK}

◆ errbuf

char errbuf[100] ={0}

◆ lcd_status

int lcd_status = 1