gt

Dependencies:   mbed

Fork of PLYD_CDMS_1 by Siva ram

Files at this revision

API Documentation at this revision

Comitter:
raizel_varun
Date:
Sat Oct 03 12:22:16 2015 +0000
Parent:
2:623747e75e3c
Commit message:
Standalone PYLD SPI Code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
pin_config.h Show annotated file Show diff for this revision Revisions of this file
diff -r 623747e75e3c -r 487c2fdc28f0 main.cpp
--- a/main.cpp	Sat Oct 03 10:20:07 2015 +0000
+++ b/main.cpp	Sat Oct 03 12:22:16 2015 +0000
@@ -3,18 +3,19 @@
 // Payload uC (Tiva) -- > SPI master
 // CDMS uC (Freescale) --> SPI slave
 // packet length = 32*16 bits (32 bins --> each 2 bytes)
- 
+
+#include "pin_config.h"
 #include "mbed.h"
 //int f;
 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);
+Timer t;
+I2C master (PIN32,PIN31);
+InterruptIn PYLD_I2C_Int(PIN100);
 //DigitalIn test(PTA13);
-SPISlave device(PTD6, PTD7, PTD5,PTD4 ); // mosi, miso, sclk, ssel --> using SPI1
-InterruptIn PYLD_SPI_Interrupt(PTD2);
+SPISlave device(PIN16, PIN17, PIN15, PIN14 ); // mosi, miso, sclk, ssel --> using SPI1
+InterruptIn PYLD_SPI_Interrupt(PIN89);
 DigitalOut flash(LED4);
 int payloadBins = 3096;
 float Stability_delay = 0.005228 ;// 0.005228
@@ -26,7 +27,7 @@
    
     //wait(Stability_delay); // wait after interrupt for stability
     unsigned short scienceRawPacket[payloadBins];
-    
+    t.start();
     for(int i=0; i<payloadBins;i++){
        
         
@@ -35,14 +36,15 @@
         scienceRawPacket[i] = device.read();   // Read byte from master
 
     }
+    t.stop();
     // serial feedback
     pc.printf("Packet recieved\r\n");
     for(int i=0;i<payloadBins;i++){
         pc.printf("%d\t",scienceRawPacket[i]);
         scienceRawPacket[i] = 0;
     }
-    pc.printf("\r\n");
- 
+    pc.printf("\n time taken = %f\r\n",t.read());
+ t.reset();
 } 
 int dt3;
 bool f = 1;
diff -r 623747e75e3c -r 487c2fdc28f0 pin_config.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pin_config.h	Sat Oct 03 12:22:16 2015 +0000
@@ -0,0 +1,101 @@
+// 100 LQFP format pin assignment
+#define PIN1 PTE0
+#define PIN2 PTE1
+#define PIN3 PTE2
+#define PIN4 PTE3
+#define PIN5 PTE4
+#define PIN6 PTE5
+#define PIN7 PTE6
+//#define 8 
+//#define 9 
+//#define 10 
+//#define 11 
+//#define 12 
+//#define 13 
+#define PIN14 PTE16
+#define PIN15 PTE17
+#define PIN16 PTE18
+#define PIN17 PTE19
+#define PIN18 PTE20
+#define PIN19 PTE21
+#define PIN20 PTE22
+#define PIN21 PTE23
+//#define 22 
+//#define 23 
+//#define 24 
+//#define 25 
+#define PIN26 PTE29
+#define PIN27 PTE30
+#define PIN28 PTE31
+//#define 29 
+//#define 30 
+#define PIN31 PTE24
+#define PIN32 PTE25
+#define PIN33 PTE26
+#define PIN34 PTA0
+#define PIN35 PTA1
+#define PIN36 PTA2
+#define PIN37 PTA3
+#define PIN38 PTA4
+#define PIN39 PTA5
+#define PIN40 PTA6
+#define PIN41 PTA7
+#define PIN42 PTA12
+#define PIN43 PTA13
+#define PIN44 PTA14
+#define PIN45 PTA15
+#define PIN46 PTA16
+#define PIN47 PTA17
+//#define 48 
+//#define 49 
+#define PIN50 PTA18
+#define PIN51 PTA19
+#define PIN52 PTA20
+#define PIN53 PTB0
+#define PIN54 PTB1
+#define PIN55 PTB2
+#define PIN56 PTB3
+#define PIN57 PTB7
+#define PIN58 PTB8
+#define PIN59 PTB9
+#define PIN60 PTB10
+#define PIN61 PTB11
+#define PIN62 PTB16
+#define PIN63 PTB17
+#define PIN64 PTB18
+#define PIN65 PTB19
+#define PIN66 PTB20
+#define PIN67 PTB21
+#define PIN68 PTB22
+#define PIN69 PTB23
+#define PIN70 PTC0
+#define PIN71 PTC1
+#define PIN72 PTC2
+#define PIN73 PTC3
+//#define 74 
+//#define 75 
+#define PIN76 PTC20
+#define PIN77 PTC21
+#define PIN78 PTC22
+#define PIN79 PTC23
+#define PIN80 PTC4
+#define PIN81 PTC5
+#define PIN82 PTC6
+#define PIN83 PTC7
+#define PIN84 PTC8
+#define PIN85 PTC9
+#define PIN86 PTC10
+#define PIN87 PTC11
+#define PIN88 PTC12
+#define PIN89 PTC13
+#define PIN90 PTC16
+#define PIN91 PTC17
+#define PIN92 PTC18
+#define PIN93 PTD0
+#define PIN94 PTD1
+#define PIN95 PTD2
+#define PIN96 PTD3
+#define PIN97 PTD4
+#define PIN98 PTD5
+#define PIN99 PTD6
+#define PIN100 PTD7
\ No newline at end of file