-
Notifications
You must be signed in to change notification settings - Fork 1
/
DigitInterface.h
47 lines (45 loc) · 973 Bytes
/
DigitInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef DIGITALINTERFACE_H
#define DIGITALINTERFACE_H
#include "Digit.h"
#ifdef __linux__
#include <wiringPi.h>
#include <cassert> //Assert on Arduino makes no sense
#endif
#ifdef __AVR__
#include <Arduino.h>
#include <ArduinoSTL.h>
#endif
//C++ STL Libraries
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <cctype>
#include <bitset>
using namespace std;
class DigitInterface {
private:
//PCLK is Shift Register Clock
//PSTB is Data Register Clock
//PDAT is Serial Data
int PCLK,PSTB,PDAT;
static bool isInRange(char);
Digit digits[4];
int barFilled;
bool redLed;
public:
static string table;
DigitInterface(const int PCLK,const int PSTB,const int PDAT);
void setDigits(const string& str);
void setBars(int barFilled);
void setLed(bool redLed);
#ifdef __linux__
void display();
#endif
void write(bitset<40>& b);
bitset<40> getBits ();
void write();
void clear();
~DigitInterface();
};
#endif