#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <hd44780.h>
static const uint8_t char_data[] = {
0x04, 0x0e, 0x0e, 0x0e, 0x1f, 0x00, 0x04, 0x00,
0x1f, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x1f, 0x00
};
void lcd_task(void *);
void app_main()
{
xTaskCreate(lcd_task, "lcd_task", configMINIMAL_STACK_SIZE * 3, NULL, 5, NULL);
}
void lcd_task(void *pvParameters)
{
hd44780_t lcd = {
.write_cb = NULL,
.font = HD44780_FONT_5X8,
.lines = 2,
.pins = {
.rs = GPIO_NUM_12,
.e = GPIO_NUM_14,
.d4 = GPIO_NUM_27,
.d5 = GPIO_NUM_26,
.d6 = GPIO_NUM_32,
.d7 = GPIO_NUM_33,
.bl = HD44780_NOT_USED
}
};
ESP_ERROR_CHECK(hd44780_init(&lcd));
hd44780_upload_character(&lcd, 0, char_data);
hd44780_upload_character(&lcd, 1, char_data + 8);
hd44780_gotoxy(&lcd, 0, 0);
hd44780_puts(&lcd, " Hello world!");
hd44780_gotoxy(&lcd, 0, 1);
hd44780_puts(&lcd, "Micro");
while (1)
{
vTaskDelay(pdMS_TO_TICKS(1000));
}
}