#ifndef __HT16C22_H #define __HT16C22_H #include "sys.h" #include #include #include #include "gd32f30x.h" #define LCD_IRQ_READ() gpio_input_bit_get(GPIOD, GPIO_PIN_2) // LCD部分 #define SET_LCD_DATA() gpio_bit_write(GPIOB, GPIO_PIN_4, SET) #define CLR_LCD_DATA() gpio_bit_write(GPIOB, GPIO_PIN_4, RESET) #define SET_LCD_WR() gpio_bit_write(GPIOB, GPIO_PIN_2, SET) #define CLR_LCD_WR() gpio_bit_write(GPIOB, GPIO_PIN_2, RESET) #define SET_LCD_RD() gpio_bit_write(GPIOC, GPIO_PIN_12, SET) #define CLR_LCD_RD() gpio_bit_write(GPIOC, GPIO_PIN_12, RESET) #define SET_LCD_CS() gpio_bit_write(GPIOB, GPIO_PIN_3, SET) #define CLR_LCD_CS() gpio_bit_write(GPIOB, GPIO_PIN_3, RESET) #define SET_LCD_BL_LIGHT() gpio_bit_write(GPIOA, GPIO_PIN_0, SET) #define CLR_LCD_BL_LIGHT() gpio_bit_write(GPIOA, GPIO_PIN_0, RESET) #define Blink 0xC0 //关闭闪烁 extern uint16_t ram1; extern uint16_t ram2; extern uint16_t ram3; extern uint16_t ram4; extern u8 OD_Value,OE_Value,OF_Value,IO_Value,II_Value,IE_Value,IS_Value; //char LCD_Table[] = {0x7B, 0x03, 0x3D, 0x1F, 0x47, 0x5E, 0x7E, 0x13, 0x7F, 0x5F}; #define OD_addr 0x0D #define OE_addr 0x0E #define OF_addr 0x0F #define IO_addr 0x10 #define II_addr 0x11 #define IE_addr 0x12 #define IS_addr 0x13 //湿度RH%图标 #define RH_ON ht16c22_display(3,3,ram3|=0x0008); #define RH_OFF ht16c22_display(3,3,ram3&=~0x0008); //VCC图标 //#define VOC_ON ht16c22_display(OE_addr,OE_Value|=0X01); //#define VOC_OFF ht16c22_display(OE_addr,OE_Value&=0XFE); //新风模式图标 #define ZY_ON ht16c22_display(0,4,ram4|=0x0001); #define ZY_OFF ht16c22_display(0,4,ram4&=~0x0001); //空调模式图标 #define ZE_ON ht16c22_display(5,4,ram4|=0x0020); #define ZE_OFF ht16c22_display(5,4,ram4&=~0x0020); //PM2.5图标 //#define PM_ON ht16c22_display(IS_addr,IS_Value|=0X01); //#define PM_OFF ht16c22_display(IS_addr,IS_Value&=0XFE); //一根竖杠图标 打开广播模式图标 //#define YS_ON ht16c22_display(IS_addr,IS_Value|=0X04); //#define YS_OFF ht16c22_display(IS_addr,IS_Value&=0XFB); //两根竖杠图标 //#define ES_ON ht16c22_display(IS_addr,IS_Value|=0X02); //#define ES_OFF ht16c22_display(IS_addr,IS_Value&=0XFD); //三根竖杠图标 //#define SS_ON ht16c22_display(IS_addr,IS_Value|=0X08); //#define SS_OFF ht16c22_display(IS_addr,IS_Value&=0XF7); //风速高 #define HW_ON ht16c22_display(4,2,ram2|=0x0010); #define HW_OFF ht16c22_display(4,2,ram2&=~0x0010); //风速中 #define MW_ON ht16c22_display(4,1,ram1|=0x0010); #define MW_OFF ht16c22_display(4,1,ram1&=~0x0010); //风速低 #define LW_ON ht16c22_display(3,1,ram1|=0x0008); #define LW_OFF ht16c22_display(3,1,ram1&=~0x0008); //自动标志 #define AUTO_ON ht16c22_display(3,4,ram4|=0x0008); #define AUTO_OFF ht16c22_display(3,4,ram4&=~0x0008); //风扇标志 #define FS_ON ht16c22_display(5,1,ram1|=0x0020); #define FS_OFF ht16c22_display(5,1,ram1&=~0x0020); //制冷标志 #define ZL_ON ht16c22_display(1,1,ram1|=0x0002); #define ZL_OFF ht16c22_display(1,1,ram1&=~0x0002); //制热标志 #define ZR_ON ht16c22_display(2,1,ram1|=0x0004); #define ZR_OFF ht16c22_display(2,1,ram1&=~0x0004); //除湿标志 #define CS_ON ht16c22_display(10,1,ram1|=0x0400); #define CS_OFF ht16c22_display(10,1,ram1&=~0x0400); //地暖模式图标 #define ZS_ON ht16c22_display(1,4,ram4|=0x0002); #define ZS_OFF ht16c22_display(1,4,ram4&=~0x0002); //中间2点图标 //#define MH_ON ht16c22_display(IO_addr,IO_Value|=0X08); //#define MH_OFF ht16c22_display(IO_addr,IO_Value&=0XF7); //小数点 #define DH_ON ht16c22_display(7,1,ram1|=0x0080); #define DH_OFF ht16c22_display(7,1,ram1&=~0x0080); //度标志 #define DU_ON ht16c22_display(5,3,ram3|=0x0020); #define DU_OFF ht16c22_display(5,3,ram3&=~0x0020); void Delay_SS(); void Delay_Ms(); //开机动画 void Animation(void); //显示温度界面 摄氏度 void Display_temp(int16_t temp,uint8_t type); //温度显示 //显示温度界面 华氏度 //void Display_H_temp(int16_t temp); //湿度 //void Dis_hum(u8 hum); //void Display_Multidigit(u16 num); //显示多位数,不能超过四位 void ht16c22_clear(void); void ht16c22_init(void); void ht16c22_display(uint8_t add,uint8_t ram_num,uint16_t ram_temp); //显示字母 void Dis_letter(u8 wei, u8 num); //显示数字 void Display_num(u8 wei, u8 num); #endif