![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
demo versie 16/05
Dependencies: EthernetInterface mbed-rto mbed
Fork of ProjectVLC by
LEDDriver.h@12:1dc7dfe499fd, 2018-04-25 (annotated)
- Committer:
- albireo987
- Date:
- Wed Apr 25 09:27:31 2018 +0000
- Revision:
- 12:1dc7dfe499fd
- Parent:
- 10:7871aeacea08
prep multi thread driver;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
albireo987 | 2:36158325f7b0 | 1 | #ifndef LEDDRIVER_H |
albireo987 | 2:36158325f7b0 | 2 | #define LEDDRIVER_H |
albireo987 | 2:36158325f7b0 | 3 | |
albireo987 | 2:36158325f7b0 | 4 | #include "copy.h" |
albireo987 | 2:36158325f7b0 | 5 | #include "mbed.h" |
albireo987 | 2:36158325f7b0 | 6 | |
albireo987 | 2:36158325f7b0 | 7 | class LEDDriver |
albireo987 | 2:36158325f7b0 | 8 | { |
albireo987 | 2:36158325f7b0 | 9 | private: |
albireo987 | 8:a987e04734dd | 10 | |
albireo987 | 9:c800045806f0 | 11 | int* messageList; |
albireo987 | 9:c800045806f0 | 12 | int* codedMessage0; |
albireo987 | 9:c800045806f0 | 13 | int* codedMessage1; |
albireo987 | 9:c800045806f0 | 14 | int* codedMessage2; |
albireo987 | 9:c800045806f0 | 15 | int* codedMessage3; |
albireo987 | 9:c800045806f0 | 16 | int directions[8]; |
albireo987 | 2:36158325f7b0 | 17 | Copy copy; |
albireo987 | 2:36158325f7b0 | 18 | DigitalOut* leds; |
albireo987 | 2:36158325f7b0 | 19 | |
albireo987 | 10:7871aeacea08 | 20 | /** |
albireo987 | 10:7871aeacea08 | 21 | *methode om de richting van het kruispunt op te vragen |
albireo987 | 10:7871aeacea08 | 22 | *@params id of the led |
albireo987 | 10:7871aeacea08 | 23 | *@return int of the direction |
albireo987 | 10:7871aeacea08 | 24 | */ |
albireo987 | 2:36158325f7b0 | 25 | int getDirection(int id); |
albireo987 | 10:7871aeacea08 | 26 | |
albireo987 | 10:7871aeacea08 | 27 | /** |
albireo987 | 10:7871aeacea08 | 28 | *methode om de message van de led te bepalen |
albireo987 | 10:7871aeacea08 | 29 | *@params richting die de led moet zeggen |
albireo987 | 10:7871aeacea08 | 30 | *@params id of the led |
albireo987 | 10:7871aeacea08 | 31 | */ |
albireo987 | 10:7871aeacea08 | 32 | void determineMessage(int direction,int led); |
albireo987 | 10:7871aeacea08 | 33 | |
albireo987 | 10:7871aeacea08 | 34 | /** |
albireo987 | 10:7871aeacea08 | 35 | *mehode om alle messages van alle leds te bepalen |
albireo987 | 12:1dc7dfe499fd | 36 | *@params aantal leds |
albireo987 | 10:7871aeacea08 | 37 | */ |
albireo987 | 12:1dc7dfe499fd | 38 | void determineAll(int numberOfLeds); |
albireo987 | 2:36158325f7b0 | 39 | |
albireo987 | 10:7871aeacea08 | 40 | public: |
albireo987 | 10:7871aeacea08 | 41 | |
albireo987 | 10:7871aeacea08 | 42 | /** |
albireo987 | 10:7871aeacea08 | 43 | *methode om de mbed te doen wachten,nop |
albireo987 | 10:7871aeacea08 | 44 | *@params aantal microseconden te wachten |
albireo987 | 10:7871aeacea08 | 45 | */ |
albireo987 | 10:7871aeacea08 | 46 | void ownWait(uint32_t us); |
albireo987 | 12:1dc7dfe499fd | 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 | 2:36158325f7b0 | 52 | void drive(int numberOfLeds); |
albireo987 | 10:7871aeacea08 | 53 | |
albireo987 | 10:7871aeacea08 | 54 | /** |
albireo987 | 10:7871aeacea08 | 55 | *constructor voor een driver object |
albireo987 | 10:7871aeacea08 | 56 | *@params de int waarden die een richting aanduiden |
albireo987 | 10:7871aeacea08 | 57 | *@params het aantal waarden in de sharedDirection array |
albireo987 | 10:7871aeacea08 | 58 | */ |
albireo987 | 2:36158325f7b0 | 59 | LEDDriver(/*Mutex* lock,*/ int sharedDirections[], int sizeOfSharedDirections); |
albireo987 | 10:7871aeacea08 | 60 | /** |
albireo987 | 10:7871aeacea08 | 61 | *methode om de driver te gebruiken |
albireo987 | 10:7871aeacea08 | 62 | *@params aantal leds om te drive |
albireo987 | 10:7871aeacea08 | 63 | */ |
albireo987 | 2:36158325f7b0 | 64 | void run(int numberOfLeds); |
albireo987 | 2:36158325f7b0 | 65 | |
albireo987 | 2:36158325f7b0 | 66 | }; |
albireo987 | 2:36158325f7b0 | 67 | |
albireo987 | 2:36158325f7b0 | 68 | #endif |