1 | void lcd_init()
|
2 | {
|
3 | LCD_SET_PIN_DIRECTIONS(); //set outputs
|
4 | LCD_RESET(); //Apply Reset to the Display Controller
|
5 | //Load settings
|
6 | #if DISPLAY_TYPE == 160
|
7 | LCD_SET_COM_END(103); //set last COM electrode
|
8 | #if ORIENTATION_UPSIDEDOWN == 0
|
9 | LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation
|
10 | #else
|
11 | LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation
|
12 | #endif
|
13 | LCD_SET_START_LINE(0); //set scrolling to 0
|
14 | LCD_SET_PANEL_LOAD(3); //set panel loading to 28-38nF
|
15 | LCD_SET_BIAS_RATIO(3); //set bias ratio
|
16 | LCD_SET_VOLTAGE_BIAS(0x5F); //set Vbias potentiometer for contrast
|
17 | LCD_SET_RAM_ADDR_CTRL(1); //set auto-increment
|
18 | #endif
|
19 | #if DISPLAY_TYPE == 132
|
20 | LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD
|
21 | #if ORIENTATION_UPSIDEDOWN == 0
|
22 | LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation
|
23 | LCD_ORIENTATION_NORMAL();
|
24 | #else
|
25 | LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation
|
26 | LCD_ORIENTATION_UPSIDEDOWN();
|
27 | #endif
|
28 | LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode
|
29 | LCD_SET_MODE_POSITIVE(); //positive display
|
30 | LCD_SET_BIAS_RATIO_1_9(); //bias 1/9
|
31 | LCD_SET_POWER_CONTROL(7); //power control mode: all features on
|
32 | LCD_SET_BIAS_VOLTAGE(3); //set voltage regulator R/R
|
33 | LCD_SET_VOLUME_MODE(0x1F); //volume mode set
|
34 | LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking
|
35 | #endif
|
36 | #if DISPLAY_TYPE == 128
|
37 | LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD
|
38 | #if ORIENTATION_UPSIDEDOWN == 0
|
39 | LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation
|
40 | LCD_ORIENTATION_NORMAL();
|
41 | #else
|
42 | LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation
|
43 | LCD_ORIENTATION_UPSIDEDOWN();
|
44 | #endif
|
45 | LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode
|
46 | LCD_SET_MODE_POSITIVE(); //positive display
|
47 | LCD_SET_BIAS_RATIO_1_7(); //bias 1/7
|
48 | LCD_SET_POWER_CONTROL(7); //power control mode: all features on
|
49 | LCD_SET_BIAS_VOLTAGE(7); //set voltage regulator R/R
|
50 | LCD_SET_VOLUME_MODE(0x06); //volume mode set
|
51 | LCD_SET_INDICATOR_OFF(); //switch indicator off, no blinking
|
52 | #endif
|
53 | #if DISPLAY_TYPE == 102
|
54 | LCD_SET_FIRST_LINE(0); //first bit in RAM is on the first line of the LCD
|
55 | #if ORIENTATION_UPSIDEDOWN == 0
|
56 | LCD_SET_BOTTOM_VIEW(); //6 o'clock mode, normal orientation
|
57 | LCD_ORIENTATION_NORMAL();
|
58 | #else
|
59 | LCD_SET_TOP_VIEW(); //12 o'clock mode, reversed orientation
|
60 | LCD_ORIENTATION_UPSIDEDOWN();
|
61 | #endif
|
62 | LCD_SHOW_ALL_PIXELS_OFF(); //Normal Pixel mode
|
63 | LCD_SET_MODE_POSITIVE(); //positive display
|
64 | LCD_SET_BIAS_RATIO_1_9(); //bias 1/9
|
65 | LCD_SET_POWER_CONTROL(7); //power control mode: all features on
|
66 | LCD_SET_BIAS_VOLTAGE(7); //set voltage regulator R/R
|
67 | LCD_SET_VOLUME_MODE(0x9); //volume mode set
|
68 | LCD_SET_ADV_PROG_CTRL(LCD_TEMPCOMP_HIGH);
|
69 | #endif
|
70 | lcd_clear_area_xy(LCD_RAM_PAGES,LCD_WIDTH,NORMAL,0,0); //clear display content
|
71 |
|
72 | LCD_SWITCH_ON(); //Switch display on
|
73 | return;
|
74 | }
|