forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-05-24 1360095f8d64cf607d333d2fc7fd1dcd81d1bd7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * File      : lcd_cfg_api.c
 * This file is part of Sizhu Ultrasonic Gas-Meter
 * COPYRIGHT (C) 2022,Sizhu Ultrasonic Gas-Meter Development Team
 *
 * Brief     : Header file of lcd_io_api.
 * http://www.ideacreated.com/
 *
 * Change Logs:
 * Date           Author            Notes
 * 2022-08-22     Sizhu_J1anG       the first version
 * 2022-08-30     Sizhu_Ye          targeted modification
 */
 
#ifndef _LCD_IO_API_H_
#define _LCD_IO_API_H_
 
#include "define_all.h" 
#include "lcd_segmentcode.h"
 
 
#define    SEGNUM        48
 
#define    LCD_ADDR_WRITE        0x7C    //¼ûÎĵµ20/35
#define    LCD_ADDR_READ         0x7D
 
#define    LCD_REG_DATA_ADDR        0x80   //ÏÔʾÊý¾ÝÊäÈëÊä³öµÄÃüÁî
 
#define    LCD_DRIVE_MODE_COMMAND_ADDR 0x82 //22/35 Çý¶¯Ä£Ê½ÃüÁî 0x82  
 
#define    LCD_SYSTEM_MODE_COMMAND_ADDR 0x84
 
#define LCD_PWR_GPIO_PORT                            GPIOD
#define LCD_PWR_PIN                                        GPIO_Pin_7
 
#define LCD_BACKLIGHT_PWR_GPIO_PORT        GPIOD
#define LCD_BACKLIGHT_PWR_PIN                    GPIO_Pin_8
 
//ÏÔʾÆÁµçÔ´
#define LCD_PWR_ON            GPIO_SetBits(LCD_PWR_GPIO_PORT,LCD_PWR_PIN)
#define LCD_PWR_OFF            GPIO_ResetBits(LCD_PWR_GPIO_PORT,LCD_PWR_PIN)    
 
#define LCD_PWR_IO_READ            GPIO_ReadInputDataBit(LCD_PWR_GPIO_PORT,LCD_PWR_PIN)
 
//±³¹â¿ª¹Ø
#define LCD_BACKLIGHT_ON         GPIO_SetBits(LCD_BACKLIGHT_PWR_GPIO_PORT,LCD_BACKLIGHT_PWR_PIN)
#define LCD_BACKLIGHT_OFF     GPIO_ResetBits(LCD_BACKLIGHT_PWR_GPIO_PORT,LCD_BACKLIGHT_PWR_PIN)
 
/***********************************************************************
 * Ãû³Æ£ºLcd_DisplaySeg()
 * ¹¦ÄÜ£ºÏÔʾһ¶Î¶ÎÂë
 * ´«Èë²ÎÊý£ºSegNum:0~127¶ÎºÅÂë
 * ¾ÙÀý£ºLcd_DisplaySeg(_LCD_TI_logo)£¬ÏÔʾTI logo
  ********************************************************************** */
//Ìí¼ÓÖ¸¶¨Êý¾Ýµ½Êý×é
#define LCD_DISPLAY_SEG(__SEG_NUM__) LCD_Buffer[__SEG_NUM__ >> 3]  |= 1 << (__SEG_NUM__ % 8)
 
/***********************************************************************
 * Ãû³Æ£ºLcd_ClearSeg()
 * ¹¦ÄÜ£ºÇå³ýÒ»¶Î¶ÎÂë
 * ´«Èë²ÎÊý£ºSegNum:0~127¶ÎºÅÂë
 * ¾ÙÀý£ºLcd_ClearSeg(_LCD_TI_logo)£¬ÏÔʾTI logo  ÕâÀïµÄÔ­Àí¾ÍÊÇ»º´æµÄ°ËλÊýÅųɶþ½øÖÆ£¬½«¶ÔӦλÖÃÒ»
  ********************************************************************** */
//Çå³ýÖ¸¶¨Êý¾Ýµ½Êý×é
#define LCD_CLEAR_SEG(__SEG_NUM__) LCD_Buffer[__SEG_NUM__ >> 3]  &= ~(1 << (uint8_t)(__SEG_NUM__ % 8))
 
 
typedef enum{
    LCD_A = 0U,
    LCD_B,
    LCD_C,
    LCD_D,
    LCD_E,
    LCD_F,
    LCD_G,
    LCD_H,
    LCD_I,
    LCD_J,
    LCD_K,
    LCD_L,
    LCD_M,
    LCD_N,
    LCD_O,
    LCD_P,
    LCD_Q,
    LCD_R,
    LCD_S,
    LCD_T,
    LCD_U,
    LCD_V,
    LCD_W,
    LCD_X,
    LCD_Y,
    LCD_Z
}LCD_LETTERS_T;
 
extern uint8_t    LCD_Buffer[SEGNUM];
 
 
void Lcd_Write_Reg(uint8_t sadd,uint8_t * pBuffer,uint8_t len);
void Lcd_Write(uint8_t cmd_add,uint8_t * pBuffer,uint8_t len);
 
void Lcd_DisplayFirstLine_23A(u8 show_type,double number);
void Lcd_DisplaySecondLine_23A(u8 show_type,double number);
 
void Lcd_DisplayDigit_23A(unsigned char Position ,u8 Digit);
void Lcd_ClearDigit_23A(unsigned char Position);
 
void Lcd_DisplayLetter(uint8_t position,LCD_LETTERS_T letter);
void Lcd_GPIO_Init(void);
 
 
#endif