1313 #endif
1414#endif
1515
16- #ifndef PIN_GPS_EN_ACTIVE
17- #define PIN_GPS_EN_ACTIVE HIGH
16+ #ifndef GPS_EN_ACTIVE
17+ #ifdef PIN_GPS_EN_ACTIVE
18+ #define GPS_EN_ACTIVE PIN_GPS_EN_ACTIVE
19+ #else
20+ #define GPS_EN_ACTIVE HIGH
21+ #endif
1822#endif
1923
2024#ifndef GPS_RESET
2529 #endif
2630#endif
2731
28- #ifndef GPS_RESET_FORCE
32+ #ifndef GPS_RESET_ACTIVE
2933 #ifdef PIN_GPS_RESET_ACTIVE
30- #define GPS_RESET_FORCE PIN_GPS_RESET_ACTIVE
34+ #define GPS_RESET_ACTIVE PIN_GPS_RESET_ACTIVE
3135 #else
32- #define GPS_RESET_FORCE LOW
36+ #define GPS_RESET_ACTIVE LOW
3337 #endif
3438#endif
3539
@@ -52,11 +56,11 @@ public :
5256 nmea (_nmeaBuffer, sizeof (_nmeaBuffer)), _clock(clock), _gps_serial(&ser), _peripher_power(peripher_power), _pin_reset(pin_reset), _pin_en(pin_en) {
5357 if (_pin_reset != -1 ) {
5458 pinMode (_pin_reset, OUTPUT );
55- digitalWrite (_pin_reset, GPS_RESET_FORCE );
59+ digitalWrite (_pin_reset, GPS_RESET_ACTIVE );
5660 }
5761 if (_pin_en != -1 ) {
5862 pinMode (_pin_en, OUTPUT );
59- digitalWrite (_pin_en, LOW );
63+ digitalWrite (_pin_en, ! GPS_EN_ACTIVE );
6064 }
6165 }
6266
@@ -74,27 +78,27 @@ public :
7478 void begin () override {
7579 claim ();
7680 if (_pin_en != -1 ) {
77- digitalWrite (_pin_en, PIN_GPS_EN_ACTIVE );
81+ digitalWrite (_pin_en, GPS_EN_ACTIVE );
7882 }
7983 if (_pin_reset != -1 ) {
80- digitalWrite (_pin_reset, !GPS_RESET_FORCE );
84+ digitalWrite (_pin_reset, !GPS_RESET_ACTIVE );
8185 }
8286 }
8387
8488 void reset () override {
8589 if (_pin_reset != -1 ) {
86- digitalWrite (_pin_reset, GPS_RESET_FORCE );
90+ digitalWrite (_pin_reset, GPS_RESET_ACTIVE );
8791 delay (10 );
88- digitalWrite (_pin_reset, !GPS_RESET_FORCE );
92+ digitalWrite (_pin_reset, !GPS_RESET_ACTIVE );
8993 }
9094 }
9195
9296 void stop () override {
9397 if (_pin_en != -1 ) {
94- digitalWrite (_pin_en, !PIN_GPS_EN_ACTIVE );
98+ digitalWrite (_pin_en, !GPS_EN_ACTIVE );
9599 }
96100 if (_pin_reset != -1 ) {
97- digitalWrite (_pin_reset, GPS_RESET_FORCE );
101+ digitalWrite (_pin_reset, GPS_RESET_ACTIVE );
98102 }
99103 release ();
100104 }
@@ -103,7 +107,7 @@ public :
103107 // directly read the enable pin if present as gps can be
104108 // activated/deactivated outside of here ...
105109 if (_pin_en != -1 ) {
106- return digitalRead (_pin_en) == PIN_GPS_EN_ACTIVE ;
110+ return digitalRead (_pin_en) == GPS_EN_ACTIVE ;
107111 } else {
108112 return true ; // no enable so must be active
109113 }
0 commit comments