Allow a jumper to enable booting directly to passthrough mode

Connect the SDA/SCL pins with a jumper or low value (e.g., 1K)
resistor to enable passthrough mode.  Disconnect the jumper to return
to normal mode.  These are pins 7/8 on the 10-pin connector, so they
are convenient to short with a standard .100 jumper block.
This commit is contained in:
Jeff Epler 2018-07-06 20:36:44 -05:00
parent 16df1ad584
commit c86e552d7f

View file

@ -40,9 +40,19 @@ void setup()
{
Serial.begin(9600);
while (!Serial);
Serial.println(F(""));
Serial.println(F("Zachtek GPS referenced RF, Software version: " softwareversion));
if(strapped_for_passthrough()) {
pinMode(LDO_Enable, OUTPUT); // Set Voltage Regulator Enable pin as output.
digitalWrite(LDO_Enable, HIGH); //Turn on 3.1V Power supply for the Ublox GPS module
gpsPort.begin(9600);
passthrough = 1;
Serial.println(F("Strapped for passthrough. Disconnect jumper between SDA/SCL for normal operation"));
return;
}
pinMode(LDO_Enable, OUTPUT); // Set Voltage Regulator Enable pin as output.
//Blink the Lock led
@ -301,4 +311,26 @@ boolean getUBX_ACK(uint8_t *MSG) {
}//else
}//If
}//While
}//getUBX_ACK
}//getUBX_ACK
// If pins 7/8 on the 10-pin header are bridged, this is "strapped for passthrough"
// Detect this by driving one pin high and checking the other pin, then driving low and repeating
// set pins back to inputs before returning
bool strapped_for_passthrough() {
bool result = true;
pinMode(A4, OUTPUT);
digitalWrite(A4, HIGH);
delay(1);
if(!digitalRead(A5)) result = false;
digitalWrite(A4, LOW);
pinMode(A5, INPUT_PULLUP);
delay(1);
if(digitalRead(A5)) result = false;
pinMode(A4, INPUT);
pinMode(A5, INPUT);
return result;
}