Simple library for controll a matrix of 7 segment displays. It also support the Hexadecimal and the Decimal visualisation.
Revision 1:4ee2f3c3cf46, committed 2011-04-23
- Comitter:
- trombettamichele
- Date:
- Sat Apr 23 10:30:51 2011 +0000
- Parent:
- 0:9db0be7962dd
- Commit message:
Changed in this revision
Multi7Seg.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9db0be7962dd -r 4ee2f3c3cf46 Multi7Seg.h --- a/Multi7Seg.h Sat Apr 23 10:17:01 2011 +0000 +++ b/Multi7Seg.h Sat Apr 23 10:30:51 2011 +0000 @@ -1,18 +1,23 @@ #include "mbed.h" -#define format_DEC 1 -#define format_HEX 0 // Simple library that can controll a matrix of 7 segment led displays // Created by Michele Trombetta // Copyright 2010 5OFT. All rights reserved. -#ifdef led_ANODE -#else - //Chars: 0123456789AbCdEF - const unsigned char num_7seg[24] = {0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x7, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00}; - #define led_ANODE 0 - #define led_CATHODE 1 +#ifndef led_ANODE +#define led_ANODE 0 +#define led_CATHODE 1 #endif +#ifndef VAR_num_7seg +#define VAR_num_7seg +//Chars: 0123456789AbCdEF +const unsigned char num_7seg[24] = {0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x7, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00}; +#endif + +#ifndef LIB_Multi7Seg +#define LIB_Multi7Seg +#define format_DEC 1 +#define format_HEX 0 class Multi7Seg { public: Multi7Seg(PinName a, PinName b, PinName c, PinName d, PinName e, PinName f, PinName g, PinName disp1, PinName disp2, bool led_type); @@ -31,4 +36,5 @@ float _speed; unsigned int _num1, _num2, _num3, _num4, _num5; void led_write(unsigned char number); -}; \ No newline at end of file +}; +#endif \ No newline at end of file