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
- Committer:
- takashikojo
- Date:
- 2015-06-26
- Revision:
- 1:c94aa39af4c7
- Parent:
- 7segment4LED.h@ 0:7a8925d2a8e7
- Child:
- 2:c4e8b2fd8f7e
File content as of revision 1:c94aa39af4c7:
#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