A31R71x F/W Packages  1.5.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31R71x_hal_lcd.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _LCD_H_
36 #define _LCD_H_
37 
38 #include "A31R71x.h"
39 #include "A31R71x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 // LCD Bias Type Selection Control
50 #define BTYPE_IntRBias (LCD_CR_BTYPE_IntRBias << LCD_CR_BTYPE_Pos) // IntRBias : Internal Resistor Bias
51 #define BTYPE_ExtRBias (LCD_CR_BTYPE_ExtRBias << LCD_CR_BTYPE_Pos) // ExtRBias : External Resistor Bias
52 #define BTYPE_CapBias (LCD_CR_BTYPE_CapBias << LCD_CR_BTYPE_Pos) // CapBias : Capacitor Bias (Voltage Booster)
53 
54 // Internal LCD Bias Dividing Resistor Selection Control
55 /*
56 #define LCD_RLCD3 (0x0uL << 6)
57 #define LCD_RLCD1 (0x1uL << 6)
58 #define LCD_RLCD2 (0x2uL << 6)
59 #define LCD_RLCD4 (0x3uL << 6)
60 */
61 #define IRSEL_RLCD2 (LCD_CR_IRSEL_RLCD2 << LCD_CR_IRSEL_Pos) // RLCD2 : 60[kohm]
62 #define IRSEL_RLCD1 (LCD_CR_IRSEL_RLCD1 << LCD_CR_IRSEL_Pos) // RLCD1 : 30[kohm]
63 #define IRSEL_RLCD3 (LCD_CR_IRSEL_RLCD3 << LCD_CR_IRSEL_Pos) // RLCD3 : 120[kohm]
64 
65 // LCD Duty and Bias Selection Control
66 /*
67 #define LCD_8D4B (0x0uL << 3)
68 #define LCD_6D4B (0x1uL << 3)
69 #define LCD_5D3B (0x2uL << 3)
70 #define LCD_4D3B (0x3uL << 3)
71 #define LCD_3D3B (0x4uL << 3)
72 #define LCD_3D2B (0x5uL << 3)
73 */
74 #define DBS_4D3B (LCD_CR_DBS_4D3B << LCD_CR_DBS_Pos) // 4D3B : 1/4 duty, 1/3 bias
75 #define DBS_3D3B (LCD_CR_DBS_3D3B << LCD_CR_DBS_Pos) // 3D3B : 1/3 duty, 1/3 bias
76 #define DBS_3D2B (LCD_CR_DBS_3D2B << LCD_CR_DBS_Pos) // 3D2B : 1/3 duty, 1/2 bias
77 #define DBS_2D2B (LCD_CR_DBS_2D2B << LCD_CR_DBS_Pos) // 2D2B : 1/2 duty, 1/2 bias
78 
79 // LCD Clock Selection Control
80 /*
81 #define LCD_CLK128 (0x0uL << 1)
82 #define LCD_CLK256 (0x1uL << 1)
83 #define LCD_CLK512 (0x2uL << 1)
84 #define LCD_CLK1024 (0x3uL << 1)
85 */
86 #define LCLK_128Hz (LCD_CR_LCLK_128Hz << LCD_CR_LCLK_Pos) // 128Hz : 128Hz = 32.768kHz(fLCD) / 256
87 #define LCLK_256Hz (LCD_CR_LCLK_256Hz << LCD_CR_LCLK_Pos) // 256Hz : 256Hz = 32.768kHz(fLCD) / 128
88 #define LCLK_512Hz (LCD_CR_LCLK_512Hz << LCD_CR_LCLK_Pos) // 512Hz : 512Hz = 32.768kHz(fLCD) / 64
89 #define LCLK_1024Hz (LCD_CR_LCLK_1024Hz << LCD_CR_LCLK_Pos) // 1024Hz : 1024Hz = 32.768kHz(fLCD) / 32
90 
91 // VLC2 Voltage Control
92 /*
93 #define LCD_VLC31 (0x0uL << 0)
94 #define LCD_VLC30 (0x1uL << 0)
95 #define LCD_VLC29 (0x2uL << 0)
96 #define LCD_VLC28 (0x3uL << 0)
97 #define LCD_VLC27 (0x4uL << 0)
98 #define LCD_VLC26 (0x5uL << 0)
99 #define LCD_VLC25 (0x6uL << 0)
100 #define LCD_VLC24 (0x7uL << 0)
101 #define LCD_VLC23 (0x8uL << 0)
102 #define LCD_VLC22 (0x9uL << 0)
103 #define LCD_VLC21 (0xAuL << 0)
104 #define LCD_VLC20 (0xBuL << 0)
105 #define LCD_VLC19 (0xCuL << 0)
106 #define LCD_VLC18 (0xDuL << 0)
107 #define LCD_VLC17 (0xEuL << 0)
108 #define LCD_VLC16 (0xFuL << 0)
109 */
110 #define VLCD_Step0 (LCD_CCR_VLCD_Step0 << LCD_CCR_VLCD_Pos) // Step0 : VLC2=1.00V when 1/2 Bias, VLC2=0.75V when 1/3 Bias
111 #define VLCD_Step1 (LCD_CCR_VLCD_Step1 << LCD_CCR_VLCD_Pos) // Step1 : VLC2=1.05V when 1/2 Bias, VLC2=0.79V when 1/3 Bias
112 #define VLCD_Step2 (LCD_CCR_VLCD_Step2 << LCD_CCR_VLCD_Pos) // Step2 : VLC2=1.10V when 1/2 Bias, VLC2=0.83V when 1/3 Bias
113 #define VLCD_Step3 (LCD_CCR_VLCD_Step3 << LCD_CCR_VLCD_Pos) // Step3 : VLC2=1.15V when 1/2 Bias, VLC2=0.86V when 1/3 Bias
114 #define VLCD_Step4 (LCD_CCR_VLCD_Step4 << LCD_CCR_VLCD_Pos) // Step4 : VLC2=1.20V when 1/2 Bias, VLC2=0.90V when 1/3 Bias
115 #define VLCD_Step5 (LCD_CCR_VLCD_Step5 << LCD_CCR_VLCD_Pos) // Step5 : VLC2=1.25V when 1/2 Bias, VLC2=0.94V when 1/3 Bias
116 #define VLCD_Step6 (LCD_CCR_VLCD_Step6 << LCD_CCR_VLCD_Pos) // Step6 : VLC2=1.30V when 1/2 Bias, VLC2=0.98V when 1/3 Bias
117 #define VLCD_Step7 (LCD_CCR_VLCD_Step7 << LCD_CCR_VLCD_Pos) // Step7 : VLC2=1.35V when 1/2 Bias, VLC2=1.01V when 1/3 Bias
118 #define VLCD_Step8 (LCD_CCR_VLCD_Step8 << LCD_CCR_VLCD_Pos) // Step8 : VLC2=1.40V when 1/2 Bias, VLC2=1.05V when 1/3 Bias
119 #define VLCD_Step9 (LCD_CCR_VLCD_Step9 << LCD_CCR_VLCD_Pos) // Step9 : VLC2=1.45V when 1/2 Bias, VLC2=1.09V when 1/3 Bias
120 #define VLCD_Step10 (LCD_CCR_VLCD_Step10 << LCD_CCR_VLCD_Pos) // Step10 : VLC2=1.50V when 1/2 Bias, VLC2=1.13V when 1/3 Bias
121 
122 
123 // Display Data RAM Size
124 #define LCDBufSize 40
125 
126 //******************************************************************************
127 // Type
128 //******************************************************************************
129 
130 //==============================================================================
131 // Structure
132 //==============================================================================
133 
134 typedef struct
135 {
136  // LCD_CR
137  uint32_t BiasType; // BTYPE
138  uint32_t Bias; // IRSEL
139  uint32_t Duty; // DBS
140  uint32_t Clk; // LCLK
141 
142  // LCD_CCR
143  uint32_t ContrastStep; // VLCD
144 } LCD_CFG_Type;
145 
146 //******************************************************************************
147 // Macro
148 //******************************************************************************
149 
150 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
154 #define LCDON() (LCD->CR_b.DISP = 1)
155 
156 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
160 #define LCDOFF() (LCD->CR_b.DISP = 0)
161 
162 //******************************************************************************
163 // Function
164 //******************************************************************************
165 
167 
168 HAL_Status_Type HAL_LCD_SetRegister( uint32_t LCD_CR, uint32_t LCD_CCR );
170 HAL_Status_Type HAL_LCD_WriteDspRam( uint8_t* write_buf, uint32_t u32Index, uint32_t size );
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* _LCD_H_ */
177 
HAL_Status_Type
uint32_t ContrastStep
HAL_Status_Type HAL_LCD_WriteDspRam(uint8_t *write_buf, uint32_t u32Index, uint32_t size)
Write LCD Buffer.
HAL_Status_Type HAL_LCD_ClearDspRam(void)
Clear LCD Buffer.
uint32_t BiasType
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
HAL_Status_Type HAL_LCD_Init(LCD_CFG_Type *LCD_Config)
Initialize the LCD peripheral with the specified parameters.
HAL_Status_Type HAL_LCD_SetRegister(uint32_t LCD_CR, uint32_t LCD_CCR)
Set LCD LCD_CR/LCD_CCR Registers.