Template for the ELEC1620 End of year exam

Dependencies:   mbed

Committer:
el16ttb
Date:
Fri Mar 22 13:11:07 2019 +0000
Revision:
0:54721f063ac8
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el16ttb 0:54721f063ac8 1 #ifndef LIB_STREAMOUT_H_
el16ttb 0:54721f063ac8 2 #define LIB_STREAMOUT_H_
el16ttb 0:54721f063ac8 3
el16ttb 0:54721f063ac8 4 #include <mbed.h>
el16ttb 0:54721f063ac8 5 #include "Message.h"
el16ttb 0:54721f063ac8 6
el16ttb 0:54721f063ac8 7 #define BUFFERSIZE 1024
el16ttb 0:54721f063ac8 8
el16ttb 0:54721f063ac8 9 class StreamOut{
el16ttb 0:54721f063ac8 10 public:
el16ttb 0:54721f063ac8 11 //StreamOut(PinName clk, PinName data, PinName latch);
el16ttb 0:54721f063ac8 12 StreamOut();
el16ttb 0:54721f063ac8 13 ~StreamOut();
el16ttb 0:54721f063ac8 14 void init();
el16ttb 0:54721f063ac8 15 void lock();
el16ttb 0:54721f063ac8 16 void unlock();
el16ttb 0:54721f063ac8 17 void writeMessage(char code, unsigned int data);
el16ttb 0:54721f063ac8 18 void sendMessages();
el16ttb 0:54721f063ac8 19
el16ttb 0:54721f063ac8 20 private:
el16ttb 0:54721f063ac8 21 static DigitalOut *_clk;
el16ttb 0:54721f063ac8 22 static DigitalOut *_latch;
el16ttb 0:54721f063ac8 23 static DigitalOut *_data;
el16ttb 0:54721f063ac8 24
el16ttb 0:54721f063ac8 25 static int _index;
el16ttb 0:54721f063ac8 26 static int _locked;
el16ttb 0:54721f063ac8 27 static Message _buffer[BUFFERSIZE];
el16ttb 0:54721f063ac8 28
el16ttb 0:54721f063ac8 29 void sendMessage(Message msg);
el16ttb 0:54721f063ac8 30
el16ttb 0:54721f063ac8 31 };
el16ttb 0:54721f063ac8 32
el16ttb 0:54721f063ac8 33 #endif
el16ttb 0:54721f063ac8 34