Mini projet LOO
Dependencies: mbed APDS_9960 mbed-rtos
Home du projet
src/cLed.cpp@10:9ef3f520ff6c, 2016-04-07 (annotated)
- Committer:
- clementdoreau
- Date:
- Thu Apr 07 15:24:07 2016 +0000
- Revision:
- 10:9ef3f520ff6c
- Parent:
- 9:6f3d8b714a59
- Child:
- 29:95469b25e187
Optimisation du code
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 | 7:4b283e36b147 | 7 | cLed::cLed() { |
clementdoreau | 7:4b283e36b147 | 8 | _positionX = 0; |
clementdoreau | 7:4b283e36b147 | 9 | _positionY = 0; |
clementdoreau | 7:4b283e36b147 | 10 | _couleur = 0x00; |
clementdoreau | 1:ab5f440f4156 | 11 | } |
clementdoreau | 1:ab5f440f4156 | 12 | |
clementdoreau | 7:4b283e36b147 | 13 | cLed::cLed(unsigned char x, unsigned char y) { |
clementdoreau | 7:4b283e36b147 | 14 | _positionX = x; |
clementdoreau | 7:4b283e36b147 | 15 | _positionY = y; |
clementdoreau | 1:ab5f440f4156 | 16 | } |
clementdoreau | 1:ab5f440f4156 | 17 | |
clementdoreau | 7:4b283e36b147 | 18 | cLed::cLed(unsigned char x, unsigned char y, unsigned char c) { |
clementdoreau | 7:4b283e36b147 | 19 | _positionX = x; |
clementdoreau | 7:4b283e36b147 | 20 | _positionY = y; |
clementdoreau | 7:4b283e36b147 | 21 | _couleur = c; |
clementdoreau | 1:ab5f440f4156 | 22 | } |
clementdoreau | 1:ab5f440f4156 | 23 | |
clementdoreau | 1:ab5f440f4156 | 24 | // GETTERS |
clementdoreau | 1:ab5f440f4156 | 25 | |
clementdoreau | 7:4b283e36b147 | 26 | unsigned char cLed::getPositionX() { |
clementdoreau | 7:4b283e36b147 | 27 | return _positionX; |
clementdoreau | 1:ab5f440f4156 | 28 | } |
clementdoreau | 7:4b283e36b147 | 29 | unsigned char cLed::getPositionY() { |
clementdoreau | 7:4b283e36b147 | 30 | return _positionY; |
clementdoreau | 1:ab5f440f4156 | 31 | } |
clementdoreau | 1:ab5f440f4156 | 32 | |
clementdoreau | 10:9ef3f520ff6c | 33 | unsigned char cLed::getOldPositionX(){ |
clementdoreau | 10:9ef3f520ff6c | 34 | return _oldPositionX; |
clementdoreau | 10:9ef3f520ff6c | 35 | } |
clementdoreau | 10:9ef3f520ff6c | 36 | |
clementdoreau | 10:9ef3f520ff6c | 37 | unsigned char cLed::getOldPositionY(){ |
clementdoreau | 10:9ef3f520ff6c | 38 | return _oldPositionY; |
clementdoreau | 10:9ef3f520ff6c | 39 | } |
clementdoreau | 10:9ef3f520ff6c | 40 | |
clementdoreau | 7:4b283e36b147 | 41 | unsigned char cLed::getCouleur() { |
clementdoreau | 7:4b283e36b147 | 42 | return _couleur; |
clementdoreau | 1:ab5f440f4156 | 43 | } |
clementdoreau | 1:ab5f440f4156 | 44 | |
clementdoreau | 10:9ef3f520ff6c | 45 | |
clementdoreau | 1:ab5f440f4156 | 46 | // SETTER |
clementdoreau | 1:ab5f440f4156 | 47 | |
clementdoreau | 7:4b283e36b147 | 48 | void cLed::setPositionX(unsigned char x) { |
clementdoreau | 7:4b283e36b147 | 49 | _positionX = x; |
clementdoreau | 1:ab5f440f4156 | 50 | } |
clementdoreau | 1:ab5f440f4156 | 51 | |
clementdoreau | 7:4b283e36b147 | 52 | void cLed::setPositionY(unsigned char y) { |
clementdoreau | 7:4b283e36b147 | 53 | _positionY = y; |
clementdoreau | 1:ab5f440f4156 | 54 | } |
clementdoreau | 1:ab5f440f4156 | 55 | |
clementdoreau | 10:9ef3f520ff6c | 56 | void cLed::setOldPositionX(unsigned char x){ |
clementdoreau | 10:9ef3f520ff6c | 57 | _oldPositionX = x; |
clementdoreau | 10:9ef3f520ff6c | 58 | } |
clementdoreau | 10:9ef3f520ff6c | 59 | |
clementdoreau | 10:9ef3f520ff6c | 60 | void cLed::setOldPositionY(unsigned char y){ |
clementdoreau | 10:9ef3f520ff6c | 61 | _oldPositionY = y; |
clementdoreau | 10:9ef3f520ff6c | 62 | } |
clementdoreau | 10:9ef3f520ff6c | 63 | |
clementdoreau | 10:9ef3f520ff6c | 64 | void cLed::setCouleur(unsigned char c) { |
clementdoreau | 7:4b283e36b147 | 65 | _couleur = c; |
clementdoreau | 1:ab5f440f4156 | 66 | } |
clementdoreau | 1:ab5f440f4156 | 67 |