![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
demo versie 16/05
Dependencies: EthernetInterface mbed-rto mbed
Fork of ProjectVLC by
LEDDriver.h@8:a987e04734dd, 2018-04-15 (annotated)
- Committer:
- albireo987
- Date:
- Sun Apr 15 19:37:01 2018 +0000
- Revision:
- 8:a987e04734dd
- Parent:
- 2:36158325f7b0
- Child:
- 9:c800045806f0
corrected encoding;
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 "rtos.h" |
albireo987 | 2:36158325f7b0 | 5 | #include "copy.h" |
albireo987 | 2:36158325f7b0 | 6 | #include "mbed.h" |
albireo987 | 2:36158325f7b0 | 7 | |
albireo987 | 2:36158325f7b0 | 8 | class LEDDriver |
albireo987 | 2:36158325f7b0 | 9 | { |
albireo987 | 2:36158325f7b0 | 10 | private: |
albireo987 | 8:a987e04734dd | 11 | |
albireo987 | 2:36158325f7b0 | 12 | int** messageList; |
albireo987 | 2:36158325f7b0 | 13 | int* start; |
albireo987 | 2:36158325f7b0 | 14 | int* stop; |
albireo987 | 2:36158325f7b0 | 15 | int* directions; |
albireo987 | 2:36158325f7b0 | 16 | Mutex* lock; |
albireo987 | 2:36158325f7b0 | 17 | Copy copy; |
albireo987 | 2:36158325f7b0 | 18 | DigitalOut* leds; |
albireo987 | 2:36158325f7b0 | 19 | |
albireo987 | 8:a987e04734dd | 20 | /** |
albireo987 | 8:a987e04734dd | 21 | *method that returns the direction stored in the private direction array |
albireo987 | 8:a987e04734dd | 22 | *@params the id of the led that you want the direction of |
albireo987 | 8:a987e04734dd | 23 | *@return the direction for the specified led |
albireo987 | 8:a987e04734dd | 24 | */ |
albireo987 | 2:36158325f7b0 | 25 | int getDirection(int id); |
albireo987 | 8:a987e04734dd | 26 | |
albireo987 | 8:a987e04734dd | 27 | /** |
albireo987 | 8:a987e04734dd | 28 | *method that encodes the direction to the message for the specified led |
albireo987 | 8:a987e04734dd | 29 | *@params the direction to encode into the message |
albireo987 | 8:a987e04734dd | 30 | *@params the led you want to encode the message for |
albireo987 | 8:a987e04734dd | 31 | */ |
albireo987 | 2:36158325f7b0 | 32 | void encode(int direction,int led); |
albireo987 | 8:a987e04734dd | 33 | |
albireo987 | 8:a987e04734dd | 34 | /** |
albireo987 | 8:a987e04734dd | 35 | *method that encodes the messages for the specified number of leds |
albireo987 | 8:a987e04734dd | 36 | *@params the number of leds to encode the message for |
albireo987 | 8:a987e04734dd | 37 | */ |
albireo987 | 2:36158325f7b0 | 38 | void encodeAll(int numberOfLeds); |
albireo987 | 2:36158325f7b0 | 39 | |
albireo987 | 2:36158325f7b0 | 40 | public: |
albireo987 | 2:36158325f7b0 | 41 | |
albireo987 | 8:a987e04734dd | 42 | /** |
albireo987 | 8:a987e04734dd | 43 | *method to drive the leds |
albireo987 | 8:a987e04734dd | 44 | *@params the number of leds |
albireo987 | 8:a987e04734dd | 45 | */ |
albireo987 | 2:36158325f7b0 | 46 | void drive(int numberOfLeds); |
albireo987 | 8:a987e04734dd | 47 | |
albireo987 | 8:a987e04734dd | 48 | /** |
albireo987 | 8:a987e04734dd | 49 | *method that copies the array for the specified records in another array |
albireo987 | 8:a987e04734dd | 50 | *@params the array that has the shared array with directions |
albireo987 | 8:a987e04734dd | 51 | *@params the number of directions |
albireo987 | 8:a987e04734dd | 52 | */ |
albireo987 | 2:36158325f7b0 | 53 | LEDDriver(/*Mutex* lock,*/ int sharedDirections[], int sizeOfSharedDirections); |
albireo987 | 8:a987e04734dd | 54 | |
albireo987 | 8:a987e04734dd | 55 | /** |
albireo987 | 8:a987e04734dd | 56 | *method that is prepared to run |
albireo987 | 8:a987e04734dd | 57 | *@params the number of leds to run |
albireo987 | 8:a987e04734dd | 58 | */ |
albireo987 | 2:36158325f7b0 | 59 | void run(int numberOfLeds); |
albireo987 | 2:36158325f7b0 | 60 | |
albireo987 | 2:36158325f7b0 | 61 | }; |
albireo987 | 2:36158325f7b0 | 62 | |
albireo987 | 2:36158325f7b0 | 63 | #endif |