![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
LEDDriver.h@38:47c075a354b5, 2018-05-02 (annotated)
- Committer:
- albireo987
- Date:
- Wed May 02 12:44:26 2018 +0000
- Revision:
- 38:47c075a354b5
- Parent:
- 32:537005b4a065
- Child:
- 44:ffac07bff0d8
- Child:
- 64:179591b10b44
ticker werkend ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
albireo987 | 6:36158325f7b0 | 1 | #ifndef LEDDRIVER_H |
albireo987 | 6:36158325f7b0 | 2 | #define LEDDRIVER_H |
albireo987 | 6:36158325f7b0 | 3 | |
albireo987 | 6:36158325f7b0 | 4 | #include "copy.h" |
albireo987 | 6:36158325f7b0 | 5 | #include "mbed.h" |
albireo987 | 26:4c673da1a3ae | 6 | #include "rtos.h" |
albireo987 | 6:36158325f7b0 | 7 | |
albireo987 | 6:36158325f7b0 | 8 | class LEDDriver |
albireo987 | 6:36158325f7b0 | 9 | { |
albireo987 | 6:36158325f7b0 | 10 | private: |
albireo987 | 8:a987e04734dd | 11 | |
albireo987 | 9:c800045806f0 | 12 | int* messageList; |
albireo987 | 9:c800045806f0 | 13 | int* codedMessage0; |
albireo987 | 9:c800045806f0 | 14 | int* codedMessage1; |
albireo987 | 9:c800045806f0 | 15 | int* codedMessage2; |
albireo987 | 9:c800045806f0 | 16 | int* codedMessage3; |
albireo987 | 9:c800045806f0 | 17 | int directions[8]; |
albireo987 | 26:4c673da1a3ae | 18 | Queue<int,8>* queue; |
albireo987 | 6:36158325f7b0 | 19 | DigitalOut* leds; |
albireo987 | 6:36158325f7b0 | 20 | |
albireo987 | 26:4c673da1a3ae | 21 | /**prep for eventual multithreading |
albireo987 | 26:4c673da1a3ae | 22 | *methode om nieuwe richtingen van de receiver klasse te ontvangen |
albireo987 | 26:4c673da1a3ae | 23 | *@params aantal leds die een nieuw bericht moeten krijgen |
albireo987 | 32:537005b4a065 | 24 | *@params int die aanduid of de eerste helft van de leds gepolled moeten worden of de tweede |
albireo987 | 26:4c673da1a3ae | 25 | */ |
albireo987 | 27:29948b116e82 | 26 | void poll(int numberOfLeds, int first); |
albireo987 | 38:47c075a354b5 | 27 | |
albireo987 | 38:47c075a354b5 | 28 | /** |
albireo987 | 38:47c075a354b5 | 29 | *callback methode voor de ticker |
albireo987 | 38:47c075a354b5 | 30 | *@params de led om aan te sturen |
albireo987 | 38:47c075a354b5 | 31 | */ |
albireo987 | 38:47c075a354b5 | 32 | void sendData(); |
albireo987 | 6:36158325f7b0 | 33 | |
albireo987 | 10:7871aeacea08 | 34 | public: |
albireo987 | 10:7871aeacea08 | 35 | |
albireo987 | 10:7871aeacea08 | 36 | /** |
albireo987 | 32:537005b4a065 | 37 | *methode om de mbed te doen wachten,nop gebaseerd |
albireo987 | 10:7871aeacea08 | 38 | *@params aantal microseconden te wachten |
albireo987 | 10:7871aeacea08 | 39 | */ |
albireo987 | 10:7871aeacea08 | 40 | void ownWait(uint32_t us); |
albireo987 | 10:7871aeacea08 | 41 | |
albireo987 | 10:7871aeacea08 | 42 | |
albireo987 | 6:36158325f7b0 | 43 | |
albireo987 | 10:7871aeacea08 | 44 | /** |
albireo987 | 10:7871aeacea08 | 45 | *methode dat alle leds aanstuurt |
albireo987 | 10:7871aeacea08 | 46 | *@params aantal leds aan te sturen |
albireo987 | 10:7871aeacea08 | 47 | */ |
albireo987 | 6:36158325f7b0 | 48 | void drive(int numberOfLeds); |
albireo987 | 10:7871aeacea08 | 49 | |
albireo987 | 10:7871aeacea08 | 50 | /** |
albireo987 | 10:7871aeacea08 | 51 | *constructor voor een driver object |
albireo987 | 32:537005b4a065 | 52 | *@params de queue met de waarden die een richting aanduiden |
albireo987 | 10:7871aeacea08 | 53 | */ |
albireo987 | 26:4c673da1a3ae | 54 | LEDDriver(Queue<int,8>* queue); |
albireo987 | 10:7871aeacea08 | 55 | /** |
albireo987 | 32:537005b4a065 | 56 | *methode om de driver |
albireo987 | 32:537005b4a065 | 57 | *@params aantal leds om te driven |
albireo987 | 10:7871aeacea08 | 58 | */ |
albireo987 | 6:36158325f7b0 | 59 | void run(int numberOfLeds); |
albireo987 | 6:36158325f7b0 | 60 | |
albireo987 | 6:36158325f7b0 | 61 | }; |
albireo987 | 6:36158325f7b0 | 62 | |
albireo987 | 6:36158325f7b0 | 63 | #endif |