Demo program for the AD7730 library

Dependencies:   AD7730 mbed

Files at this revision

API Documentation at this revision

Comitter:
frada
Date:
Tue Mar 17 17:25:15 2015 +0000
Commit message:
Demo for the AD7730 library

Changed in this revision

AD7730.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 929781c1530d AD7730.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AD7730.lib	Tue Mar 17 17:25:15 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/frada/code/AD7730/#82872c4221fc
diff -r 000000000000 -r 929781c1530d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 17 17:25:15 2015 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "AD7730.h"
+
+#ifdef TARGET_K64F
+ #define SPI_SCK     PTD1
+ #define SPI_MOSI    PTD2
+ #define SPI_MISO    PTD3
+ #define SPI_CS      PTD0
+ #define READY       PTC4
+ #define I2C_SDA     PTE25
+ #define I2C_SCL     PTE24
+#elif defined(TARGET_KL25Z)
+ #define SPI_SCK     PTD1
+ #define SPI_MOSI    PTD2
+ #define SPI_MISO    PTD3
+ #define SPI_CS      PTD0
+ #define READY       PTD5
+ #define I2C_SDA     PTE0
+ #define I2C_SCL     PTE1
+#endif
+
+DigitalOut greenLED(LED_GREEN);
+DigitalOut redLED(LED_RED);
+DigitalOut blueLED(LED_BLUE);
+Serial pc(USBTX, USBRX);
+Ticker tick1;
+volatile bool timerInterrupt = false;
+
+
+AD7730 ad7730(SPI_MOSI, SPI_MISO, SPI_SCK, READY, SPI_CS);
+
+void timerISR() {
+    timerInterrupt = true;
+    greenLED = !greenLED;    
+}
+
+int main() {
+    pc.baud(115200);
+    greenLED = 1;
+    redLED = 1;
+    blueLED = 1;    
+    ad7730.initialize();
+    tick1.attach(timerISR, 0.02F);
+
+    while(1) {
+        if (timerInterrupt) { 
+            pc.printf("%d\r\n", ad7730.read(true));
+            timerInterrupt = false;
+        } 
+    }    
+}
\ No newline at end of file
diff -r 000000000000 -r 929781c1530d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 17 17:25:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file