Skip to content

Make compatible with pyserial, add some examples as well for computer usage #8

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

Merged
merged 10 commits into from
Aug 19, 2018

Conversation

ladyada
Copy link
Member

@ladyada ladyada commented Aug 19, 2018

mostly turning everything into bytes instead of using strings

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! See comments.

adafruit_gps.py Outdated
data_type, args = sentence
data_type = data_type.upper()
if data_type == 'GPGGA': # GGA, 3d location fix
data_type = bytes(data_type.upper(), "utf-8")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using "ascii" here and below as the encoding? In CircuitPython this arg is ignored (you can say "foobar"), but in regular Python it has to be an encoding name. If pyserial is reading junk with chars >128, then it will throw an error:

>>> bytes('ab\xbb', 'ascii')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xbb' in position 2: ordinal not in range(128)
>>> bytes('ab\xbb', 'utf-8')
b'ab\xc2\xbb'
>>> 

adafruit_gps.py Outdated
self._uart.write('\r\n')
checksum ^= char
self._uart.write(b'*')
self._uart.write(bytes('{:02x}'.format(checksum).upper(), "utf-8"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"utf-8" -> "ascii", per previous comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah im into it. lemme do that

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okee dokee!

@dhalbert dhalbert merged commit 6416856 into adafruit:master Aug 19, 2018
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 20, 2018
Updating https://github.com/adafruit/Adafruit_CircuitPython_Fingerp to 1.1.1 from 1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Fingerp#9 from ladyada/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C to 1.2.0 from 1.1.0:
  > fix context typo
  > make sure they get a recent version of busdevice with i2c write-then-read support
  > fix wrong reference & pylint
  > use single call for i2c transactions, to support linux

Updating https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700 to 1.2.0 from 1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#9 from ladyada/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.1.1 from 3.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_GPS#8 from ladyada/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_MMA8451 to 1.2.0 from 1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MMA8451#3 from ladyada/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 2.2.5 from 2.2.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#21 from ladyada/master
siddacious pushed a commit that referenced this pull request Aug 31, 2019
Moving Bill's changes to my repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants