Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed APDS_9960 mbed-rtos
Diff: src/cMatrice.cpp
- Revision:
- 29:95469b25e187
- Parent:
- 28:e932eb039271
- Child:
- 30:c647da947bd9
--- a/src/cMatrice.cpp Wed Apr 20 14:18:18 2016 +0000
+++ b/src/cMatrice.cpp Wed Apr 20 15:09:43 2016 +0000
@@ -5,16 +5,17 @@
cMatrice::cMatrice()
{
-
+ _lig = 0;
+ _col = 0;
}
-cMatrice::cMatrice(unsigned char c, unsigned char l)
+cMatrice::cMatrice(unsigned int c, unsigned int l)
{
_lig = l;
_col = c;
- _matrice = new unsigned char*[_lig];
- for(unsigned char i = 0; i < _lig; i++) {
- _matrice[i] = new unsigned char[_col];
+ _matrice = new unsigned int*[_lig];
+ for(unsigned int i = 0; i < _lig; i++) {
+ _matrice[i] = new unsigned int[_col];
}
clear();
}
@@ -22,24 +23,24 @@
// DESTRUCTEUR
cMatrice::~cMatrice()
{
- for(unsigned char i = 0; i < _lig; i++) {
+ for(unsigned int i = 0; i < _lig; i++) {
delete[] _matrice[i];
delete[] _matrice;
}
}
// GETTER
-unsigned char cMatrice::getValTab(unsigned char l, unsigned char c)
+unsigned int cMatrice::getValTab(unsigned int l, unsigned int c)
{
return _matrice[l][c];
}
-unsigned char cMatrice::getCol()
+unsigned int cMatrice::getCol()
{
return _col;
}
-unsigned char cMatrice::getLig()
+unsigned int cMatrice::getLig()
{
return _lig;
}
@@ -50,16 +51,16 @@
}
// SETTER
-void cMatrice::setCol(unsigned char c)
+void cMatrice::setCol(unsigned int c)
{
_col = c;
}
-void cMatrice::setLig(unsigned char l)
+void cMatrice::setLig(unsigned int l)
{
_lig = l;
}
-void cMatrice::setValTab(unsigned char l, unsigned char c, unsigned char coul)
+void cMatrice::setValTab(unsigned int l, unsigned int c, unsigned int coul)
{
_matrice [l][c] = coul;
}
@@ -69,7 +70,7 @@
// Paramètres:
// f: Forme à afficher
// c: Couleur
-void cMatrice::afficherForme(cForme* f, unsigned char c)
+void cMatrice::afficherForme(cForme* f, unsigned int c)
{
_pForme = f;
// Changement de couleur des Leds
@@ -85,8 +86,8 @@
// Nettoyage de la matrice, passage à 0 de la valeur de chaque Led
void cMatrice::clear()
{
- for(unsigned char i = 0; i < _lig; i++) {
- for(unsigned char j = 0; j < _col; j++) {
+ for(unsigned int i = 0; i < _lig; i++) {
+ for(unsigned int j = 0; j < _col; j++) {
_matrice[i][j] = LED_NOIR;
}
}