![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
LEDDriver.h@48:c5cd73d93045, 2018-05-09 (annotated)
- Committer:
- KlaasGovaerts
- Date:
- Wed May 09 10:08:32 2018 +0000
- Revision:
- 48:c5cd73d93045
- Parent:
- 47:8fe84f455571
- Child:
- 50:dfcd7bd87114
- Child:
- 54:4274186bf584
Backup
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 | |
KlaasGovaerts | 47:8fe84f455571 | 12 | int messageList[8]; |
KlaasGovaerts | 45:2d877f01ca7b | 13 | int codedMessage0[20]; |
KlaasGovaerts | 45:2d877f01ca7b | 14 | int codedMessage1[20]; |
KlaasGovaerts | 45:2d877f01ca7b | 15 | int codedMessage2[20]; |
KlaasGovaerts | 45:2d877f01ca7b | 16 | int codedMessage3[20]; |
KlaasGovaerts | 45:2d877f01ca7b | 17 | int codedMessage4[20]; |
albireo987 | 9:c800045806f0 | 18 | int directions[8]; |
albireo987 | 26:4c673da1a3ae | 19 | Queue<int,8>* queue; |
KlaasGovaerts | 48:c5cd73d93045 | 20 | DigitalOut *leds[8]; |
KlaasGovaerts | 45:2d877f01ca7b | 21 | int currentLocation; |
albireo987 | 6:36158325f7b0 | 22 | |
albireo987 | 26:4c673da1a3ae | 23 | /**prep for eventual multithreading |
albireo987 | 26:4c673da1a3ae | 24 | *methode om nieuwe richtingen van de receiver klasse te ontvangen |
albireo987 | 26:4c673da1a3ae | 25 | *@params aantal leds die een nieuw bericht moeten krijgen |
albireo987 | 32:537005b4a065 | 26 | *@params int die aanduid of de eerste helft van de leds gepolled moeten worden of de tweede |
albireo987 | 26:4c673da1a3ae | 27 | */ |
albireo987 | 27:29948b116e82 | 28 | void poll(int numberOfLeds, int first); |
albireo987 | 38:47c075a354b5 | 29 | |
albireo987 | 38:47c075a354b5 | 30 | /** |
albireo987 | 38:47c075a354b5 | 31 | *callback methode voor de ticker |
albireo987 | 38:47c075a354b5 | 32 | *@params de led om aan te sturen |
albireo987 | 38:47c075a354b5 | 33 | */ |
albireo987 | 38:47c075a354b5 | 34 | void sendData(); |
albireo987 | 6:36158325f7b0 | 35 | |
KlaasGovaerts | 45:2d877f01ca7b | 36 | void setLEDS(int j); |
KlaasGovaerts | 45:2d877f01ca7b | 37 | |
albireo987 | 10:7871aeacea08 | 38 | public: |
albireo987 | 10:7871aeacea08 | 39 | |
albireo987 | 10:7871aeacea08 | 40 | /** |
albireo987 | 32:537005b4a065 | 41 | *methode om de mbed te doen wachten,nop gebaseerd |
albireo987 | 10:7871aeacea08 | 42 | *@params aantal microseconden te wachten |
albireo987 | 10:7871aeacea08 | 43 | */ |
albireo987 | 10:7871aeacea08 | 44 | void ownWait(uint32_t us); |
albireo987 | 10:7871aeacea08 | 45 | |
albireo987 | 10:7871aeacea08 | 46 | |
albireo987 | 6:36158325f7b0 | 47 | |
albireo987 | 10:7871aeacea08 | 48 | /** |
albireo987 | 10:7871aeacea08 | 49 | *methode dat alle leds aanstuurt |
albireo987 | 10:7871aeacea08 | 50 | *@params aantal leds aan te sturen |
albireo987 | 10:7871aeacea08 | 51 | */ |
albireo987 | 6:36158325f7b0 | 52 | void drive(int numberOfLeds); |
albireo987 | 10:7871aeacea08 | 53 | |
albireo987 | 10:7871aeacea08 | 54 | /** |
albireo987 | 10:7871aeacea08 | 55 | *constructor voor een driver object |
albireo987 | 32:537005b4a065 | 56 | *@params de queue met de waarden die een richting aanduiden |
albireo987 | 10:7871aeacea08 | 57 | */ |
albireo987 | 26:4c673da1a3ae | 58 | LEDDriver(Queue<int,8>* queue); |
albireo987 | 10:7871aeacea08 | 59 | /** |
albireo987 | 32:537005b4a065 | 60 | *methode om de driver |
albireo987 | 10:7871aeacea08 | 61 | */ |
KlaasGovaerts | 44:ffac07bff0d8 | 62 | void run(Ticker* ticker); |
KlaasGovaerts | 44:ffac07bff0d8 | 63 | |
KlaasGovaerts | 44:ffac07bff0d8 | 64 | void drive8leds(); |
albireo987 | 6:36158325f7b0 | 65 | |
KlaasGovaerts | 45:2d877f01ca7b | 66 | void initArrays(); |
KlaasGovaerts | 45:2d877f01ca7b | 67 | }; |
albireo987 | 6:36158325f7b0 | 68 | |
albireo987 | 6:36158325f7b0 | 69 | #endif |