First version
Dependencies: mbed EthernetInterface mbed-rto
LEDDriver.h@10:7871aeacea08, 2018-04-25 (annotated)
- Committer:
- albireo987
- Date:
- Wed Apr 25 07:22:18 2018 +0000
- Revision:
- 10:7871aeacea08
- Parent:
- 9:c800045806f0
- Child:
- 25:1dc7dfe499fd
- Child:
- 26:4c673da1a3ae
driver 7kHz
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 | 6:36158325f7b0 | 6 | |
albireo987 | 6:36158325f7b0 | 7 | class LEDDriver |
albireo987 | 6:36158325f7b0 | 8 | { |
albireo987 | 6: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 | 9:c800045806f0 | 17 | //Mutex* lock; |
albireo987 | 6:36158325f7b0 | 18 | Copy copy; |
albireo987 | 6:36158325f7b0 | 19 | DigitalOut* leds; |
albireo987 | 6:36158325f7b0 | 20 | |
albireo987 | 10:7871aeacea08 | 21 | /** |
albireo987 | 10:7871aeacea08 | 22 | *methode om de richting van het kruispunt op te vragen |
albireo987 | 10:7871aeacea08 | 23 | *@params id of the led |
albireo987 | 10:7871aeacea08 | 24 | *@return int of the direction |
albireo987 | 10:7871aeacea08 | 25 | */ |
albireo987 | 6:36158325f7b0 | 26 | int getDirection(int id); |
albireo987 | 10:7871aeacea08 | 27 | |
albireo987 | 10:7871aeacea08 | 28 | /** |
albireo987 | 10:7871aeacea08 | 29 | *methode om de message van de led te bepalen |
albireo987 | 10:7871aeacea08 | 30 | *@params richting die de led moet zeggen |
albireo987 | 10:7871aeacea08 | 31 | *@params id of the led |
albireo987 | 10:7871aeacea08 | 32 | */ |
albireo987 | 10:7871aeacea08 | 33 | void determineMessage(int direction,int led); |
albireo987 | 10:7871aeacea08 | 34 | |
albireo987 | 10:7871aeacea08 | 35 | /** |
albireo987 | 10:7871aeacea08 | 36 | *mehode om alle messages van alle leds te bepalen |
albireo987 | 10:7871aeacea08 | 37 | *@params aantal led |
albireo987 | 10:7871aeacea08 | 38 | */ |
albireo987 | 6:36158325f7b0 | 39 | void encodeAll(int numberOfLeds); |
albireo987 | 6:36158325f7b0 | 40 | |
albireo987 | 10:7871aeacea08 | 41 | public: |
albireo987 | 10:7871aeacea08 | 42 | |
albireo987 | 10:7871aeacea08 | 43 | /** |
albireo987 | 10:7871aeacea08 | 44 | *methode om de mbed te doen wachten,nop |
albireo987 | 10:7871aeacea08 | 45 | *@params aantal microseconden te wachten |
albireo987 | 10:7871aeacea08 | 46 | */ |
albireo987 | 10:7871aeacea08 | 47 | void ownWait(uint32_t us); |
albireo987 | 10:7871aeacea08 | 48 | |
albireo987 | 10:7871aeacea08 | 49 | |
albireo987 | 6:36158325f7b0 | 50 | |
albireo987 | 10:7871aeacea08 | 51 | /** |
albireo987 | 10:7871aeacea08 | 52 | *methode dat alle leds aanstuurt |
albireo987 | 10:7871aeacea08 | 53 | *@params aantal leds aan te sturen |
albireo987 | 10:7871aeacea08 | 54 | */ |
albireo987 | 6:36158325f7b0 | 55 | void drive(int numberOfLeds); |
albireo987 | 10:7871aeacea08 | 56 | |
albireo987 | 10:7871aeacea08 | 57 | /** |
albireo987 | 10:7871aeacea08 | 58 | *constructor voor een driver object |
albireo987 | 10:7871aeacea08 | 59 | *@params de int waarden die een richting aanduiden |
albireo987 | 10:7871aeacea08 | 60 | *@params het aantal waarden in de sharedDirection array |
albireo987 | 10:7871aeacea08 | 61 | */ |
albireo987 | 6:36158325f7b0 | 62 | LEDDriver(/*Mutex* lock,*/ int sharedDirections[], int sizeOfSharedDirections); |
albireo987 | 10:7871aeacea08 | 63 | /** |
albireo987 | 10:7871aeacea08 | 64 | *methode om de driver te gebruiken |
albireo987 | 10:7871aeacea08 | 65 | *@params aantal leds om te drive |
albireo987 | 10:7871aeacea08 | 66 | */ |
albireo987 | 6:36158325f7b0 | 67 | void run(int numberOfLeds); |
albireo987 | 6:36158325f7b0 | 68 | |
albireo987 | 6:36158325f7b0 | 69 | }; |
albireo987 | 6:36158325f7b0 | 70 | |
albireo987 | 6:36158325f7b0 | 71 | #endif |