44 lines
818 B
C
44 lines
818 B
C
|
#ifndef __LCD_H__
|
||
|
#define __LCD_H__
|
||
|
|
||
|
#include <stm32f0xx.h>
|
||
|
|
||
|
#define LCD_DPORT (GPIOA)
|
||
|
#define LCD_DATA_BIT_OFFSET (0)
|
||
|
#define LCD_RS (9)
|
||
|
#define LCD_E (10)
|
||
|
|
||
|
#define LCD_DATA_MASK (0xFU << LCD_DATA_BIT_OFFSET)
|
||
|
#define LCD_RS_MASK (1U << LCD_RS)
|
||
|
#define LCD_E_MASK (1U << LCD_E)
|
||
|
|
||
|
/**
|
||
|
* @brief Initialize 4 bit LCD mode. GPIOs have to be set up prior to any call of this function
|
||
|
*/
|
||
|
void lcd_init(void);
|
||
|
|
||
|
/**
|
||
|
* @brief Clear display
|
||
|
*/
|
||
|
void lcd_clear(void);
|
||
|
|
||
|
/**
|
||
|
* @brief Set cursor position to 0/0
|
||
|
*/
|
||
|
void lcd_home(void);
|
||
|
|
||
|
/**
|
||
|
* @brief Set cursor to position \p x \p y
|
||
|
* @param x Position in line
|
||
|
* @param y Line
|
||
|
*/
|
||
|
void lcd_setcursor(uint8_t x, uint8_t y);
|
||
|
|
||
|
/**
|
||
|
* @brief Write string to current cursor position
|
||
|
* @param String to write
|
||
|
*/
|
||
|
void lcd_string(const char *data);
|
||
|
|
||
|
#endif /* __LCD_H__ */
|