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 adafruit_24lc32.py to add max_size parameter to EEPROM_I2C #23

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Changes from all 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
5 changes: 4 additions & 1 deletion adafruit_24lc32.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ class EEPROM_I2C(EEPROM):
Default is ``False``.
:param wp_pin: (Optional) Physical pin connected to the ``WP`` breakout pin.
Must be a ``DigitalInOut`` object.
:param max_int: (Optional) Maximum # bytes stored in the EEPROM.
Default is ``_MAX_SIZE_I2C``
"""

# pylint: disable=too-many-arguments
Expand All @@ -232,13 +234,14 @@ def __init__(
address: int = 0x50,
write_protect: bool = False,
wp_pin: Optional[DigitalInOut] = None,
max_size: int = _MAX_SIZE_I2C,
) -> None:
from adafruit_bus_device.i2c_device import ( # pylint: disable=import-outside-toplevel
I2CDevice as i2cdev,
)

self._i2c = i2cdev(i2c_bus, address)
super().__init__(_MAX_SIZE_I2C, write_protect, wp_pin)
super().__init__(max_size, write_protect, wp_pin)

def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
write_buffer = bytearray(2)
Expand Down