temp

Committer:
BenRJG
Date:
Thu Dec 06 15:38:09 2018 +0000
Revision:
0:2a4af0cb6e8d
Imported Code from Kiel; Added button functionality; Added set DateTime Functionality

Who changed what in which revision?

UserRevisionLine numberNew contents of line
BenRJG 0:2a4af0cb6e8d 1 #include "mbed.h"
BenRJG 0:2a4af0cb6e8d 2 #include "General.hpp"
BenRJG 0:2a4af0cb6e8d 3
BenRJG 0:2a4af0cb6e8d 4 // Class BUTTON polls a button for detection of edge
BenRJG 0:2a4af0cb6e8d 5 class BUTTON {
BenRJG 0:2a4af0cb6e8d 6 public:
BenRJG 0:2a4af0cb6e8d 7 BUTTON(PinName pin) : IN(pin){state = FALLEN;}
BenRJG 0:2a4af0cb6e8d 8 BYTE poll(void);
BenRJG 0:2a4af0cb6e8d 9 BYTE rise(void);
BenRJG 0:2a4af0cb6e8d 10 //BYTE fall(void);
BenRJG 0:2a4af0cb6e8d 11 private:
BenRJG 0:2a4af0cb6e8d 12 enum State {FALLEN, RISING, RISEN, FALLING};
BenRJG 0:2a4af0cb6e8d 13 State state;
BenRJG 0:2a4af0cb6e8d 14 DigitalIn IN;
BenRJG 0:2a4af0cb6e8d 15 INT_16 OUTPUT; //Output is 1 if button is rising and 2 if button is falling
BenRJG 0:2a4af0cb6e8d 16 Timer timer;
BenRJG 0:2a4af0cb6e8d 17 };
BenRJG 0:2a4af0cb6e8d 18