Board support library for C027

Dependents:   IoTWorkshopLCD IoTWorkshopBuzzer IoTWorkshopSensors C027_USSDTest ... more

Fork of C027 by u-blox

/media/uploads/ublox/c027_pinout_new.png

Committer:
mazgch
Date:
Mon Oct 21 19:45:55 2013 +0000
Revision:
6:e11bf54dd344
Parent:
3:b54777b90da1
Child:
7:e3eab86f1de9
adding helpers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 6:e11bf54dd344 1
mazgch 2:b7bd3660ff64 2 /* Platform source file, for the u-blox C27-C20/U20/G35
mazgch 2:b7bd3660ff64 3 * mbed Internet of Things Starter Kit
mazgch 2:b7bd3660ff64 4 * http://mbed.org/platforms/u-blox-C027/
mazgch 2:b7bd3660ff64 5 *
mazgch 2:b7bd3660ff64 6 */
mazgch 2:b7bd3660ff64 7
mazgch 2:b7bd3660ff64 8 #include "C027.h"
mazgch 2:b7bd3660ff64 9
mazgch 2:b7bd3660ff64 10 void mbed_die(void)
mazgch 2:b7bd3660ff64 11 {
mazgch 2:b7bd3660ff64 12 for (;;)
mazgch 2:b7bd3660ff64 13 {
mazgch 2:b7bd3660ff64 14 // nothing to do here
mazgch 2:b7bd3660ff64 15
mazgch 3:b54777b90da1 16 // we do not have fancy leds that
mazgch 3:b54777b90da1 17 // can be flashed on the C027
mazgch 2:b7bd3660ff64 18 }
mazgch 2:b7bd3660ff64 19 }
mazgch 2:b7bd3660ff64 20
mazgch 6:e11bf54dd344 21 C027::C027() :
mazgch 6:e11bf54dd344 22 mdmEn(MDMEN), mdmRst(MDMRST), mdmPwrOn(MDMPWRON), mdmRts(MDMRTS),
mazgch 6:e11bf54dd344 23 gpsEn(GPSEN), gpsRst(GPSRST)
mazgch 6:e11bf54dd344 24 {
mazgch 6:e11bf54dd344 25 #define REVA
mazgch 6:e11bf54dd344 26 gpsEn = 0; // LDOEN: 1=on,0=off
mazgch 6:e11bf54dd344 27 gpsRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 28 gpsIsEnabled = false;
mazgch 6:e11bf54dd344 29
mazgch 6:e11bf54dd344 30 mdmPwrOn = 1; // PWRON: 1=idle,0=action
mazgch 6:e11bf54dd344 31 mdmRts = 0; // RTS. 0=ready to send
mazgch 6:e11bf54dd344 32 mdmEn = 0; // LDOEN: 1=on,0=off
mazgch 6:e11bf54dd344 33 mdmRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 34 mdmIsEnabled = false;
mazgch 6:e11bf54dd344 35 }
mazgch 6:e11bf54dd344 36
mazgch 6:e11bf54dd344 37 void C027::gpsPower(bool enable)
mazgch 6:e11bf54dd344 38 {
mazgch 6:e11bf54dd344 39 if (gpsIsEnabled != enable)
mazgch 6:e11bf54dd344 40 {
mazgch 6:e11bf54dd344 41 #ifdef REVA
mazgch 6:e11bf54dd344 42 gpsEn = mdmIsEnabled || enable;
mazgch 6:e11bf54dd344 43 #else
mazgch 6:e11bf54dd344 44 gpsEn = enable; // LDOEN: 1=on,0=off
mazgch 6:e11bf54dd344 45 #endif
mazgch 6:e11bf54dd344 46 wait_ms(10);
mazgch 6:e11bf54dd344 47 gpsIsEnabled = enable;
mazgch 6:e11bf54dd344 48 if (enable)
mazgch 6:e11bf54dd344 49 gpsReset();
mazgch 6:e11bf54dd344 50 else
mazgch 6:e11bf54dd344 51 gpsRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 52 }
mazgch 6:e11bf54dd344 53 }
mazgch 6:e11bf54dd344 54
mazgch 6:e11bf54dd344 55 void C027::mdmPower(bool enable)
mazgch 6:e11bf54dd344 56 {
mazgch 6:e11bf54dd344 57 if (mdmIsEnabled != enable)
mazgch 6:e11bf54dd344 58 {
mazgch 6:e11bf54dd344 59 #ifdef REVA
mazgch 6:e11bf54dd344 60 gpsEn = enable || gpsIsEnabled;
mazgch 6:e11bf54dd344 61 #endif
mazgch 6:e11bf54dd344 62 mdmEn = enable; // LDOEN: 1=on,0=off
mazgch 6:e11bf54dd344 63 mdmRst = 1;
mazgch 6:e11bf54dd344 64 wait_ms(10);
mazgch 6:e11bf54dd344 65 mdmIsEnabled = enable;
mazgch 6:e11bf54dd344 66 if (enable)
mazgch 6:e11bf54dd344 67 mdmReset();
mazgch 6:e11bf54dd344 68 else
mazgch 6:e11bf54dd344 69 mdmRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 70 }
mazgch 6:e11bf54dd344 71 }
mazgch 6:e11bf54dd344 72
mazgch 6:e11bf54dd344 73 void C027::mdmReset(void)
mazgch 6:e11bf54dd344 74 {
mazgch 6:e11bf54dd344 75 if (mdmIsEnabled)
mazgch 6:e11bf54dd344 76 {
mazgch 6:e11bf54dd344 77 mdmRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 78 wait_ms(50); // power on sequence is triggered by 50ms reset low
mazgch 6:e11bf54dd344 79 mdmRst = 1; // RESET: 1=operating,0=reset
mazgch 6:e11bf54dd344 80 }
mazgch 6:e11bf54dd344 81 }
mazgch 6:e11bf54dd344 82
mazgch 6:e11bf54dd344 83 void C027::gpsReset(void)
mazgch 6:e11bf54dd344 84 {
mazgch 6:e11bf54dd344 85 if (gpsIsEnabled)
mazgch 6:e11bf54dd344 86 {
mazgch 6:e11bf54dd344 87 gpsRst = 0; // RESET: 0=reset,1=operating
mazgch 6:e11bf54dd344 88 wait_ms(1);
mazgch 6:e11bf54dd344 89 gpsRst = 1; // RESET: 1=operating,0=reset
mazgch 6:e11bf54dd344 90 }
mazgch 6:e11bf54dd344 91 }