forked from schodet/nxt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix writing I2C messages when I2C addr >= 0x80
Since strings in python3 are UTF-8, calling chr() on an I2C address >= 0x80 would create an invalid UTF-8 character (0x80 to 0xFF are illegal). Then later, when encode() was called in add_string(), a UnicodeEncodeError exception would be thrown because of this. This adds a new add_bytes() method to the Telegram class for adding bytes objects. Then, this new method is used in ls_write() so that we can pass arbitrary I2C addresses without error.
- Loading branch information
Showing
3 changed files
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters