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.
Dependents: Carte_Moteur_test_asservissement_1M identification Carte_Moteur_test_asservissement_3M
Diff: 7366_lib.cpp
- Revision:
- 6:fafe7c5a4b2f
- Parent:
- 5:4b3be7515d70
- Child:
- 7:ea991921ae55
--- a/7366_lib.cpp Tue Jan 29 11:04:49 2019 +0000
+++ b/7366_lib.cpp Tue Jan 29 12:32:32 2019 +0000
@@ -31,7 +31,9 @@
}
-void SPI_7366::read_value(char* rxBuffer, int rxLength ){
+int32_t SPI_7366::read_value(){
+ char rxBuffer[5] = {0,0,0,0,0};
+ char rxLength = 5;
char IR = LOAD|OTR;
char txBuffer[1] = {IR};
int txLength = 1;
@@ -49,5 +51,6 @@
this->write(txBuffer, txLength, rxBuffer, rxLength);
this->select = 1;
this->unlock();
- return;
+
+ return (int32_t) (rxBuffer[1])|(rxBuffer[2]<<4)|(rxBuffer[3]<<8)|(rxBuffer[4]<<12);
}
\ No newline at end of file