This is a demo code for ARCH GPRS 2.0 Serial debug
Fork of Arch_GPRS_V2_Serial_Debug by
Diff: main.cpp
- Revision:
- 1:ba5061c882ea
- Parent:
- 0:38b190020352
--- a/main.cpp Sat Apr 26 12:46:40 2014 +0000 +++ b/main.cpp Mon Apr 28 01:56:27 2014 +0000 @@ -24,10 +24,12 @@ #include "USBSerial.h" #define PIN_PWR P1_2 //power up gprs module +#define PIN_PWR_KEY P1_7 #define PIN_TX P1_27 //Serial tx pin #define PIN_RX P1_26 //Serial rx pin DigitalOut power(PIN_PWR); +DigitalOut powerKey(PIN_PWR_KEY); Serial gprs(PIN_TX, PIN_RX); USBSerial pc; @@ -44,17 +46,38 @@ gprs.format(bits, parityTable[parity], stop); } +/* power pin: low enable + ___ + |___ + + powerKey pin: you can also power up by long press the powerKey. + + ___ + ___| |___ + +*/ void gprsPowerUp(void) { + power = 1; + wait(2); power = 0; + wait(2); + + powerKey = 0; + wait(1); + powerKey = 1; + wait(2); + powerKey = 0; + wait(3); + } int main() { + pc.attach(settingsChanged); + pc.printf("wait for GPRS power up..."); gprsPowerUp(); - wait(2); - - pc.attach(settingsChanged); + pc.printf("gprs Power up success\n"); while (1) { while (gprs.readable()) {