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.
Revision 4:21f0a3289449, committed 2014-12-11
- Comitter:
- tbjazic
- Date:
- Thu Dec 11 09:45:08 2014 +0000
- Parent:
- 3:9c9257dda979
- Commit message:
- Documentation up.
Changed in this revision
SevenSegmentDisplay.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SevenSegmentDisplay.h Thu Dec 11 08:23:01 2014 +0000 +++ b/SevenSegmentDisplay.h Thu Dec 11 09:45:08 2014 +0000 @@ -1,12 +1,3 @@ -/** Seven segment display class - * @author Toni Bjazic - * @section LICENSE - * Creative Commons CC BY-SA - * @section DESCRIPTION - * A class for controling the output of 7-segment displays (common anode or common - * cathode). - */ - #ifndef SEVEN_SEGMENT_DISPLAY_H_KEY #define SEVEN_SEGMENT_DISPLAY_H_KEY @@ -14,8 +5,36 @@ enum ConnectionMode {CommonAnode, CommonCathode}; +/** A class for controling the output of 7-segment displays connected in + * common anode or common cathode mode. + * + * Author: Toni Bjazic, TVZ Mechatronics Team + * + * Example of use: + * @code + * #include "mbed.h" + * #include "SevenSegmentDisplay.h" + * + * Serial pc(USBTX, USBRX); + * + * int main() { + * SevenSegmentDisplay display(p5, p6, p7, p8, p9, p10, p11, p12, CommonCathode); + * char c; + * while(1) { + * pc.printf("\n\rEnter character to show on 7-segment display: "); + * pc.scanf("%c", &c); + * display.print(c); + * wait(0.2); + * } + * } + * @endcode + */ class SevenSegmentDisplay { public: + /** Constructor receives pins on which the segments a, b, c, d, e, f, g and dp + * are connected (respectively). Last (9th) argument is connection mode (CommonAnode + * or CommonCathode), and defaults to CommonAnode. + */ SevenSegmentDisplay(PinName a, PinName b, PinName c, @@ -24,8 +43,14 @@ PinName f, PinName g, PinName dp, - ConnectionMode cm = CommonAnode); + ConnectionMode = CommonAnode); + + /** Member function which initializes the display. + */ void init(); + + /** Member function which prints the character on the 7-segment display. + */ void print(char); private: BusInOut display;