@@ -59,12 +59,14 @@ void ublox_mdm_powerOn(int usb)
59
59
// turn on the mode by enabling power with power on pin low and correct USB detect level
60
60
gpio_init_out_ex (& gpio , MDMUSBDET , usb ? 1 : 0 ); // USBDET: 0=disabled, 1=enabled
61
61
if (!modemOn ) { // enable modem
62
+ modemOn = true;
62
63
gpio_init_out_ex (& gpio , MDMEN , 1 ); // LDOEN: 1=on
63
64
wait_ms (1 ); // wait until supply switched off
64
65
// now we can safely enable the level shifters
65
66
gpio_init_out_ex (& gpio , MDMLVLOE , 0 ); // LVLEN: 0=enabled (uart/gpio)
66
- if (gpsOn )
67
+ if (gpsOn ) {
67
68
gpio_init_out_ex (& gpio , MDMILVLOE , 1 ); // ILVLEN: 1=enabled (i2c)
69
+ }
68
70
}
69
71
}
70
72
@@ -78,32 +80,35 @@ void ublox_mdm_powerOff(void)
78
80
{
79
81
gpio_t gpio ;
80
82
if (modemOn ) {
83
+ modemOn = false;
81
84
// diable all level shifters
82
85
gpio_init_out_ex (& gpio , MDMILVLOE , 0 ); // ILVLEN: 0=disabled (i2c)
83
86
gpio_init_out_ex (& gpio , MDMLVLOE , 1 ); // LVLEN: 1=disabled (uart/gpio)
84
87
gpio_init_out_ex (& gpio ,MDMUSBDET , 0 ); // USBDET: 0=disabled
85
88
// now we can savely switch off the ldo
86
89
gpio_init_out_ex (& gpio , MDMEN , 0 ); // LDOEN: 0=off
87
- modemOn = false;
88
90
}
89
91
}
90
92
91
93
void ublox_gps_powerOn (void )
92
94
{
93
95
gpio_t gpio ;
94
96
if (!gpsOn ) {
97
+ gpsOn = true;
95
98
// switch on power supply
96
99
gpio_init_out_ex (& gpio , GPSEN , 1 ); // LDOEN: 1=on
97
100
wait_ms (1 ); // wait until supply switched off
98
- if (modemOn )
101
+ if (modemOn ) {
99
102
gpio_init_out_ex (& gpio , MDMILVLOE , 1 ); // ILVLEN: 1=enabled (i2c)
103
+ }
100
104
}
101
105
}
102
106
103
107
void ublox_gps_powerOff (void )
104
108
{
105
109
gpio_t gpio ;
106
110
if (gpsOn ) {
111
+ gpsOn = false;
107
112
gpio_init_out_ex (& gpio , MDMILVLOE , 0 ); // ILVLEN: 0=disabled (i2c)
108
113
gpio_init_out_ex (& gpio , GPSEN , 0 ); // LDOEN: 0=off
109
114
}
0 commit comments