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: SevenSegmentDisplay.h
- Revision:
- 0:9378fe6db796
- Child:
- 1:f7a9e4c8ece6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SevenSegmentDisplay.h Thu Dec 11 08:01:43 2014 +0000 @@ -0,0 +1,39 @@ +/******************************************************************************** +@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 + +#include "mbed.h" + +enum ConnectionMode {CommonAnode, CommonCathode}; + +class SevenSegmentDisplay { +public: + SevenSegmentDisplay(PinName a, + PinName b, + PinName c, + PinName d, + PinName e, + PinName f, + PinName g, + PinName dp, + ConnectionMode cm = CommonAnode); + void init(); + void print(char); +private: + BusInOut display; + ConnectionMode mode; + void turnOn(int); +}; + +#endif \ No newline at end of file