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.
Diff: AD7989.h
- Revision:
- 0:64eaedfa13a2
- Child:
- 1:582476614d9d
diff -r 000000000000 -r 64eaedfa13a2 AD7989.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AD7989.h Mon Jan 21 16:55:48 2019 +0000
@@ -0,0 +1,34 @@
+#ifndef AD7989_H
+#define AD7989_H
+
+#include "mbed-os/mbed.h"
+
+class AD7989_Driver
+{
+public:
+ /** Constructor for AD7989_Drive object
+ *
+ * @param SPI_BUS this is the SPI bus the AD7989 is one
+ * @param Chip_Select this is the DigitalOut outline connected to CS pin
+ * @param Convert this is the DigitalOut pin that is connected to the CONV pin
+ */
+ AD7989_Driver(SPI *SPI_BUS, DigitalOut *Chip_Select, DigitalOut *Convert);
+ /** Function returns the voltage on the AD7989 as a double
+ * The value the function will return will be from -5.0V to 5.0V
+ */
+ double sample();
+ /** averages a number of samples the use specifies
+ *
+ * @param num_avgs The number of samples to average
+ */
+ double sample_avg(int num_avgs);
+
+ float volts;
+private:
+ static const float zero_point;
+ SPI *ADC_SPI;
+ DigitalOut *CS;
+ DigitalOut *ADC_CONV;
+};
+
+#endif
\ No newline at end of file