#include <stdio.h>
#include <string.h>
#include "gpio.h"
#include "common.h"
#include "i2c.h"
#include "uart.h"
void Check_lcd(void)
{
uint8_t temp=0;
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, 0xf8);
DelayMs(2);
I2C_ReadSingleRegister(HW_I2C0, 0x27, 0x00, &temp) ;
while(temp & 0x80);
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, 0xf8);
}
void Wcom_lcd(uint8_t Lcd_com,uint8_t BuysC)
{
uint8_t temp;
if(BuysC)
Check_lcd();
DelayMs(1);
temp=Lcd_com&0xf0;
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp);
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp|0x0c);
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp|0x08);
temp= Lcd_com<<4;
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp);
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp|0x0c);
I2C_WriteSingleRegister(HW_I2C0, 0x27, 0x00, temp|0x08);
}
|