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/cSPI.cpp
- Revision:
- 27:fdcff6af71b5
- Parent:
- 23:298a1314fc81
- Child:
- 28:e932eb039271
diff -r 0897d27b6961 -r fdcff6af71b5 src/cSPI.cpp --- a/src/cSPI.cpp Wed Apr 20 08:23:35 2016 +0000 +++ b/src/cSPI.cpp Wed Apr 20 11:13:53 2016 +0000 @@ -64,18 +64,22 @@ _cs = 1; } - int cSPI::envoyerMatrice(cMatrice & mat){ // Renvoi la reponse SPI - DigitalOut _cs(p14); //avant p8 - SPI _spi(p11,p12, p13); +int cSPI::envoyerMatrice(cMatrice & mat) // Renvoi la reponse SPI +{ + DigitalOut _cs(p14); //avant p8 + SPI _spi(p11,p12, p13); + for(unsigned char nbMat = 0; nbMat < (mat.getLig() % 8); nbMat++) { _cs = 0; wait(0.1); - for(unsigned char i = 0; i < mat.getLig(); i++){ - for(unsigned char j = 0; j < mat.getCol(); j ++){ + for(unsigned char i = nbMat*8; i < (nbMat*8)+8; i++) { + for(unsigned char j = 0; j < mat.getCol(); j ++) { _spi.write(mat.getValTab(i, j)); } } wait(0.1); _cs = 1; //avant 0 - return 1; // temporaire + wait(0.01); + } + return 1; // temporaire }