Tamas Titusz Ban
/
ELEC1620_ExamTemplate_2019
Template for the ELEC1620 End of year exam
Diff: StreamOut/StreamOut.h
- Revision:
- 0:54721f063ac8
diff -r 000000000000 -r 54721f063ac8 StreamOut/StreamOut.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StreamOut/StreamOut.h Fri Mar 22 13:11:07 2019 +0000 @@ -0,0 +1,34 @@ +#ifndef LIB_STREAMOUT_H_ +#define LIB_STREAMOUT_H_ + +#include <mbed.h> +#include "Message.h" + +#define BUFFERSIZE 1024 + +class StreamOut{ +public: + //StreamOut(PinName clk, PinName data, PinName latch); + StreamOut(); + ~StreamOut(); + void init(); + void lock(); + void unlock(); + void writeMessage(char code, unsigned int data); + void sendMessages(); + +private: + static DigitalOut *_clk; + static DigitalOut *_latch; + static DigitalOut *_data; + + static int _index; + static int _locked; + static Message _buffer[BUFFERSIZE]; + + void sendMessage(Message msg); + +}; + +#endif +