TER Atienza Pongnot 2019 / 7366_lib

Dependents:   Carte_Moteur_test_asservissement_1M identification Carte_Moteur_test_asservissement_3M

Revision:
4:ea22035b9fea
Parent:
3:acc9c682ceb9
Child:
5:4b3be7515d70
--- a/7366_lib.cpp	Wed Jan 23 21:25:04 2019 +0000
+++ b/7366_lib.cpp	Tue Jan 29 10:55:10 2019 +0000
@@ -19,7 +19,7 @@
 
 	
 	IR = WR|MDR1;
-	data = CONFIG_4BYTES|CPT_ENABLE;
+	data = CONFIG_2BYTES|CPT_ENABLE;
 	txBuffer[0] = IR;
 	txBuffer[1] = data;
 	this->lock();
@@ -32,7 +32,7 @@
 
 
 void SPI_7366::read_value(char* rxBuffer, int rxLength ){
-	char IR = RD|CNTR;
+	char IR = LOAD|OTR;
 	char txBuffer[1] = {IR};
 	int txLength = 1;
 	this->lock();
@@ -40,5 +40,14 @@
 	this->write(txBuffer, txLength, rxBuffer, rxLength);
 	this->select = 1;
 	this->unlock();
+	
+	IR = RD|OTR;
+	txBuffer[0] = IR;
+	txLength = 1;
+	this->lock();
+	this->select = 0;
+	this->write(txBuffer, txLength, rxBuffer, rxLength);
+	this->select = 1;
+	this->unlock();
 	return;
 	}
\ No newline at end of file