TVZ Mechatronics Team / SevenSegmentDisplay

SevenSegmentDisplay.h

Committer:
tbjazic
Date:
2014-12-11
Revision:
2:1c0018e87bd5
Parent:
1:f7a9e4c8ece6
Child:
3:9c9257dda979

File content as of revision 2:1c0018e87bd5:

/**
 * @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