mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/platform_init.c@83:5a6f638110fe, 2014-01-31 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jan 31 10:15:06 2014 +0000
- Revision:
- 83:5a6f638110fe
- Parent:
- 81:a9456fdf72fa
- Child:
- 113:65a335a675de
Synchronized with git revision 2665d5bac442dc1267d1bf5ff1eb6c90ccc7d0bf
Full URL: https://github.com/mbedmicro/mbed/commit/2665d5bac442dc1267d1bf5ff1eb6c90ccc7d0bf/
Added a new function (mbed_sdk_init) that can be used by the SDK itself to
do initializations before main() is called.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 81:a9456fdf72fa | 1 | |
mbed_official | 81:a9456fdf72fa | 2 | #include "gpio_api.h" |
mbed_official | 81:a9456fdf72fa | 3 | #include "wait_api.h" |
mbed_official | 81:a9456fdf72fa | 4 | |
mbed_official | 81:a9456fdf72fa | 5 | // called before main |
mbed_official | 83:5a6f638110fe | 6 | void mbed_sdk_init() |
mbed_official | 81:a9456fdf72fa | 7 | { |
mbed_official | 81:a9456fdf72fa | 8 | gpio_t modemEn, modemRst, modemPwrOn, modemLvlOe, modemILvlOe, modemUsbDet; |
mbed_official | 81:a9456fdf72fa | 9 | gpio_t gpsEn, gpsRst, led, modemRts; |
mbed_official | 81:a9456fdf72fa | 10 | |
mbed_official | 81:a9456fdf72fa | 11 | gpio_init(&modemEn, MDMEN, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 12 | gpio_init(&modemRst, MDMRST, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 13 | gpio_init(&modemPwrOn, MDMPWRON, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 14 | gpio_init(&modemLvlOe, MDMLVLOE, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 15 | gpio_init(&modemILvlOe, MDMILVLOE, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 16 | gpio_init(&modemUsbDet, MDMUSBDET, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 17 | gpio_init(&gpsEn, GPSEN, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 18 | gpio_init(&gpsRst, GPSRST, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 19 | gpio_init(&led, LED, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 20 | gpio_init(&modemRts, MDMRTS, PIN_OUTPUT); |
mbed_official | 81:a9456fdf72fa | 21 | |
mbed_official | 81:a9456fdf72fa | 22 | gpio_write(&led, 0); // LED1: 0=off |
mbed_official | 81:a9456fdf72fa | 23 | gpio_write(&modemRts, 0); // RTS: 0=ready to send |
mbed_official | 81:a9456fdf72fa | 24 | // we start with the gps disabled |
mbed_official | 81:a9456fdf72fa | 25 | gpio_write(&gpsEn, 0); // LDOEN: 1=on,0=off |
mbed_official | 81:a9456fdf72fa | 26 | gpio_write(&gpsRst, 0); // RESET: 0=reset,1=operating |
mbed_official | 81:a9456fdf72fa | 27 | // we start with the modem disabled |
mbed_official | 81:a9456fdf72fa | 28 | gpio_write(&modemLvlOe, 1); // LVLEN: 1=disabled (uart/gpio) |
mbed_official | 81:a9456fdf72fa | 29 | gpio_write(&modemILvlOe, 0); // ILVLEN: 0=disabled (i2c) |
mbed_official | 81:a9456fdf72fa | 30 | gpio_write(&modemUsbDet, 0); // USBDET: 0=disabled |
mbed_official | 81:a9456fdf72fa | 31 | gpio_write(&modemPwrOn, 1); // PWRON: 1=idle, 0=action |
mbed_official | 81:a9456fdf72fa | 32 | gpio_write(&modemEn, 0); // LDOEN: 1=on, 0=off |
mbed_official | 81:a9456fdf72fa | 33 | gpio_write(&modemRst, 0); // RESET: 0=reset, 1=operating |
mbed_official | 81:a9456fdf72fa | 34 | |
mbed_official | 81:a9456fdf72fa | 35 | wait_ms(50); // when USB cable is inserted the interface chip issues |
mbed_official | 81:a9456fdf72fa | 36 | // multiple resets to the target CPU We wait here for a short period to |
mbed_official | 81:a9456fdf72fa | 37 | // prevent those resets from propagating to the modem and other |
mbed_official | 81:a9456fdf72fa | 38 | // components. |
mbed_official | 81:a9456fdf72fa | 39 | } |