KBrat-SSD541-HW-15-1

Fork of SLCD_minus_mod by Stanley Cohen

Committer:
star297
Date:
Mon Jan 27 21:57:38 2014 +0000
Revision:
3:f70873bc6121
Parent:
1:1579bcd31410
Child:
6:f4773221794b
Confirmed colon/dot functions, tidy code & test. Contrast found not be very effective.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
star297 3:f70873bc6121 1 #include "FRDM-s401.h" // 4x7 segdisplay
star297 1:1579bcd31410 2
star297 1:1579bcd31410 3
star297 1:1579bcd31410 4 #if 1 // VREF to VLL1
star297 1:1579bcd31410 5 /* Following configuration is used for LCD default initialization */
star297 3:f70873bc6121 6 #define _LCDRVEN (1) //
star297 3:f70873bc6121 7 #define _LCDRVTRIM (8) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 3:f70873bc6121 8 #define _LCDCPSEL (1) // charge pump select 0 or 1
star297 3:f70873bc6121 9 #define _LCDLOADADJUST (3) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 3:f70873bc6121 10 #define _LCDALTDIV (0) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 1:1579bcd31410 11 #define _LCDALRCLKSOURCE (0) // 0 -- External clock 1 -- Alternate clock
star297 1:1579bcd31410 12
star297 1:1579bcd31410 13 #define _LCDCLKPSL (0) // Clock divider to generate the LCD Waveforms
star297 1:1579bcd31410 14 #define _LCDSUPPLY (1)
star297 3:f70873bc6121 15 #define _LCDHREF (0) // 0 or 1
star297 1:1579bcd31410 16 #define _LCDCLKSOURCE (1) // 0 -- External clock 1 -- Alternate clock
star297 1:1579bcd31410 17 #define _LCDLCK (1) //Any number between 0 and 7
star297 1:1579bcd31410 18 #define _LCDBLINKRATE (3) //Any number between 0 and 7
star297 1:1579bcd31410 19
star297 1:1579bcd31410 20
star297 1:1579bcd31410 21 #else //VLL3 to VDD internally
star297 1:1579bcd31410 22 /* Following configuration is used for LCD default initialization */
star297 1:1579bcd31410 23 #define _LCDCLKSOURCE (1) // 0 -- External clock 1 -- Alternate clock
star297 1:1579bcd31410 24 #define _LCDALRCLKSOURCE (0) // 0 -- External clock 1 -- Alternate clock
star297 3:f70873bc6121 25 #define _LCDCLKPSL (0) // Clock divider to generate the LCD Waveforms
star297 1:1579bcd31410 26 #define _LCDSUPPLY (0)
star297 3:f70873bc6121 27 #define _LCDLOADADJUST (3) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 3:f70873bc6121 28 #define _LCDALTDIV (0) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 3:f70873bc6121 29 #define _LCDRVTRIM (0) // CPSEL = 1 0 -- 8000 pf 1 -- 6000 pf 2 -- 4000 pf 3 -- 2000 pf
star297 3:f70873bc6121 30 #define _LCDHREF (0) // 0 or 1
star297 3:f70873bc6121 31 #define _LCDCPSEL (1) // 0 or 1
star297 3:f70873bc6121 32 #define _LCDRVEN (0) //
star297 3:f70873bc6121 33 #define _LCDBLINKRATE (3) // Any number between 0 and 7
star297 3:f70873bc6121 34 #define _LCDLCK (0) // Any number between 0 and 7
star297 1:1579bcd31410 35
star297 1:1579bcd31410 36 #endif
star297 1:1579bcd31410 37
star297 1:1579bcd31410 38
star297 1:1579bcd31410 39
star297 1:1579bcd31410 40
star297 1:1579bcd31410 41 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~ LCD Control Register 0 ~|~|~|~|~|~|~|~|~|~|~|~|~*/
star297 1:1579bcd31410 42 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 3:f70873bc6121 43 #define _LCDINTENABLE (1)
star297 1:1579bcd31410 44
star297 1:1579bcd31410 45 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~ LCD Control Register 1 ~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 1:1579bcd31410 46 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 3:f70873bc6121 47 #define _LCDFRAMEINTERRUPT (0) //0 Disable Frame Frequency Interrupt
star297 3:f70873bc6121 48 //1 Enable an LCD interrupt that coincides with the LCD frame frequency
star297 3:f70873bc6121 49 #define _LCDFULLCPLDIRIVE (0) // 0 GPIO shared with the LCD. Inputs levels and internal pullup reference to VDD
star297 3:f70873bc6121 50 // 1 If VSUPPLY=11and RVEN=0. Inputs levels and internal pullup reference to VLL3
star297 3:f70873bc6121 51 #define _LCDWAITMODE (0) // 0 Allows the LCD driver and charge pump to continue running during wait mode
star297 3:f70873bc6121 52 // 1 Disable the LCD when the MCU goes into wait mode
star297 1:1579bcd31410 53 #define _LCDSTOPMODE (0) // 0 Allows the LCD driver and charge pump to continue running during stop2 or stop3
star297 3:f70873bc6121 54 // 1 Disable the LCD when and charge pump when the MCU goes into stop2 or stop3
star297 1:1579bcd31410 55
star297 1:1579bcd31410 56 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~ LCD Voltage Supply Register ~|~|~|~|~|~|~|~|~|~|~|~*/
star297 1:1579bcd31410 57 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 3:f70873bc6121 58 #define _LCDHIGHREF (0) //0 Divide input VIREG=1.0v
star297 3:f70873bc6121 59 //1 Do not divide the input VIREG=1.67v
star297 3:f70873bc6121 60 #define _LCDBBYPASS (0) //Determines whether the internal LCD op amp buffer is bypassed
star297 3:f70873bc6121 61 //0 Buffered mode
star297 3:f70873bc6121 62 //1 Unbuffered mode
star297 1:1579bcd31410 63
star297 1:1579bcd31410 64 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~ LCD Regulated Voltage Control |~|~|~|~|~|~|~|~|~|~*/
star297 1:1579bcd31410 65 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 3:f70873bc6121 66 #define _LCDCONTRAST (1) //Contrast by software 0 -- Disable 1-- Enable
star297 3:f70873bc6121 67 #define _LVLCONTRAST (0) //Any number between 0 and 15, if the number is bigger the glass gets darker
star297 1:1579bcd31410 68
star297 1:1579bcd31410 69 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~ LCD Blink Control Register ~|~|~|~|~|~|~|~|~|~|~|~*/
star297 1:1579bcd31410 70 /*~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|~|*/
star297 3:f70873bc6121 71 #define _LCDBLINKCONTROL (1) //0 Disable blink mode
star297 3:f70873bc6121 72 //1 Enable blink mode
star297 3:f70873bc6121 73 #define _LCDALTMODE (0) //0 Normal display
star297 3:f70873bc6121 74 //1 Alternate display for 4 backplanes or less the LCD backplane sequencer changes to otuput an alternate display
star297 3:f70873bc6121 75 #define _LCDBLANKDISP (0) //0 Do not blank display
star297 3:f70873bc6121 76 //1 Blank display if you put it in 0 the text before blank is manteined
star297 3:f70873bc6121 77 #define _LCDBLINKMODE (0) //0 Display blank during the blink period
star297 3:f70873bc6121 78 //1 Display alternate displat during blink period (Ignored if duty is 5 or greater)
star297 1:1579bcd31410 79
star297 1:1579bcd31410 80
star297 1:1579bcd31410 81 //Calculated values
star297 1:1579bcd31410 82 #define _LCDUSEDPINS (_LCDFRONTPLANES + _LCDBACKPLANES)
star297 1:1579bcd31410 83 #define _LCDDUTY (_LCDBACKPLANES-1) //Any number between 0 and 7
star297 1:1579bcd31410 84 #define LCD_WF_BASE LCD->WF8B[0]
star297 1:1579bcd31410 85
star297 3:f70873bc6121 86 // General definitions used by the LCD library
star297 1:1579bcd31410 87 #define LCD_WF(x) *((uint8 *)&LCD_WF_BASE + x)
star297 1:1579bcd31410 88
star297 1:1579bcd31410 89 /*LCD Fault Detections Consts*/
star297 1:1579bcd31410 90 #define FP_TYPE 0x00 // pin is a Front Plane
star297 1:1579bcd31410 91 #define BP_TYPE 0x80 // pin is Back Plane
star297 1:1579bcd31410 92
star297 1:1579bcd31410 93 // Fault Detect Preescaler Options
star297 1:1579bcd31410 94 #define FDPRS_1 0
star297 1:1579bcd31410 95 #define FDPRS_2 1
star297 1:1579bcd31410 96 #define FDPRS_4 2
star297 1:1579bcd31410 97 #define FDPRS_8 3
star297 1:1579bcd31410 98 #define FDPRS_16 4
star297 1:1579bcd31410 99 #define FDPRS_32 5
star297 1:1579bcd31410 100 #define FDPRS_64 6
star297 1:1579bcd31410 101 #define FDPRS_128 7
star297 1:1579bcd31410 102
star297 1:1579bcd31410 103 // Fault Detect Sample Window Width Values
star297 1:1579bcd31410 104 #define FDSWW_4 0
star297 1:1579bcd31410 105 #define FDSWW_8 1
star297 1:1579bcd31410 106 #define FDSWW_16 2
star297 1:1579bcd31410 107 #define FDSWW_32 3
star297 1:1579bcd31410 108 #define FDSWW_64 4
star297 1:1579bcd31410 109 #define FDSWW_128 5
star297 1:1579bcd31410 110 #define FDSWW_256 6
star297 1:1579bcd31410 111 #define FDSWW_512 7
star297 1:1579bcd31410 112
star297 1:1579bcd31410 113 /*
star297 1:1579bcd31410 114 Mask Bit definitions used f
star297 1:1579bcd31410 115 */
star297 1:1579bcd31410 116 #define mBIT0 1
star297 1:1579bcd31410 117 #define mBIT1 2
star297 1:1579bcd31410 118 #define mBIT2 4
star297 1:1579bcd31410 119 #define mBIT3 8
star297 1:1579bcd31410 120 #define mBIT4 16
star297 1:1579bcd31410 121 #define mBIT5 32
star297 1:1579bcd31410 122 #define mBIT6 64
star297 1:1579bcd31410 123 #define mBIT7 128
star297 1:1579bcd31410 124 #define mBIT8 256
star297 1:1579bcd31410 125 #define mBIT9 512
star297 1:1579bcd31410 126 #define mBIT10 1024
star297 1:1579bcd31410 127 #define mBIT11 2048
star297 1:1579bcd31410 128 #define mBIT12 4096
star297 1:1579bcd31410 129 #define mBIT13 8192
star297 1:1579bcd31410 130 #define mBIT14 16384
star297 1:1579bcd31410 131 #define mBIT15 32768
star297 1:1579bcd31410 132 #define mBIT16 65536
star297 1:1579bcd31410 133 #define mBIT17 131072
star297 1:1579bcd31410 134 #define mBIT18 262144
star297 1:1579bcd31410 135 #define mBIT19 524288
star297 1:1579bcd31410 136 #define mBIT20 1048576
star297 1:1579bcd31410 137 #define mBIT21 2097152
star297 1:1579bcd31410 138 #define mBIT22 4194304
star297 1:1579bcd31410 139 #define mBIT23 8388608
star297 1:1579bcd31410 140 #define mBIT24 16777216
star297 1:1579bcd31410 141 #define mBIT25 33554432
star297 1:1579bcd31410 142 #define mBIT26 67108864
star297 1:1579bcd31410 143 #define mBIT27 134217728
star297 1:1579bcd31410 144 #define mBIT28 268435456
star297 1:1579bcd31410 145 #define mBIT29 536870912
star297 1:1579bcd31410 146 #define mBIT30 1073741824
star297 1:1579bcd31410 147 #define mBIT31 2147483648
star297 1:1579bcd31410 148
star297 1:1579bcd31410 149 #define mBIT32 1
star297 1:1579bcd31410 150 #define mBIT33 2
star297 1:1579bcd31410 151 #define mBIT34 4
star297 1:1579bcd31410 152 #define mBIT35 8
star297 1:1579bcd31410 153 #define mBIT36 16
star297 1:1579bcd31410 154 #define mBIT37 32
star297 1:1579bcd31410 155 #define mBIT38 64
star297 1:1579bcd31410 156 #define mBIT39 128
star297 1:1579bcd31410 157 #define mBIT40 256
star297 1:1579bcd31410 158 #define mBIT41 512
star297 1:1579bcd31410 159 #define mBIT42 1024
star297 1:1579bcd31410 160 #define mBIT43 2048
star297 1:1579bcd31410 161 #define mBIT44 4096
star297 1:1579bcd31410 162 #define mBIT45 8192
star297 1:1579bcd31410 163 #define mBIT46 16384
star297 1:1579bcd31410 164 #define mBIT47 32768
star297 1:1579bcd31410 165 #define mBIT48 65536
star297 1:1579bcd31410 166 #define mBIT49 131072
star297 1:1579bcd31410 167 #define mBIT50 262144
star297 1:1579bcd31410 168 #define mBIT51 524288
star297 1:1579bcd31410 169 #define mBIT52 1048576
star297 1:1579bcd31410 170 #define mBIT53 2097152
star297 1:1579bcd31410 171 #define mBIT54 4194304
star297 1:1579bcd31410 172 #define mBIT55 8388608
star297 1:1579bcd31410 173 #define mBIT56 16777216
star297 1:1579bcd31410 174 #define mBIT57 33554432
star297 1:1579bcd31410 175 #define mBIT58 67108864
star297 1:1579bcd31410 176 #define mBIT59 134217728
star297 1:1579bcd31410 177 #define mBIT60 268435456
star297 1:1579bcd31410 178 #define mBIT61 536870912
star297 1:1579bcd31410 179 #define mBIT62 1073741824
star297 1:1579bcd31410 180 #define mBIT63 2147483648
star297 1:1579bcd31410 181
star297 1:1579bcd31410 182
star297 3:f70873bc6121 183