Skip to content
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

Update ValueError text, example files #32

Merged
merged 4 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adafruit_fram.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __setitem__(self, address, value):

if isinstance(address, int):
if not isinstance(value, int):
raise ValueError("Data must be a single integer for single addresses")
raise ValueError("Data stored in an address must be an integer 0-255")
if not 0 <= address < self._max_size:
raise ValueError(
"Address '{0}' out of range. It must be 0 <= address < {1}.".format(
Expand Down
6 changes: 3 additions & 3 deletions examples/fram_i2c_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
## a buffer the size of slice, which may cause
## problems on memory-constrained platforms.

# values = list(range(100)) # or bytearray or tuple
# fram[0] = values
# print(fram[0:99])
values = list(range(100)) # or bytearray or tuple
fram[0:100] = values
tekktrik marked this conversation as resolved.
Show resolved Hide resolved
print(fram[0:100])
6 changes: 3 additions & 3 deletions examples/fram_spi_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
## a buffer the size of 'length', which may cause
## problems on memory-constrained platforms.

# values = list(range(100)) # or bytearray or tuple
# fram[0] = values
# print(fram[0:99])
values = list(range(100)) # or bytearray or tuple
fram[0:100] = values
tekktrik marked this conversation as resolved.
Show resolved Hide resolved
print(fram[0:100])