Homework 1.1 turn off decimal on display

Fork of SLCD by Erik -

Committer:
Tomo2k
Date:
Sun Mar 23 19:55:14 2014 +0000
Revision:
10:ef2b3b7f1b01
Parent:
7:0e084b33d730
Child:
11:4afb2276def1
Documentation updated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 0:d04758e76d5b 1 #include "SLCD.h"
star297 1:1579bcd31410 2 #include "LCDconfig.h"
Sissors 0:d04758e76d5b 3
Sissors 0:d04758e76d5b 4
Tomo2k 6:f4773221794b 5 const uint8_t WF_ORDERING_TABLE[ ] = {
Tomo2k 6:f4773221794b 6 CHAR1a, // LCD81 --- Pin:5 LCDnAddress=51
Tomo2k 6:f4773221794b 7 CHAR1b, // LCD82 --- Pin:6 LCDnAddress=52
Tomo2k 6:f4773221794b 8 CHAR2a, // LCD83 --- Pin:7 LCDnAddress=53
Tomo2k 6:f4773221794b 9 CHAR2b, // LCD84 --- Pin:8 LCDnAddress=54
Tomo2k 6:f4773221794b 10 CHAR3a, // LCD85 --- Pin:9 LCDnAddress=55
Tomo2k 6:f4773221794b 11 CHAR3b, // LCD86 --- Pin:10 LCDnAddress=56
Tomo2k 6:f4773221794b 12 CHAR4a, // LCD87 --- Pin:11 LCDnAddress=57
Tomo2k 6:f4773221794b 13 CHAR4b, // LCD88 --- Pin:12 LCDnAddress=58
Tomo2k 6:f4773221794b 14 CHARCOM0, // LCD77 --- Pin:1 LCDnAddress=4D
Tomo2k 6:f4773221794b 15 CHARCOM1, // LCD78 --- Pin:2 LCDnAddress=4E
Tomo2k 6:f4773221794b 16 CHARCOM2, // LCD79 --- Pin:3 LCDnAddress=4F
Tomo2k 6:f4773221794b 17 CHARCOM3, // LCD80 --- Pin:4 LCDnAddress=50
Sissors 0:d04758e76d5b 18 };
Sissors 0:d04758e76d5b 19
Tomo2k 6:f4773221794b 20 const char ASCII_TO_WF_CODIFICATION_TABLE [ ] = {
Tomo2k 6:f4773221794b 21
Tomo2k 6:f4773221794b 22 /*
Tomo2k 6:f4773221794b 23 segA
Tomo2k 6:f4773221794b 24 ________
Tomo2k 6:f4773221794b 25 | |
Tomo2k 6:f4773221794b 26 segF | | segB
Tomo2k 6:f4773221794b 27 | |
Tomo2k 6:f4773221794b 28 -segG--
Tomo2k 6:f4773221794b 29 | |
Tomo2k 6:f4773221794b 30 segE | | segC
Tomo2k 6:f4773221794b 31 |________|
Tomo2k 6:f4773221794b 32 segD
Tomo2k 6:f4773221794b 33 */
Tomo2k 6:f4773221794b 34
Tomo2k 6:f4773221794b 35 ( SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 0, offset=0
Tomo2k 6:f4773221794b 36 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = 1, offset=4
Tomo2k 6:f4773221794b 37 ( SEGD+ SEGE+!SEGF+ SEGG) , (!SEGC+ SEGB+ SEGA) ,//Char = 2, offset=8
Tomo2k 6:f4773221794b 38 ( SEGD+!SEGE+!SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 3, offset=12
Tomo2k 6:f4773221794b 39 (!SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = 4, offset=16
Tomo2k 6:f4773221794b 40 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = 5, offset=20
Tomo2k 6:f4773221794b 41 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = 6, offset=24
Tomo2k 6:f4773221794b 42 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 7, offset=28
Tomo2k 6:f4773221794b 43 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 8, offset=32
Tomo2k 6:f4773221794b 44 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 9, offset=36
Tomo2k 6:f4773221794b 45 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = :, offset=40
Tomo2k 6:f4773221794b 46 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = ;, offset=44
Tomo2k 6:f4773221794b 47 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = <, offset=48
Tomo2k 6:f4773221794b 48 ( SEGD+!SEGE+!SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = =, offset=52
Tomo2k 6:f4773221794b 49 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = >, offset=56
Tomo2k 6:f4773221794b 50 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ?, offset=60
Tomo2k 6:f4773221794b 51 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = @, offset=64
Tomo2k 6:f4773221794b 52 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = A, offset=68
Tomo2k 6:f4773221794b 53 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = B, offset=72
Tomo2k 6:f4773221794b 54 ( SEGD+ SEGE+ SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = C, offset=76
Tomo2k 6:f4773221794b 55 ( SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = D, offset=80
Tomo2k 6:f4773221794b 56 ( SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = E, offset=84
Tomo2k 6:f4773221794b 57 (!SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = F, offset=88
Tomo2k 6:f4773221794b 58 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = G, offset=92
Tomo2k 6:f4773221794b 59 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = H, offset=96
Tomo2k 6:f4773221794b 60 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = I, offset=100
Tomo2k 6:f4773221794b 61 ( SEGD+ SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = J, offset=104
Tomo2k 6:f4773221794b 62 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = K, offset=108
Tomo2k 6:f4773221794b 63 ( SEGD+ SEGE+ SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = L, offset=112
Tomo2k 6:f4773221794b 64 (!SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = M, offset=116
Tomo2k 6:f4773221794b 65 (!SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = N, offset=120
Tomo2k 6:f4773221794b 66 ( SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = O, offset=124
Tomo2k 6:f4773221794b 67 (!SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+ SEGB+ SEGA) ,//Char = P, offset=128
Tomo2k 6:f4773221794b 68 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = Q, offset=132
Tomo2k 6:f4773221794b 69 (!SEGD+ SEGE+!SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = R, offset=136
Tomo2k 6:f4773221794b 70 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = S, offset=140
Tomo2k 6:f4773221794b 71 ( SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = T, offset=144
Tomo2k 6:f4773221794b 72 ( SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = U, offset=148
Tomo2k 6:f4773221794b 73 ( SEGD+ SEGE+!SEGF+!SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = V, offset=152
Tomo2k 6:f4773221794b 74 ( SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = W, offset=156
Tomo2k 6:f4773221794b 75 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = X, offset=160
Tomo2k 6:f4773221794b 76 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = Y, offset=164
Tomo2k 6:f4773221794b 77 ( SEGD+!SEGE+!SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = Z, offset=168
Tomo2k 6:f4773221794b 78 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = [, offset=172
Tomo2k 6:f4773221794b 79 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = \, offset=176
Tomo2k 6:f4773221794b 80 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ], offset=180
Tomo2k 6:f4773221794b 81 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ^, offset=184
Tomo2k 6:f4773221794b 82 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = _, offset=188
Tomo2k 6:f4773221794b 83 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = `, offset=192
Sissors 0:d04758e76d5b 84 };
Sissors 0:d04758e76d5b 85
Tomo2k 6:f4773221794b 86 SLCD::SLCD()
Tomo2k 6:f4773221794b 87 {
Sissors 0:d04758e76d5b 88 init();
Tomo2k 6:f4773221794b 89 CharPosition = 0;
star297 1:1579bcd31410 90 }
Sissors 0:d04758e76d5b 91
Tomo2k 6:f4773221794b 92 void SLCD::init()
Tomo2k 6:f4773221794b 93 {
Sissors 0:d04758e76d5b 94 SIM->SCGC5 |= SIM_SCGC5_SLCD_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;
Tomo2k 6:f4773221794b 95
Tomo2k 6:f4773221794b 96 // configure pins for LCD operation
Tomo2k 6:f4773221794b 97 PORTC->PCR[20] = 0x00000000; //VLL2
Tomo2k 6:f4773221794b 98 PORTC->PCR[21] = 0x00000000; //VLL1
Tomo2k 6:f4773221794b 99 PORTC->PCR[22] = 0x00000000; //VCAP2
Tomo2k 6:f4773221794b 100 PORTC->PCR[23] = 0x00000000; //VCAP1
Tomo2k 6:f4773221794b 101 // Enable IRCLK
Tomo2k 6:f4773221794b 102 MCG->C1 |= MCG_C1_IRCLKEN_MASK | MCG_C1_IREFSTEN_MASK;
Tomo2k 6:f4773221794b 103 MCG->C2 |= MCG_C2_IRCS_MASK ; //0 32KHZ internal reference clock; 1= 4MHz irc
Sissors 4:ec7b3c9b2aeb 104
Tomo2k 6:f4773221794b 105 //Check if the Fast reference has its divide by 2 enabled (default):
Tomo2k 6:f4773221794b 106 if ((MCG->SC & MCG_SC_FCRDIV_MASK) != 1<<1)
Tomo2k 6:f4773221794b 107 error("Invalid clock configuration for SLCD\n");
Tomo2k 6:f4773221794b 108 LCD->GCR = 0x0;
Tomo2k 6:f4773221794b 109 LCD->AR = 0x0;
Tomo2k 6:f4773221794b 110
Tomo2k 6:f4773221794b 111 // LCD configurartion
Tomo2k 6:f4773221794b 112 LCD->GCR = ( LCD_GCR_RVEN_MASK*_LCDRVEN
star297 1:1579bcd31410 113 | LCD_GCR_RVTRIM(_LCDRVTRIM) //0-15
Tomo2k 6:f4773221794b 114 | LCD_GCR_CPSEL_MASK*_LCDCPSEL
star297 1:1579bcd31410 115 | LCD_GCR_LADJ(_LCDLOADADJUST) //0-3
star297 1:1579bcd31410 116 | LCD_GCR_VSUPPLY_MASK*_LCDSUPPLY //0-1
Sissors 0:d04758e76d5b 117 |!LCD_GCR_FDCIEN_MASK
Sissors 4:ec7b3c9b2aeb 118 | LCD_GCR_ALTDIV(1) //divide by something
Tomo2k 6:f4773221794b 119 |!LCD_GCR_LCDDOZE_MASK
Sissors 0:d04758e76d5b 120 |!LCD_GCR_LCDSTP_MASK
star297 1:1579bcd31410 121 |!LCD_GCR_LCDEN_MASK //WILL BE ENABLE ON SUBSEQUENT STEP
Sissors 4:ec7b3c9b2aeb 122 | LCD_GCR_SOURCE_MASK*1
Tomo2k 6:f4773221794b 123 | LCD_GCR_ALTSOURCE_MASK*0
Sissors 4:ec7b3c9b2aeb 124 | LCD_GCR_LCLK(0) //0-7
Sissors 0:d04758e76d5b 125 | LCD_GCR_DUTY(_LCDDUTY) //0-7
Tomo2k 6:f4773221794b 126 );
Tomo2k 6:f4773221794b 127 uint8_t i;
Tomo2k 6:f4773221794b 128 uint32_t *p_pen;
Tomo2k 6:f4773221794b 129 uint8_t pen_offset; // 0 or 1
Tomo2k 6:f4773221794b 130 uint8_t pen_bit; // 0 to 31
Tomo2k 6:f4773221794b 131 LCD->PEN[0] = 0x0;
Tomo2k 6:f4773221794b 132 LCD->PEN[1] = 0x0;
Tomo2k 6:f4773221794b 133 LCD->BPEN[0] = 0x0;
Tomo2k 6:f4773221794b 134 LCD->BPEN[1] = 0x0;
Tomo2k 6:f4773221794b 135 p_pen = (uint32_t *)&LCD->PEN[0];
Tomo2k 6:f4773221794b 136 for (i=0; i<_LCDUSEDPINS; i++) {
Tomo2k 6:f4773221794b 137 pen_offset = WF_ORDERING_TABLE[i]/32;
Tomo2k 6:f4773221794b 138 pen_bit = WF_ORDERING_TABLE[i]%32;
Tomo2k 6:f4773221794b 139 p_pen[pen_offset] |= 1 << pen_bit;
Tomo2k 6:f4773221794b 140 if (i>= _LCDFRONTPLANES) { // Pin is a backplane
Tomo2k 6:f4773221794b 141 p_pen[pen_offset+2] |= 1 << pen_bit; // Enable BPEN
Tomo2k 6:f4773221794b 142 LCD->WF8B[(uint8_t)WF_ORDERING_TABLE[i]] = 1 << (i - _LCDFRONTPLANES); // fill with 0x01, 0x02, etc
Tomo2k 6:f4773221794b 143 }
Tomo2k 6:f4773221794b 144 }
Tomo2k 6:f4773221794b 145 LCD->GCR |= LCD_GCR_LCDEN_MASK;
star297 3:f70873bc6121 146 }
Sissors 0:d04758e76d5b 147
Tomo2k 6:f4773221794b 148 int SLCD::_putc(int c)
Tomo2k 6:f4773221794b 149 {
star297 3:f70873bc6121 150 Write_Char(c);
star297 3:f70873bc6121 151 return 0;
star297 3:f70873bc6121 152 }
Sissors 0:d04758e76d5b 153
Tomo2k 6:f4773221794b 154 void SLCD::Write_Char (char lbValue)
Tomo2k 6:f4773221794b 155 {
Tomo2k 7:0e084b33d730 156 if (CharPosition >= _CHARNUM)
Tomo2k 7:0e084b33d730 157 CharPosition = 0;
Tomo2k 7:0e084b33d730 158
Tomo2k 7:0e084b33d730 159 if (lbValue == '.') {
Tomo2k 7:0e084b33d730 160 // Use built-in dot
Tomo2k 7:0e084b33d730 161 DP(CharPosition-1, true);
Tomo2k 7:0e084b33d730 162 return;
Tomo2k 7:0e084b33d730 163 }
Tomo2k 7:0e084b33d730 164
Tomo2k 6:f4773221794b 165 uint8_t char_val;
Tomo2k 6:f4773221794b 166 uint8_t temp;
Tomo2k 6:f4773221794b 167 uint8_t *lbpLCDWF;
Tomo2k 6:f4773221794b 168 uint8_t lbCounter;
Tomo2k 6:f4773221794b 169 uint16_t arrayOffset;
Tomo2k 6:f4773221794b 170 uint8_t position;
Tomo2k 6:f4773221794b 171
Tomo2k 6:f4773221794b 172 lbpLCDWF = (uint8_t *)&LCD->WF8B[0];
Tomo2k 6:f4773221794b 173 /* only ascii character if value not writeable write as @ */
Tomo2k 6:f4773221794b 174 if (lbValue>='a' && lbValue<='z') {
Tomo2k 6:f4773221794b 175 lbValue -= 32; // UpperCase
Tomo2k 6:f4773221794b 176 }
Tomo2k 6:f4773221794b 177 if (lbValue<ASCCI_TABLE_START || lbValue >ASCCI_TABLE_END) {
Tomo2k 6:f4773221794b 178 lbValue = BLANK_CHARACTER; // default value as space
Tomo2k 6:f4773221794b 179 }
Tomo2k 6:f4773221794b 180 lbValue -=ASCCI_TABLE_START; // Remove the offset to search in the ascci table
Tomo2k 6:f4773221794b 181 arrayOffset = (lbValue * _CHAR_SIZE); // Compensate matrix offset
Tomo2k 6:f4773221794b 182 // ensure bLCD position is in valid limit
Tomo2k 6:f4773221794b 183 lbCounter = 0; //number of writings to complete one char
Tomo2k 6:f4773221794b 184 while (lbCounter<_CHAR_SIZE) {
Tomo2k 6:f4773221794b 185 position = (CharPosition) *_LCDTYPE + lbCounter;
Tomo2k 6:f4773221794b 186 temp=0;
Tomo2k 6:f4773221794b 187 if (lbCounter==1) {
Tomo2k 6:f4773221794b 188 temp = lbpLCDWF[WF_ORDERING_TABLE[position]] & 0x01;//bit 0 has the special symbol information
Tomo2k 6:f4773221794b 189 }
Tomo2k 6:f4773221794b 190 char_val = ASCII_TO_WF_CODIFICATION_TABLE[arrayOffset + lbCounter];
Tomo2k 6:f4773221794b 191 lbpLCDWF[WF_ORDERING_TABLE[position]] = char_val | temp;
Tomo2k 6:f4773221794b 192 // if (char_val==0) lbCounter = _CHAR_SIZE; //end of this character
Tomo2k 6:f4773221794b 193 lbCounter++;
Tomo2k 6:f4773221794b 194 }
Tomo2k 6:f4773221794b 195 CharPosition++;
Sissors 0:d04758e76d5b 196 }
Sissors 0:d04758e76d5b 197
Tomo2k 10:ef2b3b7f1b01 198 void SLCD::Home()
Tomo2k 6:f4773221794b 199 {
Tomo2k 6:f4773221794b 200 CharPosition = 0;
Tomo2k 6:f4773221794b 201 }
star297 1:1579bcd31410 202
star297 3:f70873bc6121 203 void SLCD::Contrast (uint8_t lbContrast)
Tomo2k 6:f4773221794b 204 {
Tomo2k 6:f4773221794b 205 lbContrast &= 0x0F; //Forced to the only values accepted
Tomo2k 6:f4773221794b 206 LCD->GCR |= LCD_GCR_RVTRIM(lbContrast);
star297 1:1579bcd31410 207 }
Tomo2k 6:f4773221794b 208
Tomo2k 7:0e084b33d730 209 void SLCD::clear()
Tomo2k 7:0e084b33d730 210 {
Tomo2k 7:0e084b33d730 211 All_Segments(0);
Tomo2k 7:0e084b33d730 212 }
Tomo2k 7:0e084b33d730 213
star297 3:f70873bc6121 214 void SLCD::All_Segments (int mode)
star297 1:1579bcd31410 215 {
Tomo2k 6:f4773221794b 216 uint8_t lbTotalBytes = _CHARNUM * _LCDTYPE;
Tomo2k 6:f4773221794b 217 uint8_t lbCounter=0;
Tomo2k 6:f4773221794b 218 uint8_t *lbpLCDWF;
Tomo2k 6:f4773221794b 219
Tomo2k 6:f4773221794b 220 lbpLCDWF = (uint8_t *)&LCD->WF8B[0];
Tomo2k 6:f4773221794b 221 while (lbCounter < lbTotalBytes) {
Tomo2k 6:f4773221794b 222 if (mode==1) {
Tomo2k 6:f4773221794b 223 lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[lbCounter++]]=_ALLON;
Tomo2k 6:f4773221794b 224 } else {
Tomo2k 6:f4773221794b 225 lbpLCDWF[WF_ORDERING_TABLE[lbCounter++]]=0;
Tomo2k 6:f4773221794b 226 }
Tomo2k 6:f4773221794b 227 }
star297 1:1579bcd31410 228 }
star297 1:1579bcd31410 229
Tomo2k 7:0e084b33d730 230 void SLCD::DP(int pos, bool on)
star297 1:1579bcd31410 231 {
Tomo2k 6:f4773221794b 232 uint8_t *lbpLCDWF;
Tomo2k 7:0e084b33d730 233 int tableLoc;
Tomo2k 7:0e084b33d730 234 switch (pos) {
Tomo2k 7:0e084b33d730 235 case 0:
Tomo2k 7:0e084b33d730 236 tableLoc = 1;
Tomo2k 7:0e084b33d730 237 break;
Tomo2k 7:0e084b33d730 238 case 1:
Tomo2k 7:0e084b33d730 239 tableLoc = 3;
Tomo2k 7:0e084b33d730 240 break;
Tomo2k 7:0e084b33d730 241 case 2:
Tomo2k 7:0e084b33d730 242 tableLoc = 5;
Tomo2k 7:0e084b33d730 243 break;
Tomo2k 7:0e084b33d730 244 default:
Tomo2k 7:0e084b33d730 245 return; // Bad position
Tomo2k 7:0e084b33d730 246 }
Tomo2k 6:f4773221794b 247 lbpLCDWF = (uint8_t *)&LCD->WF8B[0];
Tomo2k 7:0e084b33d730 248 if (on) {
Tomo2k 7:0e084b33d730 249 lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[tableLoc]]|=1;
Tomo2k 6:f4773221794b 250 } else {
Tomo2k 7:0e084b33d730 251 lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[tableLoc]]&=~1;
Tomo2k 6:f4773221794b 252 }
star297 1:1579bcd31410 253 }
Tomo2k 6:f4773221794b 254
Tomo2k 7:0e084b33d730 255 void SLCD::DP1 (int mode)
Tomo2k 7:0e084b33d730 256 {
Tomo2k 7:0e084b33d730 257 DP(0, mode==1);
Tomo2k 7:0e084b33d730 258 }
Tomo2k 7:0e084b33d730 259
star297 3:f70873bc6121 260 void SLCD::DP2 (int mode)
star297 1:1579bcd31410 261 {
Tomo2k 7:0e084b33d730 262 DP(1, mode==1);
Tomo2k 6:f4773221794b 263 }
star297 1:1579bcd31410 264
star297 3:f70873bc6121 265 void SLCD::DP3 (int mode)
star297 1:1579bcd31410 266 {
Tomo2k 7:0e084b33d730 267 DP(2, mode==1);
star297 1:1579bcd31410 268 }
Tomo2k 6:f4773221794b 269
Tomo2k 10:ef2b3b7f1b01 270 void SLCD::Colon (bool on)
star297 1:1579bcd31410 271 {
Tomo2k 6:f4773221794b 272 uint8_t *lbpLCDWF;
Tomo2k 6:f4773221794b 273 lbpLCDWF = (uint8_t *)&LCD->WF8B[0];
Tomo2k 10:ef2b3b7f1b01 274 if (on) {
Tomo2k 6:f4773221794b 275 lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[7]]|=1;
Tomo2k 6:f4773221794b 276 } else {
Tomo2k 6:f4773221794b 277 lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[7]]&=~1;
Tomo2k 6:f4773221794b 278 }
star297 1:1579bcd31410 279 }
Tomo2k 6:f4773221794b 280
Tomo2k 6:f4773221794b 281 void SLCD::blink(int blink)
Tomo2k 6:f4773221794b 282 {
Sissors 4:ec7b3c9b2aeb 283 if (( blink > 7) || (blink < 0))
Sissors 4:ec7b3c9b2aeb 284 LCD->AR &= ~LCD_AR_BLINK_MASK;
Sissors 4:ec7b3c9b2aeb 285 else
Sissors 4:ec7b3c9b2aeb 286 LCD->AR |= LCD_AR_BLINK_MASK | blink;
Sissors 4:ec7b3c9b2aeb 287 }
Tomo2k 6:f4773221794b 288
Tomo2k 6:f4773221794b 289 void SLCD::deepsleepEnable(bool enable)
Tomo2k 6:f4773221794b 290 {
Sissors 4:ec7b3c9b2aeb 291 MCG->C1 &= ~MCG_C1_IREFSTEN_MASK;
Sissors 4:ec7b3c9b2aeb 292 MCG->C1 |= enable << MCG_C1_IREFSTEN_SHIFT;
Sissors 4:ec7b3c9b2aeb 293 LCD->GCR &= ~LCD_GCR_LCDSTP_MASK;
Sissors 4:ec7b3c9b2aeb 294 LCD->GCR |= (!enable) << LCD_GCR_LCDSTP_SHIFT;
Sissors 4:ec7b3c9b2aeb 295 }