Mini projet LOO
Dependencies: mbed APDS_9960 mbed-rtos
Home du projet
src/cLed.cpp@4:b7a46af55574, 2016-03-31 (annotated)
- Committer:
- Willheisen
- Date:
- Thu Mar 31 11:18:41 2016 +0000
- Revision:
- 4:b7a46af55574
- Parent:
- 3:493dd1cf30a4
- Child:
- 5:d6b0bf27bac6
afficher form:e ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
clementdoreau | 1:ab5f440f4156 | 1 | #include "cLed.h" |
clementdoreau | 1:ab5f440f4156 | 2 | |
clementdoreau | 1:ab5f440f4156 | 3 | // Définition de la classe Led |
clementdoreau | 1:ab5f440f4156 | 4 | |
clementdoreau | 1:ab5f440f4156 | 5 | // CONSTRUCTEURS |
clementdoreau | 1:ab5f440f4156 | 6 | |
clementdoreau | 1:ab5f440f4156 | 7 | cLed::cLed(){ |
clementdoreau | 1:ab5f440f4156 | 8 | _positionX = 0; |
clementdoreau | 1:ab5f440f4156 | 9 | _positionY = 0; |
clementdoreau | 1:ab5f440f4156 | 10 | _couleur = 0x00; |
clementdoreau | 1:ab5f440f4156 | 11 | } |
clementdoreau | 1:ab5f440f4156 | 12 | |
clementdoreau | 1:ab5f440f4156 | 13 | cLed::cLed(unsigned char x, unsigned char y){ |
clementdoreau | 1:ab5f440f4156 | 14 | _positionX = x; |
clementdoreau | 1:ab5f440f4156 | 15 | _positionY = y; |
clementdoreau | 1:ab5f440f4156 | 16 | } |
clementdoreau | 1:ab5f440f4156 | 17 | |
clementdoreau | 1:ab5f440f4156 | 18 | cLed::cLed(unsigned char x, unsigned char y, unsigned char c){ |
clementdoreau | 1:ab5f440f4156 | 19 | _positionX = x; |
clementdoreau | 1:ab5f440f4156 | 20 | _positionY = y; |
clementdoreau | 1:ab5f440f4156 | 21 | _couleur = c; |
clementdoreau | 1:ab5f440f4156 | 22 | } |
clementdoreau | 1:ab5f440f4156 | 23 | |
clementdoreau | 1:ab5f440f4156 | 24 | // GETTERS |
clementdoreau | 1:ab5f440f4156 | 25 | |
clementdoreau | 1:ab5f440f4156 | 26 | unsigned char cLed::getPositionX(){ |
clementdoreau | 1:ab5f440f4156 | 27 | return _positionX; |
clementdoreau | 1:ab5f440f4156 | 28 | } |
clementdoreau | 1:ab5f440f4156 | 29 | unsigned char cLed::getPositionY(){ |
clementdoreau | 1:ab5f440f4156 | 30 | return _positionY; |
clementdoreau | 1:ab5f440f4156 | 31 | } |
clementdoreau | 1:ab5f440f4156 | 32 | |
clementdoreau | 1:ab5f440f4156 | 33 | unsigned char cLed::getCouleur(){ |
clementdoreau | 1:ab5f440f4156 | 34 | return _couleur; |
clementdoreau | 1:ab5f440f4156 | 35 | } |
clementdoreau | 1:ab5f440f4156 | 36 | |
clementdoreau | 1:ab5f440f4156 | 37 | // SETTER |
clementdoreau | 1:ab5f440f4156 | 38 | |
clementdoreau | 1:ab5f440f4156 | 39 | void cLed::setPositionX(unsigned char x){ |
clementdoreau | 1:ab5f440f4156 | 40 | _positionX = x; |
clementdoreau | 1:ab5f440f4156 | 41 | } |
clementdoreau | 1:ab5f440f4156 | 42 | |
clementdoreau | 1:ab5f440f4156 | 43 | void cLed::setPositionY(unsigned char y){ |
clementdoreau | 1:ab5f440f4156 | 44 | _positionY = y; |
clementdoreau | 1:ab5f440f4156 | 45 | } |
clementdoreau | 1:ab5f440f4156 | 46 | |
Willheisen | 3:493dd1cf30a4 | 47 | void cLed::allumer(unsigned char c){ |
Willheisen | 3:493dd1cf30a4 | 48 | _couleur = c; |
Willheisen | 4:b7a46af55574 | 49 | /*DigitalOut cs(p14); |
Willheisen | 3:493dd1cf30a4 | 50 | SPI point(p11,p12,p13); |
Willheisen | 3:493dd1cf30a4 | 51 | cs=0; |
Willheisen | 3:493dd1cf30a4 | 52 | wait(0.5); |
Willheisen | 3:493dd1cf30a4 | 53 | for(char i=0; i<_positionX; i++) |
Willheisen | 3:493dd1cf30a4 | 54 | { |
Willheisen | 3:493dd1cf30a4 | 55 | for(char j=0; j<_positionY; j++) |
Willheisen | 3:493dd1cf30a4 | 56 | { |
Willheisen | 3:493dd1cf30a4 | 57 | point.write(c); |
Willheisen | 3:493dd1cf30a4 | 58 | } |
Willheisen | 3:493dd1cf30a4 | 59 | } |
Willheisen | 3:493dd1cf30a4 | 60 | wait(0.5); |
Willheisen | 4:b7a46af55574 | 61 | cs=1;*/ |
clementdoreau | 1:ab5f440f4156 | 62 | } |
clementdoreau | 1:ab5f440f4156 | 63 | |
Willheisen | 3:493dd1cf30a4 | 64 | void cLed::eteindre(){ |
Willheisen | 4:b7a46af55574 | 65 | _couleur = COULEUR_LED_NOIR; |
clementdoreau | 1:ab5f440f4156 | 66 | } |