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.
KED/drivers/pf8574/pf8574.h

95 lines
2.5 KiB

/**
**************************************************************************************************
* @file max7219.h
* @author Kerem Yollu & Edwin Koch
* @date 25.08.2022
* @version 1.0
**************************************************************************************************
* @brief
*
* **Detailed Description :**
*
* @todo
**************************************************************************************************
*/
#ifndef _PF8574_H_
#define _PF8574_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "i2c.h"
#include "delay.h"
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80
// flags pour mode d'ecriture
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00
// flags pour ecran on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00
// flags pour display/decalage curseurr
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00
// flags pour function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x1DOTS 0x04
#define LCD_5x8DOTS 0x00
//flags pour le rétroeclairage
#define LCD_BACKLIGHT 0x08
#define LCD_NOBACKLIGHT 0x00
//Pins de gestion de donées.
#define EN 0x04 // Enable bit
#define RW 0x02 // Read/Write bit
#define RS 0x01 // Register select bit
//DIfferents mode enre commande est ecriture
#define CMD_MODE 0x00
#define CHAR_MODE 0x01
//adresse I2C du controlleur pour LCD
#define LCD_ADDRS 0x27
//Nombre max de uint8_t sur une ligne
#define TOTAL_CHAR_CAP 20
uint16_t lcd_init(i2c_t *i2c_dev);
void lcd_write_char(i2c_t *i2c_dev, uint8_t charvalue);
void lcd_display_string(i2c_t *i2c_dev, uint8_t line, uint8_t pos, uint8_t* charvalue, uint8_t lenght);
void lcd_write(i2c_t *i2c_dev, uint8_t cmd, uint8_t mode);
void lcd_write_4bits(i2c_t *i2c_de, uint8_t data);
#ifdef __cplusplus
}
#endif
#endif /* MAIN_H */