Microprocessor 2 Labs v2.0
Microprocessor 2 Lab Documenation
Loading...
Searching...
No Matches
esp_lcd.c File Reference

Liquid Crystal Display source file. More...

#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_idf_version.h"
#include "esp_lcd.h"
#include "esp_log.h"
Include dependency graph for esp_lcd.c:

Macros

#define LCD_DATA   0
 
#define LCD_CMD   1
 
#define GPIO_STATE_LOW   0
 
#define GPIO_STATE_HIGH   1
 
#define DATA_0_PIN   19
 
#define DATA_1_PIN   18
 
#define DATA_2_PIN   17
 
#define DATA_3_PIN   16
 
#define ENABLE_PIN   22
 
#define REGISTER_SELECT_PIN   23
 

Functions

void lcdInit (lcd_t *const lcd)
 Initialize LCD object.
 
void lcdDefault (lcd_t *const lcd)
 LCD default constructor.
 
void lcdCtor (lcd_t *lcd, gpio_num_t data[LCD_DATA_LINE], gpio_num_t en, gpio_num_t regSel)
 LCD constructor.
 
lcd_err_t lcdSetText (lcd_t *const lcd, char *text, int x, int y)
 Set text.
 
lcd_err_t lcdSetInt (lcd_t *const lcd, int val, int x, int y)
 Set integer.
 
lcd_err_t lcdClear (lcd_t *const lcd)
 Clear LCD screen Detailed description starts here.
 
void lcdFree (lcd_t *const lcd)
 Reset pins to default configuration.
 
void assert_lcd (lcd_err_t lcd_error)
 

Detailed Description

Liquid Crystal Display source file.

Author
Jesus Minjares (https://github.com/jminjares4)
Version
0.1
Date
2022-08-15

Macro Definition Documentation

◆ DATA_0_PIN

#define DATA_0_PIN   19

DATA 0

◆ DATA_1_PIN

#define DATA_1_PIN   18

DATA 0

◆ DATA_2_PIN

#define DATA_2_PIN   17

DATA 0

◆ DATA_3_PIN

#define DATA_3_PIN   16

DATA 0

◆ ENABLE_PIN

#define ENABLE_PIN   22

Enable

◆ GPIO_STATE_HIGH

#define GPIO_STATE_HIGH   1

Logic high

◆ GPIO_STATE_LOW

#define GPIO_STATE_LOW   0

Logic low

◆ LCD_CMD

#define LCD_CMD   1

LCD command

◆ LCD_DATA

#define LCD_DATA   0

< LCD tag LCD data

◆ REGISTER_SELECT_PIN

#define REGISTER_SELECT_PIN   23

Register Select

Function Documentation

◆ assert_lcd()

void assert_lcd ( lcd_err_t lcd_error)

◆ lcdClear()

lcd_err_t lcdClear ( lcd_t *const lcd)

Clear LCD screen Detailed description starts here.

Parameters
lcdpointer to LCD object
Returns
lcd error status
See also
lcd_err_t

◆ lcdCtor()

void lcdCtor ( lcd_t * lcd,
gpio_num_t data[LCD_DATA_LINE],
gpio_num_t en,
gpio_num_t regSel )

LCD constructor.

Detailed description starts here

Parameters
lcdpointer to LCD object
datalcd data array
enlcd en
regSelregister select
Returns
None

◆ lcdDefault()

void lcdDefault ( lcd_t *const lcd)

LCD default constructor.

Parameters
lcdpointer to LCD object
Note
This function call will use hardcode pins. If you want to use custom pins
See also
lcd_ctor
Returns
None

◆ lcdFree()

void lcdFree ( lcd_t *const lcd)

Reset pins to default configuration.

Freeing GPIO pins.

Parameters
lcdpointer to LCD object
Note
This function will set GPIO pins to reset configuration, disabling the LCD.
See also
gpio_reset_pin()

◆ lcdInit()

void lcdInit ( lcd_t *const lcd)

Initialize LCD object.

Parameters
lcdpointer to LCD object
Note
Must constructor LCD object.
See also
lcd_ctor() and
lcd_default()
Returns
None

◆ lcdSetInt()

lcd_err_t lcdSetInt ( lcd_t *const lcd,
int val,
int x,
int y )

Set integer.

Detailed description starts here

Parameters
lcdpointer to LCD object
valinteger value to be displayed
xlocation at x-axis
ylocation at y-axis
Returns
lcd error status
See also
lcd_err_t

◆ lcdSetText()

lcd_err_t lcdSetText ( lcd_t *const lcd,
char * text,
int x,
int y )

Set text.

Detailed description starts here

Parameters
lcdpointer to LCD object
textstring text
xlocation at x-axis
ylocation at y-axis
Returns
lcd error status
See also
lcd_err_t