Fork for Get Started Demo

Dependencies:   DebouncedInterrupt dash7-alp mbed-rtos mbed wizzi-utils

Fork of D7A_Demo_full by WizziLab

Revision:
1:49da0144dd4c
Parent:
0:aa25c4c8ddbf
Child:
2:c3cfaa7d5bb8
--- a/main.cpp	Thu Nov 19 17:25:00 2015 +0000
+++ b/main.cpp	Thu Nov 19 17:26:13 2015 +0000
@@ -1,24 +1,41 @@
 #include "mbed.h"
 #include "rtos.h"
 #include "dbg.h"
+#include "shield.h"
+#include "alp_serial.h"
+#include "alp_device.h"
 
 int main()
 {
-    //-------------------------------------------//
     // ----- Debug session over USB Serial ----- //
-    //-------------------------------------------//
-    // Hyperterminal configuration:              //
-    // 115200 bauds, 8-bit data, no parity       //
-    // Linux: 'sudo screen /dev/ttyACMx 115200'  //
-    //    or: 'cat /dev/ttyACMx'                 //
-    // Windows: Use an hyperterminal such as:    //
-    //          - TeraTerm                       //
-    //          - Putty                          //
-    //-------------------------------------------//
     DBG_OPEN();
+        
+    // Clear some lines on the terminal
+    DPRINT("\r\n\nBOOT\r\n");
     
-    // Test Debug traces
-    DPRINT("BOOT\r\n");
+    // Declare Shield NRST pin
+    DigitalOut shield_nrst(PB_0);
+    
+    // Reset shield
+    shield_nrst = 0;
+    
+    // Open ALP port over serial
+    // This is the physical ALP serial port
+    AlpSerial serial_shield;
+
+    // Initialize ALP device
+    // This creates an AlpDevice object abstracting the shield1001
+    // The parameters describe how to access it
+    AlpDevice shield(&serial_shield, 0, ACCESS_CLASS_EP, ALP_FILE_BLOCK_ISFB, true);
+
+    // Release reset
+    shield_nrst = 1;
+    
+    // Check the shield boot packets
+    shield_check_boot(&shield);
+    
+    // Wait for Shield to notify its files if there is any
+    Thread::wait(1000);
     
     // Set main task to lowest priority
     osThreadSetPriority(osThreadGetId(), osPriorityIdle);