Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FourDigitLED.h@1:c94aa39af4c7, 2015-06-26 (annotated)
- Committer:
- takashikojo
- Date:
- Fri Jun 26 08:01:58 2015 +0000
- Revision:
- 1:c94aa39af4c7
- Parent:
- 7segment4LED.h@0:7a8925d2a8e7
- Child:
- 2:c4e8b2fd8f7e
turn off LED mode to setNum
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| takashikojo | 0:7a8925d2a8e7 | 1 | #ifndef SEVENSEG_4LED_H |
| takashikojo | 0:7a8925d2a8e7 | 2 | #define SEVENSEG_4LED_H |
| takashikojo | 0:7a8925d2a8e7 | 3 | |
| takashikojo | 0:7a8925d2a8e7 | 4 | #define DIGITS 4 |
| takashikojo | 0:7a8925d2a8e7 | 5 | #define MASK_VALUE 0x7f |
| takashikojo | 0:7a8925d2a8e7 | 6 | #define MASK_DOT 0x80 |
| takashikojo | 0:7a8925d2a8e7 | 7 | #define MASK_DIGIT 0x300 |
| takashikojo | 0:7a8925d2a8e7 | 8 | |
| takashikojo | 0:7a8925d2a8e7 | 9 | typedef struct { |
| takashikojo | 0:7a8925d2a8e7 | 10 | unsigned char val[DIGITS] ; |
| takashikojo | 0:7a8925d2a8e7 | 11 | } SegmentValue ; |
| takashikojo | 0:7a8925d2a8e7 | 12 | |
| takashikojo | 0:7a8925d2a8e7 | 13 | class FourDigitLED { |
| takashikojo | 0:7a8925d2a8e7 | 14 | public: |
| takashikojo | 0:7a8925d2a8e7 | 15 | FourDigitLED ( |
| takashikojo | 0:7a8925d2a8e7 | 16 | PinName seg0, PinName seg1, PinName seg2, PinName seg3, |
| takashikojo | 0:7a8925d2a8e7 | 17 | PinName seg4, PinName seg5, PinName seg6, PinName dot, |
| takashikojo | 0:7a8925d2a8e7 | 18 | PinName digit0, PinName digit1, PinName digit2, PinName digit3 |
| takashikojo | 0:7a8925d2a8e7 | 19 | ); |
| takashikojo | 0:7a8925d2a8e7 | 20 | ~FourDigitLED(); |
| takashikojo | 0:7a8925d2a8e7 | 21 | bool attach(SegmentValue *v) ; |
| takashikojo | 0:7a8925d2a8e7 | 22 | void start(void) ; |
| takashikojo | 1:c94aa39af4c7 | 23 | unsigned int setPtn(int d, unsigned int ptn) ; |
| takashikojo | 0:7a8925d2a8e7 | 24 | int setNum(int d, int n) ; |
| takashikojo | 0:7a8925d2a8e7 | 25 | int setDot(int d, bool n) ; |
| takashikojo | 0:7a8925d2a8e7 | 26 | void test(int n) ; |
| takashikojo | 0:7a8925d2a8e7 | 27 | void dump(void) ; |
| takashikojo | 0:7a8925d2a8e7 | 28 | private: |
| takashikojo | 0:7a8925d2a8e7 | 29 | void Scan(void) ; |
| takashikojo | 0:7a8925d2a8e7 | 30 | BusOut *LEDs ; |
| takashikojo | 0:7a8925d2a8e7 | 31 | unsigned char val[DIGITS] ; |
| takashikojo | 0:7a8925d2a8e7 | 32 | Ticker Scan_tick ; |
| takashikojo | 0:7a8925d2a8e7 | 33 | int scan_digit ; |
| takashikojo | 0:7a8925d2a8e7 | 34 | } ; |
| takashikojo | 0:7a8925d2a8e7 | 35 | |
| takashikojo | 0:7a8925d2a8e7 | 36 | #endif |