PYLD_CDMS

Dependencies:   mbed

Fork of PLYD_CDMSee by Siva ram

Revision:
1:72227bdac415
Parent:
0:58ec354d3b79
Child:
2:623747e75e3c
diff -r 58ec354d3b79 -r 72227bdac415 main.cpp
--- a/main.cpp	Tue Jun 30 07:40:20 2015 +0000
+++ b/main.cpp	Wed Jul 01 08:36:55 2015 +0000
@@ -8,6 +8,7 @@
 
 void FUNC_MASTER_WRITE(void);
 const int addr = 0x20<<1;
+const int addr1 = (0x20<<1|0);
 Timer Siv ;
 I2C master (D14,D15);
 InterruptIn PYLD_I2C_Int(PTA13);
@@ -57,18 +58,39 @@
  
 int loop=1;
 char *writedata = new char;
-char data[8]= "payload"; 
+char data[100]= "kitten"; 
  
 void FUNC_MASTER_WRITE(void)
-{    int data = pc.getc();      
+{    int data1 = pc.getc();      
       loop=1;
  
  
  master.frequency(100000); 
-  *writedata = data; 
+  *writedata = data1; 
      while(loop)
      {
-         bool check = (bool)master.write(addr,writedata,1);
+        // bool check = (bool)master.write(addr,data,8);
+         bool check = (bool)master.write(addr,data,13);
+         /*
+        master.start();
+        bool check1 = master.write(addr1);
+        bool check2 = master.write(83);
+         master.write(97);
+         //wait(1);
+         master.write(107);
+         master.write(116);
+         master.write(104);
+         master.write(105);
+         master.write(32);
+         master.write(80);
+         master.write(114);
+         master.write(105);
+         master.write(121);
+         master.write(97);
+         
+         master.stop();
+         */
+         
 
          loop = 0;
      }
@@ -77,6 +99,7 @@
     int dt1 = 0,dt2 = 0;
     device.format(16,0);  // SPI format --> 16 bits, mode = 0
     device.frequency(1000000);
+    master.frequency(400000);
        
     pc.printf("Example code demonstarting Payload - CDMS SPI & I2C communication!\r\n");
     PYLD_SPI_Interrupt.rise(&payloadProcess);