Daniel Lee / Mbed OS BG96_K6xF_pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Files at this revision

API Documentation at this revision

Comitter:
Daniel_Lee
Date:
Wed Jul 24 16:20:11 2019 +0000
Parent:
12:0c8a04b59cef
Commit message:
Update;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 24 16:08:43 2019 +0000
+++ b/main.cpp	Wed Jul 24 16:20:11 2019 +0000
@@ -83,6 +83,23 @@
 #endif /* TARGET_K66F */
 #endif /* SEND_ALL_SENSORS */
 
+void BG96_Modem_PowerON(void)
+{
+    DigitalOut BG96_RESET(D7);
+    DigitalOut BG96_PWRKEY(D9);
+ 
+    BG96_RESET = 1;
+    BG96_PWRKEY = 1;
+    wait_ms(200);
+ 
+    BG96_RESET = 0;
+    BG96_PWRKEY = 0;
+    wait_ms(300);
+ 
+    BG96_RESET = 1;
+    wait_ms(5000);
+}
+
 // An event queue is a very useful structure to debounce information between contexts (e.g. ISR and normal threads)
 // This is great because things such as network operations are illegal in ISR, so updating a resource in a button's fall() function is not allowed
 EventQueue eventQueue;
@@ -234,6 +251,9 @@
         printf("You can hold the user button during boot to format the storage and change the device identity.\n");
     }
 
+    BG96_Modem_PowerON();
+    printf("M2Mnet(BG96) Power ON\n");
+    
     sensors_init();
 
     // Connect to the Internet (DHCP is expected to be on)