Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 3693deb

Browse files
committed
revert gps_standby()
otherwise the GPS chip is (almost never) reachable over i2c
1 parent 7628995 commit 3693deb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

shields/lib/pycoproc_2.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,21 @@ def read_battery_voltage(self):
340340
return (((adc_val * 3.3 * 280) / 1023) / 180) + 0.01 # add 10mV to compensate for the drop in the FET
341341

342342
def gps_standby(self, enabled=True):
343-
# make RC4 an output
344-
self.write_bit(TRISC_ADDR, 4, 0)
345343
if enabled:
346-
# drive RC4 low
347-
self.write_bit(LATC_ADDR, 4, 0)
344+
# make RC4 input
345+
self.set_bits_in_memory(TRISC_ADDR, 1 << 4)
348346
else:
347+
# make RC4 an output
348+
self.mask_bits_in_memory(TRISC_ADDR, ~(1 << 4))
349+
# drive RC4 high
350+
self.set_bits_in_memory(PORTC_ADDR, 1 << 4)
351+
time.sleep(0.2)
352+
# drive RC4 low
353+
self.mask_bits_in_memory(PORTC_ADDR, ~(1 << 4))
354+
time.sleep(0.2)
349355
# drive RC4 high
350-
self.write_bit(LATC_ADDR, 4, 1)
356+
self.set_bits_in_memory(PORTC_ADDR, 1 << 4)
357+
time.sleep(0.2)
351358

352359
def sensor_power(self, enabled=True):
353360
# make RC7 an output

0 commit comments

Comments
 (0)