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