Provides a multiplexed dual seven segment display driver used by RenBED

Dependents:   RenBuggy RenBEDCounter RenBEDHelloWorld AmpBoardTest ... more

Committer:
jf1452
Date:
Wed Feb 05 10:36:35 2014 +0000
Revision:
5:cb7339a2e196
Parent:
3:7c62606a68b8
Added better Int support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jf1452 0:4dbbe1fc91cb 1 /*******************************************************************************
jf1452 0:4dbbe1fc91cb 2 * RenBED two seven segment display driver *
jf1452 0:4dbbe1fc91cb 3 * Copyright (c) 2013 Jon Fuge *
jf1452 0:4dbbe1fc91cb 4 * *
jf1452 0:4dbbe1fc91cb 5 * Permission is hereby granted, free of charge, to any person obtaining a copy *
jf1452 0:4dbbe1fc91cb 6 * of this software and associated documentation files (the "Software"), to deal*
jf1452 0:4dbbe1fc91cb 7 * in the Software without restriction, including without limitation the rights *
jf1452 0:4dbbe1fc91cb 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
jf1452 0:4dbbe1fc91cb 9 * copies of the Software, and to permit persons to whom the Software is *
jf1452 0:4dbbe1fc91cb 10 * furnished to do so, subject to the following conditions: *
jf1452 0:4dbbe1fc91cb 11 * *
jf1452 0:4dbbe1fc91cb 12 * The above copyright notice and this permission notice shall be included in *
jf1452 0:4dbbe1fc91cb 13 * all copies or substantial portions of the Software. *
jf1452 0:4dbbe1fc91cb 14 * *
jf1452 0:4dbbe1fc91cb 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
jf1452 0:4dbbe1fc91cb 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
jf1452 0:4dbbe1fc91cb 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
jf1452 0:4dbbe1fc91cb 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
jf1452 0:4dbbe1fc91cb 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,*
jf1452 0:4dbbe1fc91cb 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *
jf1452 0:4dbbe1fc91cb 21 * THE SOFTWARE. *
jf1452 0:4dbbe1fc91cb 22 * *
jf1452 3:7c62606a68b8 23 * SevenSegmentDisplay.cpp *
jf1452 0:4dbbe1fc91cb 24 * *
jf1452 0:4dbbe1fc91cb 25 * V1.0 23/12/2013 First issue of code Jon Fuge *
jf1452 3:7c62606a68b8 26 * V1.1 15/01/2014 Added code to display integers Jon Fuge *
jf1452 0:4dbbe1fc91cb 27 *******************************************************************************/
jf1452 0:4dbbe1fc91cb 28
jf1452 0:4dbbe1fc91cb 29 #ifndef _SEVENSEGMENTDISPLAY_C
jf1452 0:4dbbe1fc91cb 30 #define _SEVENSEGMENTDISPLAY_C
jf1452 0:4dbbe1fc91cb 31
jf1452 0:4dbbe1fc91cb 32 #include "mbed.h"
jf1452 0:4dbbe1fc91cb 33 #include "SevenSegmentDisplay.h"
jf1452 0:4dbbe1fc91cb 34
jf1452 3:7c62606a68b8 35 /*******************************************************************************
jf1452 3:7c62606a68b8 36 * SevenSegmentDisplay - Declares the class for the sevent segment display *
jf1452 3:7c62606a68b8 37 * driver *
jf1452 3:7c62606a68b8 38 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 39 * Parameters: uint8_t ui8Fade - Sets the fade mode required *
jf1452 3:7c62606a68b8 40 * Returns: none *
jf1452 3:7c62606a68b8 41 *******************************************************************************/
jf1452 3:7c62606a68b8 42 SevenSegmentDisplay::SevenSegmentDisplay(uint8_t ui8Fade):
jf1452 3:7c62606a68b8 43 mux(P1_25),seg_a(P1_23),seg_b(P1_28),seg_c(P0_16),seg_d(P1_31),seg_e(P1_13),seg_f(P1_16),seg_g(P1_19),seg_p(P0_23)
jf1452 3:7c62606a68b8 44 {
jf1452 0:4dbbe1fc91cb 45
jf1452 0:4dbbe1fc91cb 46 timer.attach_us(this, &SevenSegmentDisplay::SevenSegmentDisplayMux, 1000); // led smooth control 10ms timer inttruupt
jf1452 0:4dbbe1fc91cb 47
jf1452 0:4dbbe1fc91cb 48 D_ui8Mode = ui8Fade;
jf1452 0:4dbbe1fc91cb 49 D_FadeRatems = 10;
jf1452 0:4dbbe1fc91cb 50 D_ui16FlashRatems = 1000;
jf1452 0:4dbbe1fc91cb 51 D_ui8Mux = RIGHT_DIGIT;
jf1452 0:4dbbe1fc91cb 52 }
jf1452 0:4dbbe1fc91cb 53
jf1452 3:7c62606a68b8 54 /*******************************************************************************
jf1452 3:7c62606a68b8 55 * FadeMode - Sets the fade mode for the display drive *
jf1452 3:7c62606a68b8 56 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 57 * Parameters: uint8_t ui8Fade - Sets the fade mode required *
jf1452 3:7c62606a68b8 58 * Returns: none *
jf1452 3:7c62606a68b8 59 *******************************************************************************/
jf1452 3:7c62606a68b8 60 void SevenSegmentDisplay::FadeMode(uint8_t ui8Fade)
jf1452 3:7c62606a68b8 61 {
jf1452 0:4dbbe1fc91cb 62 D_ui8Mode = ui8Fade;
jf1452 0:4dbbe1fc91cb 63 }
jf1452 3:7c62606a68b8 64
jf1452 3:7c62606a68b8 65 /*******************************************************************************
jf1452 3:7c62606a68b8 66 * SevenSegmentDisplayMux - Alternately drives both digits using the multiplexor*
jf1452 3:7c62606a68b8 67 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 68 * Parameters: none *
jf1452 3:7c62606a68b8 69 * Returns: none *
jf1452 3:7c62606a68b8 70 *******************************************************************************/
jf1452 3:7c62606a68b8 71 void SevenSegmentDisplay::SevenSegmentDisplayMux(void)
jf1452 3:7c62606a68b8 72 {
jf1452 3:7c62606a68b8 73 static uint16_t ui16IntMux = 0;
jf1452 3:7c62606a68b8 74
jf1452 3:7c62606a68b8 75 if (D_ui8Mux == RIGHT_DIGIT) {
jf1452 0:4dbbe1fc91cb 76 D_ui8Mux = LEFT_DIGIT;
jf1452 0:4dbbe1fc91cb 77 SegmentDrive(D_ui8LeftDigit, LEFT_DIGIT);
jf1452 3:7c62606a68b8 78 } else {
jf1452 0:4dbbe1fc91cb 79 D_ui8Mux = RIGHT_DIGIT;
jf1452 0:4dbbe1fc91cb 80 SegmentDrive(D_ui8RightDigit, RIGHT_DIGIT);
jf1452 3:7c62606a68b8 81 }
jf1452 3:7c62606a68b8 82 if (iSequence != -1) {
jf1452 3:7c62606a68b8 83 if (ui16IntMux++ > 1000) {
jf1452 3:7c62606a68b8 84 ui16IntMux = 0;
jf1452 3:7c62606a68b8 85 SevenSegmentIntMux();
jf1452 3:7c62606a68b8 86 }
jf1452 3:7c62606a68b8 87 }
jf1452 3:7c62606a68b8 88 }
jf1452 3:7c62606a68b8 89
jf1452 3:7c62606a68b8 90 /*******************************************************************************
jf1452 3:7c62606a68b8 91 * SevenSegmentIntMux - Sequences through 3 pairs of digits to display an *
jf1452 3:7c62606a68b8 92 * integer on the seven segment display. *
jf1452 3:7c62606a68b8 93 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 94 * Parameters: none *
jf1452 3:7c62606a68b8 95 * Returns: none *
jf1452 3:7c62606a68b8 96 *******************************************************************************/
jf1452 3:7c62606a68b8 97 void SevenSegmentDisplay::SevenSegmentIntMux(void)
jf1452 3:7c62606a68b8 98 {
jf1452 3:7c62606a68b8 99 uint8_t Digits[6];
jf1452 3:7c62606a68b8 100 uint8_t Counter;
jf1452 3:7c62606a68b8 101 int TempValue;
jf1452 5:cb7339a2e196 102 int StartDigit = 0;
jf1452 3:7c62606a68b8 103
jf1452 3:7c62606a68b8 104 TempValue = iDisplayValue;
jf1452 3:7c62606a68b8 105 for (Counter = 5; Counter > 0; Counter--) {
jf1452 3:7c62606a68b8 106 Digits[Counter] = TempValue % 10;
jf1452 3:7c62606a68b8 107 TempValue = (int)(TempValue / 10);
jf1452 3:7c62606a68b8 108 }
jf1452 5:cb7339a2e196 109 Digits[0] = 0;
jf1452 5:cb7339a2e196 110 Digits[5] += 0x80;
jf1452 5:cb7339a2e196 111
jf1452 5:cb7339a2e196 112 for (Counter = 0; Counter < 6; Counter++) {
jf1452 5:cb7339a2e196 113 if (Digits[Counter] == 0)
jf1452 5:cb7339a2e196 114 Digits[Counter] = 36;
jf1452 5:cb7339a2e196 115 else
jf1452 5:cb7339a2e196 116 {
jf1452 5:cb7339a2e196 117 StartDigit = Counter & 0xFE;
jf1452 5:cb7339a2e196 118 break;
jf1452 5:cb7339a2e196 119 }
jf1452 5:cb7339a2e196 120 }
jf1452 3:7c62606a68b8 121
jf1452 3:7c62606a68b8 122 D_ui8LeftDigit = Digits[iSequence++];
jf1452 3:7c62606a68b8 123 D_ui8RightDigit = Digits[iSequence++];
jf1452 3:7c62606a68b8 124 if (iSequence == 6)
jf1452 5:cb7339a2e196 125 iSequence = StartDigit;
jf1452 3:7c62606a68b8 126 }
jf1452 0:4dbbe1fc91cb 127
jf1452 3:7c62606a68b8 128 /*******************************************************************************
jf1452 3:7c62606a68b8 129 * SegmentDrive *
jf1452 3:7c62606a68b8 130 * SegmentDrive - converts ui8Value into a segment drive pattern to load into *
jf1452 3:7c62606a68b8 131 * the display buffer, this is incremented or decremented according to the *
jf1452 3:7c62606a68b8 132 * pattern value to give a fade transition effect when digits change *
jf1452 3:7c62606a68b8 133 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 134 * Parameters: uint8_t ui8Value - Specifies the value to be displayed *
jf1452 3:7c62606a68b8 135 * uint8_t ui8Mux - Specifies which LED to be driven *
jf1452 3:7c62606a68b8 136 * Returns: none *
jf1452 3:7c62606a68b8 137 *******************************************************************************/
jf1452 3:7c62606a68b8 138 void SevenSegmentDisplay::SegmentDrive(uint8_t ui8Value, uint8_t ui8Mux)
jf1452 3:7c62606a68b8 139 {
jf1452 3:7c62606a68b8 140 const uint8_t SEGMENTS[37] = {
jf1452 3:7c62606a68b8 141 //*********************************************************
jf1452 3:7c62606a68b8 142 // 7segment pattern,
jf1452 3:7c62606a68b8 143 //*********************************************************
jf1452 3:7c62606a68b8 144 // seg: g f e d c b a
jf1452 3:7c62606a68b8 145 // bit: 6 5 4 3 2 1 0
jf1452 3:7c62606a68b8 146 // --------------------
jf1452 3:7c62606a68b8 147 0xC0, // 0 1 0 0 0 0 0 0
jf1452 3:7c62606a68b8 148 0xF9, // 1 1 1 1 1 0 0 1
jf1452 3:7c62606a68b8 149 0xA4, // 2 0 1 0 0 1 0 0
jf1452 3:7c62606a68b8 150 0xB0, // 3 0 1 1 0 0 0 0
jf1452 3:7c62606a68b8 151 0x99, // 4 0 0 1 1 0 0 1
jf1452 3:7c62606a68b8 152 0x92, // 5 0 0 1 0 0 1 0
jf1452 3:7c62606a68b8 153 0x82, // 6 0 0 0 0 0 1 0
jf1452 3:7c62606a68b8 154 0x58, // 7 1 0 1 1 0 0 0
jf1452 3:7c62606a68b8 155 0x80, // 8 0 0 0 0 0 0 0
jf1452 3:7c62606a68b8 156 0x90, // 9 0 0 1 0 0 0 0
jf1452 3:7c62606a68b8 157 0x88, // A 0 0 0 1 0 0 0
jf1452 3:7c62606a68b8 158 0x83, // B 0 0 0 0 0 1 1
jf1452 3:7c62606a68b8 159 0xC6, // C 1 0 0 0 1 1 0
jf1452 3:7c62606a68b8 160 0xA1, // D 0 1 0 0 0 0 1
jf1452 3:7c62606a68b8 161 0x86, // E 0 0 0 0 1 1 0
jf1452 3:7c62606a68b8 162 0x8E, // F 0 0 0 1 1 1 0
jf1452 3:7c62606a68b8 163 0xC2, // G 1 0 0 0 0 1 0
jf1452 3:7c62606a68b8 164 0x8B, // H 0 0 0 1 0 1 1
jf1452 3:7c62606a68b8 165 0xCF, // I 1 0 0 1 1 1 1
jf1452 3:7c62606a68b8 166 0xE1, // J 1 1 0 0 0 0 1
jf1452 3:7c62606a68b8 167 0x8A, // K 0 0 0 1 0 1 0
jf1452 3:7c62606a68b8 168 0xC7, // L 1 0 0 0 1 1 1
jf1452 3:7c62606a68b8 169 0xEA, // M 1 1 0 1 0 1 0
jf1452 3:7c62606a68b8 170 0xAB, // N 0 1 0 1 0 1 1
jf1452 3:7c62606a68b8 171 0xA3, // O 0 1 0 0 0 1 1
jf1452 3:7c62606a68b8 172 0x8C, // P 0 0 0 1 1 0 0
jf1452 3:7c62606a68b8 173 0x98, // Q 0 0 1 1 0 0 0
jf1452 3:7c62606a68b8 174 0xCC, // R 1 0 0 1 1 0 0
jf1452 3:7c62606a68b8 175 0x96, // S 0 0 1 0 1 1 0
jf1452 3:7c62606a68b8 176 0x87, // T 0 0 0 0 1 1 1
jf1452 3:7c62606a68b8 177 0xE3, // U 1 1 0 0 0 1 1
jf1452 3:7c62606a68b8 178 0xC1, // V 1 0 0 0 0 0 1
jf1452 3:7c62606a68b8 179 0xD5, // W 1 0 1 0 1 0 1
jf1452 3:7c62606a68b8 180 0x89, // X 0 0 0 1 0 0 1
jf1452 3:7c62606a68b8 181 0x91, // Y 0 0 1 0 0 0 1
jf1452 3:7c62606a68b8 182 0xB4, // Z 0 1 1 0 1 0 0
jf1452 3:7c62606a68b8 183 0xFF // 1 1 1 1 1 1 1
jf1452 3:7c62606a68b8 184 };
jf1452 0:4dbbe1fc91cb 185
jf1452 3:7c62606a68b8 186 uint8_t bSegment;
jf1452 3:7c62606a68b8 187 uint8_t ui8Segment;
jf1452 3:7c62606a68b8 188 static uint8_t D_ui8Pwm = D_FadeRatems -1; // PWM counter for fader
jf1452 3:7c62606a68b8 189 static uint16_t D_ui16FlashCount = 0; // Counter for flash rate
jf1452 3:7c62606a68b8 190 uint8_t ui8FlashCycle;
jf1452 3:7c62606a68b8 191 uint8_t ui8SegmentState;
jf1452 0:4dbbe1fc91cb 192
jf1452 0:4dbbe1fc91cb 193 D_ui16FlashCount++;
jf1452 0:4dbbe1fc91cb 194 if ((D_ui16FlashCount >= (D_ui16FlashRatems/2)) && (D_ui8Mode & FLASH))
jf1452 0:4dbbe1fc91cb 195 ui8FlashCycle = 1;
jf1452 0:4dbbe1fc91cb 196 else
jf1452 0:4dbbe1fc91cb 197 ui8FlashCycle = 0;
jf1452 3:7c62606a68b8 198
jf1452 0:4dbbe1fc91cb 199 if (D_ui16FlashCount >= D_ui16FlashRatems)
jf1452 0:4dbbe1fc91cb 200 D_ui16FlashCount = 0;
jf1452 3:7c62606a68b8 201
jf1452 0:4dbbe1fc91cb 202 mux = ui8Mux;
jf1452 3:7c62606a68b8 203 for (ui8Segment = 0; ui8Segment < 8; ui8Segment++) {
jf1452 0:4dbbe1fc91cb 204 if (D_ui8SegmentDrives[ui8Mux][ui8Segment] > D_ui8Pwm)
jf1452 0:4dbbe1fc91cb 205 ui8SegmentState = ui8FlashCycle;
jf1452 0:4dbbe1fc91cb 206 else
jf1452 0:4dbbe1fc91cb 207 ui8SegmentState = 1;
jf1452 0:4dbbe1fc91cb 208 switch (ui8Segment) {
jf1452 3:7c62606a68b8 209 case 0:
jf1452 3:7c62606a68b8 210 seg_a = ui8SegmentState;
jf1452 3:7c62606a68b8 211 case 1:
jf1452 3:7c62606a68b8 212 seg_b = ui8SegmentState;
jf1452 3:7c62606a68b8 213 case 2:
jf1452 3:7c62606a68b8 214 seg_c = ui8SegmentState;
jf1452 3:7c62606a68b8 215 case 3:
jf1452 3:7c62606a68b8 216 seg_d = ui8SegmentState;
jf1452 3:7c62606a68b8 217 case 4:
jf1452 3:7c62606a68b8 218 seg_e = ui8SegmentState;
jf1452 3:7c62606a68b8 219 case 5:
jf1452 3:7c62606a68b8 220 seg_f = ui8SegmentState;
jf1452 3:7c62606a68b8 221 case 6:
jf1452 3:7c62606a68b8 222 seg_g = ui8SegmentState;
jf1452 3:7c62606a68b8 223 case 7:
jf1452 3:7c62606a68b8 224 seg_p = ui8SegmentState;
jf1452 0:4dbbe1fc91cb 225 }
jf1452 0:4dbbe1fc91cb 226 }
jf1452 3:7c62606a68b8 227
jf1452 0:4dbbe1fc91cb 228 D_ui8Pwm--;
jf1452 3:7c62606a68b8 229 if (D_ui8Pwm == 0) {
jf1452 0:4dbbe1fc91cb 230 D_ui8Pwm = D_FadeRatems - 1;
jf1452 0:4dbbe1fc91cb 231
jf1452 0:4dbbe1fc91cb 232 bSegment = SEGMENTS[(ui8Value & 0x7f)];
jf1452 3:7c62606a68b8 233 if (D_ui8Mode & FADE) {
jf1452 0:4dbbe1fc91cb 234 for (ui8Segment = 0; ui8Segment < 7; ui8Segment++)
jf1452 3:7c62606a68b8 235 if((bSegment & (0x01 << ui8Segment)) == 0) {
jf1452 0:4dbbe1fc91cb 236 if (D_ui8SegmentDrives[ui8Mux][ui8Segment] < D_FadeRatems) D_ui8SegmentDrives[ui8Mux][ui8Segment]++;
jf1452 3:7c62606a68b8 237 } else {
jf1452 0:4dbbe1fc91cb 238 if (D_ui8SegmentDrives[ui8Mux][ui8Segment] > 0) D_ui8SegmentDrives[ui8Mux][ui8Segment]--;
jf1452 0:4dbbe1fc91cb 239 }
jf1452 3:7c62606a68b8 240 if (ui8Value & 0x80) {
jf1452 0:4dbbe1fc91cb 241 if (D_ui8SegmentDrives[ui8Mux][7] < D_FadeRatems) D_ui8SegmentDrives[ui8Mux][7]++;
jf1452 3:7c62606a68b8 242 } else {
jf1452 0:4dbbe1fc91cb 243 if (D_ui8SegmentDrives[ui8Mux][7] > 0) D_ui8SegmentDrives[ui8Mux][7]--;
jf1452 0:4dbbe1fc91cb 244 }
jf1452 3:7c62606a68b8 245 } else {
jf1452 0:4dbbe1fc91cb 246 for (ui8Segment = 0; ui8Segment < 7; ui8Segment++)
jf1452 0:4dbbe1fc91cb 247 if((bSegment & (0x01 << ui8Segment)) == 0)
jf1452 0:4dbbe1fc91cb 248 D_ui8SegmentDrives[ui8Mux][ui8Segment] = D_FadeRatems;
jf1452 0:4dbbe1fc91cb 249 else
jf1452 0:4dbbe1fc91cb 250 D_ui8SegmentDrives[ui8Mux][ui8Segment] = 0;
jf1452 0:4dbbe1fc91cb 251 if (ui8Value & 0x80)
jf1452 0:4dbbe1fc91cb 252 D_ui8SegmentDrives[ui8Mux][7] = D_FadeRatems;
jf1452 0:4dbbe1fc91cb 253 else
jf1452 0:4dbbe1fc91cb 254 D_ui8SegmentDrives[ui8Mux][7] = 0;
jf1452 0:4dbbe1fc91cb 255 }
jf1452 0:4dbbe1fc91cb 256 }
jf1452 0:4dbbe1fc91cb 257 }
jf1452 0:4dbbe1fc91cb 258
jf1452 3:7c62606a68b8 259 /*******************************************************************************
jf1452 3:7c62606a68b8 260 * DisplayDigits - Loads the register to display two digits on the display *
jf1452 3:7c62606a68b8 261 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 262 * Parameters: uint8_t ui8LeftDigit - Specifies the left digit *
jf1452 3:7c62606a68b8 263 * uint8_t ui8RightDigit - Specifies the right digit *
jf1452 3:7c62606a68b8 264 * Returns: none *
jf1452 3:7c62606a68b8 265 *******************************************************************************/
jf1452 3:7c62606a68b8 266 void SevenSegmentDisplay::DisplayDigits(uint8_t ui8LeftDigit, uint8_t ui8RightDigit)
jf1452 0:4dbbe1fc91cb 267 {
jf1452 0:4dbbe1fc91cb 268 D_ui8LeftDigit = ui8LeftDigit;
jf1452 0:4dbbe1fc91cb 269 D_ui8RightDigit = ui8RightDigit;
jf1452 3:7c62606a68b8 270 inttimer.detach();
jf1452 3:7c62606a68b8 271 iSequence = -1;
jf1452 0:4dbbe1fc91cb 272 }
jf1452 0:4dbbe1fc91cb 273
jf1452 3:7c62606a68b8 274 /*******************************************************************************
jf1452 3:7c62606a68b8 275 * DisplayInt - Loads the register to display an integer on the display *
jf1452 3:7c62606a68b8 276 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 277 * Parameters: int iValue - Specifies the integer value to be displayed *
jf1452 3:7c62606a68b8 278 * Returns: none *
jf1452 3:7c62606a68b8 279 *******************************************************************************/
jf1452 3:7c62606a68b8 280 void SevenSegmentDisplay::DisplayInt(int iValue)
jf1452 3:7c62606a68b8 281 {
jf1452 3:7c62606a68b8 282 iDisplayValue = iValue;
jf1452 5:cb7339a2e196 283 if (iValue > 9999)
jf1452 5:cb7339a2e196 284 iSequence = 0;
jf1452 5:cb7339a2e196 285 else if (iValue > 99)
jf1452 5:cb7339a2e196 286 iSequence = 2;
jf1452 5:cb7339a2e196 287 else
jf1452 5:cb7339a2e196 288 iSequence = 4;
jf1452 3:7c62606a68b8 289 }
jf1452 3:7c62606a68b8 290
jf1452 3:7c62606a68b8 291 /*******************************************************************************
jf1452 3:7c62606a68b8 292 * FlashRate - Sets the flash rate for the display *
jf1452 3:7c62606a68b8 293 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 294 * Parameters: uint8_t ui16FlashRateMs - Sets the flash rate in ms *
jf1452 3:7c62606a68b8 295 * Returns: none *
jf1452 3:7c62606a68b8 296 *******************************************************************************/
jf1452 0:4dbbe1fc91cb 297 void SevenSegmentDisplay::FlashRate(uint16_t ui16FlashRateMs)
jf1452 0:4dbbe1fc91cb 298 {
jf1452 0:4dbbe1fc91cb 299 D_ui16FlashRatems = ui16FlashRateMs;
jf1452 0:4dbbe1fc91cb 300 }
jf1452 0:4dbbe1fc91cb 301
jf1452 3:7c62606a68b8 302 /*******************************************************************************
jf1452 3:7c62606a68b8 303 * FadeRate - Sets the fade rate for segment transistions *
jf1452 3:7c62606a68b8 304 *------------------------------------------------------------------------------*
jf1452 3:7c62606a68b8 305 * Parameters: uint8_t ui8FadeRateMs - Sets the fade rate in ms *
jf1452 3:7c62606a68b8 306 * Returns: none *
jf1452 3:7c62606a68b8 307 *******************************************************************************/
jf1452 0:4dbbe1fc91cb 308 void SevenSegmentDisplay::FadeRate(uint8_t ui8FadeRateMs)
jf1452 0:4dbbe1fc91cb 309 {
jf1452 0:4dbbe1fc91cb 310 D_FadeRatems = ui8FadeRateMs;
jf1452 0:4dbbe1fc91cb 311 }
jf1452 0:4dbbe1fc91cb 312
jf1452 0:4dbbe1fc91cb 313
jf1452 0:4dbbe1fc91cb 314 #endif