Mauricio Donatti / AD7172-2

Files at this revision

API Documentation at this revision

Comitter:
mmdonatti
Date:
Tue May 05 18:19:00 2020 +0000
Parent:
1:6d78a35bedd0
Child:
3:ae9ae6b0b8e0
Commit message:
Single convertion mode with sync triggering functions

Changed in this revision

ad7172.cpp Show annotated file Show diff for this revision Revisions of this file
ad7172.h Show annotated file Show diff for this revision Revisions of this file
--- a/ad7172.cpp	Tue May 05 17:57:07 2020 +0000
+++ b/ad7172.cpp	Tue May 05 18:19:00 2020 +0000
@@ -77,6 +77,7 @@
 	
 	cs = new DigitalOut(slave_select); // Define cs as digital out variable referred to slave_select pin
 	sync = new DigitalOut(sync_pin); // Define sync as digital out variable referred to sync_pin
+	*sync = 1;
 	Reset(); // Calling the AD7172-2 restart function
 }
 
@@ -122,37 +123,42 @@
     AD7172_PRINTF("Register: IFMODE\tWrite: 0x%04X",data.data);    
     WriteRegister(AD7172_IFMODE_REG,2); // Writing to IFMODE register
     enable(); // *cs = 0
+    *sync = 0;
 }
 
-/******************************************************************************
-* @AD7172 Sync Enable
-*
-*******************************************************************************/
+/*
+////////////////////////////////////////////////////////////////////////////////
+// @AD7172 Sync Enable
+//
+////////////////////////////////////////////////////////////////////////////////
 void AD7172::sync_enable()
 {
 	*sync = 0;
 }
 
-/******************************************************************************
-* @AD7172 Sync Disable
-*
-*******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+// @AD7172 Sync Disable
+//
+////////////////////////////////////////////////////////////////////////////////
 void AD7172::sync_disable()
 {
 	*sync = 1;
 }
 
-/******************************************************************************
-* @AD7172 Single Convertion Mode Conversion Driver
-*
-*******************************************************************************/
+*/
+
+////////////////////////////////////////////////////////////////////////////////
+// @AD7172 Single Convertion Mode Conversion Driver
+//
+////////////////////////////////////////////////////////////////////////////////
 void AD7172::start_single_conv()
 {
 	*sync = 0;
-	wait_ms(1);
+	wait_us(1);
 	*sync = 1;
 }
 
+
 /******************************************************************************
 * @AD7172 Read Device ID - Communication Test.
 *
--- a/ad7172.h	Tue May 05 17:57:07 2020 +0000
+++ b/ad7172.h	Tue May 05 18:19:00 2020 +0000
@@ -204,10 +204,10 @@
 	void config_single();
 	
 	// Sync Enable
-	void sync_enable();
+	//void sync_enable();
 	
 	// Sync Disable
-	void sync_disable();
+	//void sync_disable();
 	
 	// Single Convertion Mode Conversion Driver
 	void start_single_conv();