Function generator code modified to work on the Freescale KL25Z

Dependencies:   mbed

Fork of AD9850 function generator SPI driver by Liam G

This is an update to the original AD9850 SPI driver produced by Liam Goudge.

The main changes are to assign the appropriate pins and to send the 40-bit AD9850 programming word as five 8-bit packets. This is necessary because the KL25Z only supports 8-bit SPI transfers.

Revision:
1:b0e6c82af2ef
Parent:
0:b5fb7b3adfe2
Child:
2:e9d2346ea1bb
diff -r b5fb7b3adfe2 -r b0e6c82af2ef main.cpp
--- a/main.cpp	Sat Sep 28 04:32:20 2013 +0000
+++ b/main.cpp	Sat Sep 28 06:44:57 2013 +0000
@@ -70,14 +70,14 @@
     while(1)
     {
     
-    while (targetFrq<0x28F5C28F) // 20MHz
+    while (targetFrq<0x28F5C28F) // up to 20MHz
     {
-        writeSPI(reverseBits(targetFrq),0);
+        writeSPI(reverseBits(targetFrq),0); // Don't use phase so set to zero.
         targetFrq=targetFrq+increment;
         //wait_ms(100);
         }
         
-    while (targetFrq>0x147AE148) // 10MHz
+    while (targetFrq>0x147AE148) // down to 10MHz
     {
         writeSPI(reverseBits(targetFrq),0);
         targetFrq=targetFrq-increment;