You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
zavlaha-kzk/src/lcd.h

65 lines
1.4 KiB

#pragma once
// HD44780 LCD display driver - 4-bit mode
//
// LCD pins are configured using a file lcd_config.h, which you
// have to add next to your main.c file.
//
// Content can be something like this:
//
//
#include <stdint.h>
#include <stdbool.h>
/** Initialize the display */
void lcd_init();
/** Send a string to LCD */
void lcd_puts(const char* str_p);
/** Send a string to LCD, N characters long */
void lcd_putsn(const char *str_p, size_t len);
/** Sedn a char to LCD */
void lcd_putc(char c);
/** Show string at X, Y */
#define lcd_puts_xy(x, y, str) do { lcd_xy((x), (y)); lcd_puts((str)); } while(0)
/** Show char at X, Y */
#define lcd_putc_xy(x, y, c) do { lcd_xy((x), (y)); lcd_putc((c)); } while(0)
/** Set cursor position */
void lcd_xy(uint8_t x, uint8_t y);
/** Set LCD cursor. If not enabled, only remember it. */
#define CURSOR_NONE 0b00
#define CURSOR_BAR 0b10
#define CURSOR_BLINK 0b01
#define CURSOR_BOTH 0b11
void lcd_set_cursor(uint8_t type);
/** Display display (preserving cursor) */
void lcd_disable();
/** Enable display (restoring cursor) */
void lcd_enable();
/** Go home */
void lcd_home();
/** Clear the screen */
void lcd_clear();
/**
* Define a glyph - 8 bytes, right 5 bits are used.
* There are total 8 custom glyphs that can be defined.
*/
void lcd_glyph(uint8_t index, const uint8_t* array);
/** Set address in CGRAM */
void lcd_addr_cg(uint8_t acg);
/** Set address in DDRAM */
void lcd_addr(uint8_t add);