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.
Diff: FourDigitLED.h
- Revision:
- 1:c94aa39af4c7
- Parent:
- 0:7a8925d2a8e7
- Child:
- 2:c4e8b2fd8f7e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/FourDigitLED.h Fri Jun 26 08:01:58 2015 +0000
@@ -0,0 +1,36 @@
+#ifndef SEVENSEG_4LED_H
+#define SEVENSEG_4LED_H
+
+#define DIGITS 4
+#define MASK_VALUE 0x7f
+#define MASK_DOT 0x80
+#define MASK_DIGIT 0x300
+
+typedef struct {
+ unsigned char val[DIGITS] ;
+} SegmentValue ;
+
+class FourDigitLED {
+public:
+ FourDigitLED (
+ PinName seg0, PinName seg1, PinName seg2, PinName seg3,
+ PinName seg4, PinName seg5, PinName seg6, PinName dot,
+ PinName digit0, PinName digit1, PinName digit2, PinName digit3
+);
+ ~FourDigitLED();
+ bool attach(SegmentValue *v) ;
+ void start(void) ;
+ unsigned int setPtn(int d, unsigned int ptn) ;
+ int setNum(int d, int n) ;
+ int setDot(int d, bool n) ;
+ void test(int n) ;
+ void dump(void) ;
+private:
+ void Scan(void) ;
+ BusOut *LEDs ;
+ unsigned char val[DIGITS] ;
+ Ticker Scan_tick ;
+ int scan_digit ;
+} ;
+
+#endif