7 segment display library for mbed This routine support 2,4 and 8 digit anode-common or cathode-common LED.
Sseg.h@4:858e42224b50, 2014-08-07 (annotated)
- Committer:
- morecat_lab
- Date:
- Thu Aug 07 02:58:19 2014 +0000
- Revision:
- 4:858e42224b50
- Parent:
- 3:77ec0c031053
- Child:
- 5:d99849505bf7
add more comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
morecat_lab | 0:6bf4ee8ee342 | 1 | /* |
morecat_lab | 4:858e42224b50 | 2 | SSeg.cpp - mbed library for 2/4/8 digit seven segment LED driver. |
morecat_lab | 1:12daa491059c | 3 | Copyright 2013,2014 by morecat_lab |
morecat_lab | 0:6bf4ee8ee342 | 4 | |
morecat_lab | 1:12daa491059c | 5 | based on Dots library. |
morecat_lab | 0:6bf4ee8ee342 | 6 | Copyright 2010 arms22. All right reserved. |
morecat_lab | 0:6bf4ee8ee342 | 7 | |
morecat_lab | 0:6bf4ee8ee342 | 8 | This library is distributed in the hope that it will be useful, |
morecat_lab | 0:6bf4ee8ee342 | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
morecat_lab | 0:6bf4ee8ee342 | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
morecat_lab | 0:6bf4ee8ee342 | 11 | */ |
morecat_lab | 0:6bf4ee8ee342 | 12 | |
morecat_lab | 0:6bf4ee8ee342 | 13 | #ifndef SSEG_H |
morecat_lab | 0:6bf4ee8ee342 | 14 | #define SSEG_H |
morecat_lab | 0:6bf4ee8ee342 | 15 | |
morecat_lab | 0:6bf4ee8ee342 | 16 | #include "mbed.h" |
morecat_lab | 0:6bf4ee8ee342 | 17 | #include <Timer.h> |
morecat_lab | 0:6bf4ee8ee342 | 18 | |
morecat_lab | 0:6bf4ee8ee342 | 19 | #define NUM_PAT_0 0xfc |
morecat_lab | 0:6bf4ee8ee342 | 20 | #define NUM_PAT_1 0x60 |
morecat_lab | 0:6bf4ee8ee342 | 21 | #define NUM_PAT_2 0xda |
morecat_lab | 0:6bf4ee8ee342 | 22 | #define NUM_PAT_3 0xf2 |
morecat_lab | 0:6bf4ee8ee342 | 23 | #define NUM_PAT_4 0x66 |
morecat_lab | 0:6bf4ee8ee342 | 24 | #define NUM_PAT_5 0xb6 |
morecat_lab | 0:6bf4ee8ee342 | 25 | #define NUM_PAT_6 0xbe |
morecat_lab | 0:6bf4ee8ee342 | 26 | #define NUM_PAT_7 0xe0 |
morecat_lab | 0:6bf4ee8ee342 | 27 | #define NUM_PAT_8 0xfe |
morecat_lab | 0:6bf4ee8ee342 | 28 | #define NUM_PAT_9 0xf6 |
morecat_lab | 0:6bf4ee8ee342 | 29 | #define NUM_PAT_A 0xee |
morecat_lab | 0:6bf4ee8ee342 | 30 | #define NUM_PAT_B 0x3e |
morecat_lab | 0:6bf4ee8ee342 | 31 | #define NUM_PAT_C 0x9c |
morecat_lab | 0:6bf4ee8ee342 | 32 | #define NUM_PAT_D 0x7a |
morecat_lab | 0:6bf4ee8ee342 | 33 | #define NUM_PAT_E 0x9e |
morecat_lab | 0:6bf4ee8ee342 | 34 | #define NUM_PAT_F 0x8e |
morecat_lab | 0:6bf4ee8ee342 | 35 | |
morecat_lab | 1:12daa491059c | 36 | /** |
morecat_lab | 4:858e42224b50 | 37 | * Seven segment display driver library |
morecat_lab | 4:858e42224b50 | 38 | */ |
morecat_lab | 0:6bf4ee8ee342 | 39 | class Sseg |
morecat_lab | 0:6bf4ee8ee342 | 40 | { |
morecat_lab | 0:6bf4ee8ee342 | 41 | private: |
morecat_lab | 0:6bf4ee8ee342 | 42 | unsigned long _lastUpdateTime; |
morecat_lab | 0:6bf4ee8ee342 | 43 | int _updateInterval; |
morecat_lab | 0:6bf4ee8ee342 | 44 | BusOut _segPins; |
morecat_lab | 0:6bf4ee8ee342 | 45 | BusOut _digPins; |
morecat_lab | 0:6bf4ee8ee342 | 46 | char _buffer[8]; |
morecat_lab | 0:6bf4ee8ee342 | 47 | int _numOfDigs; |
morecat_lab | 0:6bf4ee8ee342 | 48 | int _dig; // support 4 or 8 |
morecat_lab | 0:6bf4ee8ee342 | 49 | bool _zeroSupress; |
morecat_lab | 0:6bf4ee8ee342 | 50 | bool _kcommon; // Cathode-common flag |
morecat_lab | 0:6bf4ee8ee342 | 51 | void initConv(void); |
morecat_lab | 0:6bf4ee8ee342 | 52 | Timer timer; |
morecat_lab | 0:6bf4ee8ee342 | 53 | public: |
morecat_lab | 0:6bf4ee8ee342 | 54 | static const int numConv[16]; |
morecat_lab | 1:12daa491059c | 55 | /** |
morecat_lab | 2:6f63a5e21d08 | 56 | * create an 2 digit seven segment driver |
morecat_lab | 2:6f63a5e21d08 | 57 | * |
morecat_lab | 3:77ec0c031053 | 58 | * @param PinName a Pin No for segment A |
morecat_lab | 1:12daa491059c | 59 | * @param PinName b Pin No for segment B |
morecat_lab | 1:12daa491059c | 60 | * @param PinName c Pin No for segment C |
morecat_lab | 1:12daa491059c | 61 | * @param PinName d Pin No for segment D |
morecat_lab | 1:12daa491059c | 62 | * @param PinName e Pin No for segment E |
morecat_lab | 1:12daa491059c | 63 | * @param PinName f Pin No for segment F |
morecat_lab | 1:12daa491059c | 64 | * @param PinName g Pin No for segment G |
morecat_lab | 1:12daa491059c | 65 | * @param PinName dp Pin No for segment DP |
morecat_lab | 3:77ec0c031053 | 66 | * @param PinName d1 Pin No for dight 1 |
morecat_lab | 1:12daa491059c | 67 | * @param PinName d2 Pin No for dight 2 |
morecat_lab | 1:12daa491059c | 68 | */ |
morecat_lab | 0:6bf4ee8ee342 | 69 | Sseg(PinName a,PinName b,PinName c,PinName d, |
morecat_lab | 0:6bf4ee8ee342 | 70 | PinName e,PinName f,PinName g,PinName dp, |
morecat_lab | 0:6bf4ee8ee342 | 71 | PinName d1,PinName d2); |
morecat_lab | 0:6bf4ee8ee342 | 72 | |
morecat_lab | 1:12daa491059c | 73 | /** |
morecat_lab | 1:12daa491059c | 74 | * create an 4 digit seven segment driver |
morecat_lab | 1:12daa491059c | 75 | * |
morecat_lab | 1:12daa491059c | 76 | * @param PinName a Pin No for segment A |
morecat_lab | 1:12daa491059c | 77 | * @param PinName b Pin No for segment B |
morecat_lab | 1:12daa491059c | 78 | * @param PinName c Pin No for segment C |
morecat_lab | 1:12daa491059c | 79 | * @param PinName d Pin No for segment D |
morecat_lab | 1:12daa491059c | 80 | * @param PinName e Pin No for segment E |
morecat_lab | 1:12daa491059c | 81 | * @param PinName f Pin No for segment F |
morecat_lab | 1:12daa491059c | 82 | * @param PinName g Pin No for segment G |
morecat_lab | 1:12daa491059c | 83 | * @param PinName dp Pin No for segment DP |
morecat_lab | 1:12daa491059c | 84 | * @param PinName d1 Pin No for dight 1 |
morecat_lab | 1:12daa491059c | 85 | * @param PinName d2 Pin No for dight 2 |
morecat_lab | 1:12daa491059c | 86 | * @param PinName d3 Pin No for dight 3 |
morecat_lab | 1:12daa491059c | 87 | * @param PinName d4 Pin No for dight 4 |
morecat_lab | 1:12daa491059c | 88 | */ |
morecat_lab | 0:6bf4ee8ee342 | 89 | Sseg(PinName a,PinName b,PinName c,PinName d, |
morecat_lab | 0:6bf4ee8ee342 | 90 | PinName e,PinName f,PinName g,PinName dp, |
morecat_lab | 0:6bf4ee8ee342 | 91 | PinName d1,PinName d2, PinName d3, PinName d4); |
morecat_lab | 0:6bf4ee8ee342 | 92 | |
morecat_lab | 1:12daa491059c | 93 | /** |
morecat_lab | 1:12daa491059c | 94 | * create an 8 digit seven segment driver |
morecat_lab | 1:12daa491059c | 95 | * |
morecat_lab | 1:12daa491059c | 96 | * @param PinName a Pin No for segment A |
morecat_lab | 1:12daa491059c | 97 | * @param PinName b Pin No for segment B |
morecat_lab | 1:12daa491059c | 98 | * @param PinName c Pin No for segment C |
morecat_lab | 1:12daa491059c | 99 | * @param PinName d Pin No for segment D |
morecat_lab | 1:12daa491059c | 100 | * @param PinName e Pin No for segment E |
morecat_lab | 1:12daa491059c | 101 | * @param PinName f Pin No for segment F |
morecat_lab | 1:12daa491059c | 102 | * @param PinName g Pin No for segment G |
morecat_lab | 1:12daa491059c | 103 | * @param PinName dp Pin No for segment DP |
morecat_lab | 1:12daa491059c | 104 | * @param PinName d1 Pin No for dight 1 |
morecat_lab | 1:12daa491059c | 105 | * @param PinName d2 Pin No for dight 2 |
morecat_lab | 1:12daa491059c | 106 | * @param PinName d3 Pin No for dight 3 |
morecat_lab | 1:12daa491059c | 107 | * @param PinName d4 Pin No for dight 4 |
morecat_lab | 1:12daa491059c | 108 | * @param PinName d5 Pin No for dight 5 |
morecat_lab | 1:12daa491059c | 109 | * @param PinName d6 Pin No for dight 6 |
morecat_lab | 1:12daa491059c | 110 | * @param PinName d7 Pin No for dight 7 |
morecat_lab | 1:12daa491059c | 111 | * @param PinName d8 Pin No for dight 8 |
morecat_lab | 1:12daa491059c | 112 | */ |
morecat_lab | 0:6bf4ee8ee342 | 113 | Sseg(PinName a,PinName b,PinName c,PinName d, |
morecat_lab | 0:6bf4ee8ee342 | 114 | PinName e,PinName f,PinName g,PinName dp, |
morecat_lab | 0:6bf4ee8ee342 | 115 | PinName d1,PinName d2, PinName d3, PinName d4, |
morecat_lab | 0:6bf4ee8ee342 | 116 | PinName d5,PinName d6, PinName d7, PinName d8); |
morecat_lab | 0:6bf4ee8ee342 | 117 | |
morecat_lab | 1:12daa491059c | 118 | /** |
morecat_lab | 2:6f63a5e21d08 | 119 | * start driver |
morecat_lab | 2:6f63a5e21d08 | 120 | */ |
morecat_lab | 0:6bf4ee8ee342 | 121 | void begin(void); |
morecat_lab | 1:12daa491059c | 122 | |
morecat_lab | 1:12daa491059c | 123 | /** |
morecat_lab | 1:12daa491059c | 124 | * use Kathode Common LED |
morecat_lab | 1:12daa491059c | 125 | */ |
morecat_lab | 0:6bf4ee8ee342 | 126 | void setKcommon(void); |
morecat_lab | 1:12daa491059c | 127 | |
morecat_lab | 1:12daa491059c | 128 | /** |
morecat_lab | 1:12daa491059c | 129 | * use Anode Common LED (default) |
morecat_lab | 1:12daa491059c | 130 | */ |
morecat_lab | 0:6bf4ee8ee342 | 131 | void setAcommon(void); |
morecat_lab | 1:12daa491059c | 132 | |
morecat_lab | 1:12daa491059c | 133 | /** |
morecat_lab | 3:77ec0c031053 | 134 | * get a charcter pattern from a number |
morecat_lab | 1:12daa491059c | 135 | * |
morecat_lab | 1:12daa491059c | 136 | * @param i number |
morecat_lab | 1:12daa491059c | 137 | * |
morecat_lab | 3:77ec0c031053 | 138 | * @returns bit pattern of number i |
morecat_lab | 3:77ec0c031053 | 139 | * |
morecat_lab | 1:12daa491059c | 140 | */ |
morecat_lab | 2:6f63a5e21d08 | 141 | char segCh(char i); |
morecat_lab | 1:12daa491059c | 142 | |
morecat_lab | 1:12daa491059c | 143 | /** |
morecat_lab | 4:858e42224b50 | 144 | * turn on DP |
morecat_lab | 1:12daa491059c | 145 | * |
morecat_lab | 1:12daa491059c | 146 | * @param dight |
morecat_lab | 1:12daa491059c | 147 | * |
morecat_lab | 1:12daa491059c | 148 | */ |
morecat_lab | 0:6bf4ee8ee342 | 149 | void setDot(int d); |
morecat_lab | 1:12daa491059c | 150 | |
morecat_lab | 1:12daa491059c | 151 | /** |
morecat_lab | 1:12daa491059c | 152 | * turn off DP |
morecat_lab | 1:12daa491059c | 153 | * |
morecat_lab | 1:12daa491059c | 154 | * @param dight |
morecat_lab | 1:12daa491059c | 155 | * |
morecat_lab | 1:12daa491059c | 156 | */ |
morecat_lab | 0:6bf4ee8ee342 | 157 | void clearDot(int d); |
morecat_lab | 1:12daa491059c | 158 | |
morecat_lab | 1:12daa491059c | 159 | /** |
morecat_lab | 1:12daa491059c | 160 | * write a number to LED |
morecat_lab | 1:12daa491059c | 161 | * |
morecat_lab | 3:77ec0c031053 | 162 | * @param d number |
morecat_lab | 1:12daa491059c | 163 | * |
morecat_lab | 1:12daa491059c | 164 | */ |
morecat_lab | 0:6bf4ee8ee342 | 165 | void writeNum(int n); |
morecat_lab | 1:12daa491059c | 166 | |
morecat_lab | 1:12daa491059c | 167 | /** |
morecat_lab | 1:12daa491059c | 168 | * write a number to 2 dight LED |
morecat_lab | 1:12daa491059c | 169 | * |
morecat_lab | 3:77ec0c031053 | 170 | * @param n number |
morecat_lab | 1:12daa491059c | 171 | * |
morecat_lab | 1:12daa491059c | 172 | */ |
morecat_lab | 0:6bf4ee8ee342 | 173 | void writeNum2(int n); |
morecat_lab | 1:12daa491059c | 174 | |
morecat_lab | 1:12daa491059c | 175 | /** |
morecat_lab | 1:12daa491059c | 176 | * write a number to 4 dight LED |
morecat_lab | 1:12daa491059c | 177 | * |
morecat_lab | 3:77ec0c031053 | 178 | * @param n number |
morecat_lab | 1:12daa491059c | 179 | * |
morecat_lab | 1:12daa491059c | 180 | */ |
morecat_lab | 0:6bf4ee8ee342 | 181 | void writeNum4(int n); |
morecat_lab | 1:12daa491059c | 182 | |
morecat_lab | 1:12daa491059c | 183 | /** |
morecat_lab | 1:12daa491059c | 184 | * write a number to 8 dight LED |
morecat_lab | 1:12daa491059c | 185 | * |
morecat_lab | 1:12daa491059c | 186 | * @param number |
morecat_lab | 1:12daa491059c | 187 | * |
morecat_lab | 1:12daa491059c | 188 | */ |
morecat_lab | 0:6bf4ee8ee342 | 189 | void writeNum8(int n); |
morecat_lab | 1:12daa491059c | 190 | |
morecat_lab | 1:12daa491059c | 191 | /** |
morecat_lab | 1:12daa491059c | 192 | * write numbers to each dight of 2 dight LED |
morecat_lab | 1:12daa491059c | 193 | * |
morecat_lab | 1:12daa491059c | 194 | * @param d1 digit 1 number |
morecat_lab | 1:12daa491059c | 195 | * @param d2 digit 2 number |
morecat_lab | 1:12daa491059c | 196 | * |
morecat_lab | 1:12daa491059c | 197 | */ |
morecat_lab | 0:6bf4ee8ee342 | 198 | void writeNum(char d1, char d2); |
morecat_lab | 1:12daa491059c | 199 | |
morecat_lab | 1:12daa491059c | 200 | /** |
morecat_lab | 1:12daa491059c | 201 | * write numbers to each dight of 4 dight LED |
morecat_lab | 1:12daa491059c | 202 | * |
morecat_lab | 1:12daa491059c | 203 | * @param d1 digit 1 number |
morecat_lab | 1:12daa491059c | 204 | * @param d2 digit 2 number |
morecat_lab | 1:12daa491059c | 205 | * @param d3 digit 3 number |
morecat_lab | 1:12daa491059c | 206 | * @param d4 digit 4 number |
morecat_lab | 1:12daa491059c | 207 | * |
morecat_lab | 1:12daa491059c | 208 | */ |
morecat_lab | 0:6bf4ee8ee342 | 209 | void writeNum(char d1, char d2, char d3, char d4); |
morecat_lab | 1:12daa491059c | 210 | |
morecat_lab | 1:12daa491059c | 211 | /** |
morecat_lab | 1:12daa491059c | 212 | * write numbers to each dight of 8 dight LED |
morecat_lab | 1:12daa491059c | 213 | * |
morecat_lab | 1:12daa491059c | 214 | * @param d1 digit 1 number |
morecat_lab | 1:12daa491059c | 215 | * @param d2 digit 2 number |
morecat_lab | 1:12daa491059c | 216 | * @param d3 digit 3 number |
morecat_lab | 1:12daa491059c | 217 | * @param d4 digit 4 number |
morecat_lab | 1:12daa491059c | 218 | * @param d5 digit 5 number |
morecat_lab | 1:12daa491059c | 219 | * @param d6 digit 6 number |
morecat_lab | 1:12daa491059c | 220 | * @param d7 digit 7 number |
morecat_lab | 1:12daa491059c | 221 | * @param d8 digit 8 number |
morecat_lab | 1:12daa491059c | 222 | * |
morecat_lab | 1:12daa491059c | 223 | */ |
morecat_lab | 0:6bf4ee8ee342 | 224 | void writeNum(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8); |
morecat_lab | 1:12daa491059c | 225 | |
morecat_lab | 1:12daa491059c | 226 | /** |
morecat_lab | 1:12daa491059c | 227 | * zero supress: tell driver not to display 0 in the left |
morecat_lab | 1:12daa491059c | 228 | * |
morecat_lab | 1:12daa491059c | 229 | */ |
morecat_lab | 0:6bf4ee8ee342 | 230 | void supressZero(); |
morecat_lab | 1:12daa491059c | 231 | |
morecat_lab | 1:12daa491059c | 232 | /** |
morecat_lab | 1:12daa491059c | 233 | * control zero supress bit |
morecat_lab | 1:12daa491059c | 234 | * |
morecat_lab | 3:77ec0c031053 | 235 | * @param t, 1:supress on, 0:supress off |
morecat_lab | 1:12daa491059c | 236 | * |
morecat_lab | 1:12daa491059c | 237 | */ |
morecat_lab | 0:6bf4ee8ee342 | 238 | void setZeroSupress(bool t); |
morecat_lab | 1:12daa491059c | 239 | |
morecat_lab | 1:12daa491059c | 240 | /** |
morecat_lab | 1:12daa491059c | 241 | * write hex number to DISPLAY |
morecat_lab | 1:12daa491059c | 242 | * |
morecat_lab | 3:77ec0c031053 | 243 | * @param n number |
morecat_lab | 1:12daa491059c | 244 | * |
morecat_lab | 1:12daa491059c | 245 | */ |
morecat_lab | 0:6bf4ee8ee342 | 246 | void writeHex(int n); |
morecat_lab | 1:12daa491059c | 247 | |
morecat_lab | 1:12daa491059c | 248 | /** |
morecat_lab | 1:12daa491059c | 249 | * write hex number to DISPLAY |
morecat_lab | 1:12daa491059c | 250 | * |
morecat_lab | 3:77ec0c031053 | 251 | * @param n (long)number |
morecat_lab | 1:12daa491059c | 252 | * |
morecat_lab | 1:12daa491059c | 253 | */ |
morecat_lab | 0:6bf4ee8ee342 | 254 | void writeHex(long n); |
morecat_lab | 1:12daa491059c | 255 | |
morecat_lab | 1:12daa491059c | 256 | /** |
morecat_lab | 1:12daa491059c | 257 | * write patterns to each dight of 2 dight LED |
morecat_lab | 1:12daa491059c | 258 | * |
morecat_lab | 1:12daa491059c | 259 | * @param d1 digit 1 pattern |
morecat_lab | 1:12daa491059c | 260 | * @param d2 digit 2 pattern |
morecat_lab | 1:12daa491059c | 261 | * |
morecat_lab | 1:12daa491059c | 262 | */ |
morecat_lab | 0:6bf4ee8ee342 | 263 | void writeRawData(char d1, char d2); |
morecat_lab | 1:12daa491059c | 264 | |
morecat_lab | 1:12daa491059c | 265 | /** |
morecat_lab | 1:12daa491059c | 266 | * write patterns to each dight of 4 dight LED |
morecat_lab | 1:12daa491059c | 267 | * |
morecat_lab | 1:12daa491059c | 268 | * @param d1 digit 1 pattern |
morecat_lab | 1:12daa491059c | 269 | * @param d2 digit 2 pattern |
morecat_lab | 1:12daa491059c | 270 | * @param d3 digit 3 pattern |
morecat_lab | 1:12daa491059c | 271 | * @param d4 digit 4 pattern |
morecat_lab | 1:12daa491059c | 272 | * |
morecat_lab | 1:12daa491059c | 273 | */ |
morecat_lab | 0:6bf4ee8ee342 | 274 | void writeRawData(char d1, char d2, char d3, char d4); |
morecat_lab | 1:12daa491059c | 275 | |
morecat_lab | 1:12daa491059c | 276 | /** |
morecat_lab | 1:12daa491059c | 277 | * write patterns to each dight of 8 dight LED |
morecat_lab | 1:12daa491059c | 278 | * |
morecat_lab | 1:12daa491059c | 279 | * @param d1 digit 1 pattern |
morecat_lab | 1:12daa491059c | 280 | * @param d2 digit 2 pattern |
morecat_lab | 1:12daa491059c | 281 | * @param d3 digit 3 pattern |
morecat_lab | 1:12daa491059c | 282 | * @param d4 digit 4 pattern |
morecat_lab | 1:12daa491059c | 283 | * @param d5 digit 5 pattern |
morecat_lab | 1:12daa491059c | 284 | * @param d6 digit 6 pattern |
morecat_lab | 1:12daa491059c | 285 | * @param d7 digit 7 pattern |
morecat_lab | 1:12daa491059c | 286 | * @param d8 digit 8 pattern |
morecat_lab | 1:12daa491059c | 287 | * |
morecat_lab | 1:12daa491059c | 288 | */ |
morecat_lab | 0:6bf4ee8ee342 | 289 | void writeRawData(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8); |
morecat_lab | 1:12daa491059c | 290 | |
morecat_lab | 0:6bf4ee8ee342 | 291 | void write(uint8_t x, uint8_t y, uint8_t value); |
morecat_lab | 1:12daa491059c | 292 | |
morecat_lab | 1:12daa491059c | 293 | /** |
morecat_lab | 1:12daa491059c | 294 | * write patterns to a dight |
morecat_lab | 1:12daa491059c | 295 | * |
morecat_lab | 1:12daa491059c | 296 | * @param d digit |
morecat_lab | 4:858e42224b50 | 297 | * |
morecat_lab | 1:12daa491059c | 298 | * @param value pattern |
morecat_lab | 1:12daa491059c | 299 | * |
morecat_lab | 1:12daa491059c | 300 | */ |
morecat_lab | 1:12daa491059c | 301 | void write(uint8_t d, uint8_t value); |
morecat_lab | 0:6bf4ee8ee342 | 302 | void write(uint8_t y, const uint8_t values[], uint8_t size); |
morecat_lab | 1:12daa491059c | 303 | |
morecat_lab | 1:12daa491059c | 304 | /** |
morecat_lab | 1:12daa491059c | 305 | * Clear LED buffer |
morecat_lab | 1:12daa491059c | 306 | */ |
morecat_lab | 0:6bf4ee8ee342 | 307 | void clear(void); |
morecat_lab | 1:12daa491059c | 308 | |
morecat_lab | 1:12daa491059c | 309 | /** |
morecat_lab | 1:12daa491059c | 310 | * Turn off LED |
morecat_lab | 1:12daa491059c | 311 | */ |
morecat_lab | 0:6bf4ee8ee342 | 312 | void turnOff(void); |
morecat_lab | 1:12daa491059c | 313 | |
morecat_lab | 1:12daa491059c | 314 | /** |
morecat_lab | 1:12daa491059c | 315 | * Turn on LED |
morecat_lab | 1:12daa491059c | 316 | */ |
morecat_lab | 0:6bf4ee8ee342 | 317 | void turnOn(void); |
morecat_lab | 4:858e42224b50 | 318 | |
morecat_lab | 4:858e42224b50 | 319 | /** |
morecat_lab | 4:858e42224b50 | 320 | * Update One dight of LED |
morecat_lab | 4:858e42224b50 | 321 | */ |
morecat_lab | 0:6bf4ee8ee342 | 322 | void updateSeg(void); |
morecat_lab | 4:858e42224b50 | 323 | |
morecat_lab | 4:858e42224b50 | 324 | /** |
morecat_lab | 4:858e42224b50 | 325 | * Update LED (by internal clock) |
morecat_lab | 4:858e42224b50 | 326 | * |
morecat_lab | 4:858e42224b50 | 327 | * @returns sync = 1, if digit == 0 |
morecat_lab | 4:858e42224b50 | 328 | * |
morecat_lab | 4:858e42224b50 | 329 | */ |
morecat_lab | 0:6bf4ee8ee342 | 330 | bool update(void); |
morecat_lab | 4:858e42224b50 | 331 | |
morecat_lab | 4:858e42224b50 | 332 | /** |
morecat_lab | 4:858e42224b50 | 333 | * keep updating LED for specified period |
morecat_lab | 4:858e42224b50 | 334 | * |
morecat_lab | 4:858e42224b50 | 335 | * @param ms period (ms) |
morecat_lab | 4:858e42224b50 | 336 | * |
morecat_lab | 4:858e42224b50 | 337 | */ |
morecat_lab | 0:6bf4ee8ee342 | 338 | void updateWithDelay(int ms); |
morecat_lab | 4:858e42224b50 | 339 | |
morecat_lab | 4:858e42224b50 | 340 | /** |
morecat_lab | 4:858e42224b50 | 341 | * Update LED Once with 1ms delay |
morecat_lab | 4:858e42224b50 | 342 | */ |
morecat_lab | 4:858e42224b50 | 343 | void updateOnce(void); |
morecat_lab | 0:6bf4ee8ee342 | 344 | }; |
morecat_lab | 0:6bf4ee8ee342 | 345 | |
morecat_lab | 0:6bf4ee8ee342 | 346 | #endif // SSEG.h |