Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C027 Fix for modemOn flag #10530

Merged
merged 1 commit into from
May 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ void ublox_mdm_powerOn(int usb)
// turn on the mode by enabling power with power on pin low and correct USB detect level
gpio_init_out_ex(&gpio, MDMUSBDET, usb ? 1 : 0); // USBDET: 0=disabled, 1=enabled
if (!modemOn) { // enable modem
modemOn = true;
gpio_init_out_ex(&gpio, MDMEN, 1); // LDOEN: 1=on
wait_ms(1); // wait until supply switched off
// now we can safely enable the level shifters
gpio_init_out_ex(&gpio, MDMLVLOE, 0); // LVLEN: 0=enabled (uart/gpio)
if (gpsOn)
if (gpsOn) {
gpio_init_out_ex(&gpio, MDMILVLOE, 1); // ILVLEN: 1=enabled (i2c)
}
}
}

Expand All @@ -78,32 +80,35 @@ void ublox_mdm_powerOff(void)
{
gpio_t gpio;
if (modemOn) {
modemOn = false;
// diable all level shifters
gpio_init_out_ex(&gpio, MDMILVLOE, 0); // ILVLEN: 0=disabled (i2c)
gpio_init_out_ex(&gpio, MDMLVLOE, 1); // LVLEN: 1=disabled (uart/gpio)
gpio_init_out_ex(&gpio,MDMUSBDET, 0); // USBDET: 0=disabled
// now we can savely switch off the ldo
gpio_init_out_ex(&gpio, MDMEN, 0); // LDOEN: 0=off
modemOn = false;
}
}

void ublox_gps_powerOn(void)
{
gpio_t gpio;
if (!gpsOn) {
gpsOn = true;
// switch on power supply
gpio_init_out_ex(&gpio, GPSEN, 1); // LDOEN: 1=on
wait_ms(1); // wait until supply switched off
if (modemOn)
if (modemOn) {
gpio_init_out_ex(&gpio, MDMILVLOE, 1); // ILVLEN: 1=enabled (i2c)
}
}
}

void ublox_gps_powerOff(void)
{
gpio_t gpio;
if (gpsOn) {
gpsOn = false;
gpio_init_out_ex(&gpio, MDMILVLOE, 0); // ILVLEN: 0=disabled (i2c)
gpio_init_out_ex(&gpio, GPSEN, 0); // LDOEN: 0=off
}
Expand Down