Skip to content

Commit de00d48

Browse files
committed
Fix code blocks and Sphinx params
1 parent df96549 commit de00d48

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

adafruit_24lc32.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
class EEPROM:
4848
"""
4949
Driver base for the EEPROM Breakout.
50+
51+
:param int max_size: The maximum size of the EEPROM
52+
:param bool write_protect: Turns on/off initial write protection
53+
:param DigitalInOut wp_pin: (Optional) Physical pin connected to the ``WP`` breakout pin.
54+
Must be a ``DigitalInOut`` object.
5055
"""
5156

5257
def __init__(self, max_size: int, write_protect: bool = False, wp_pin: Optional[DigitalInOut] = None) -> None:
@@ -79,9 +84,11 @@ def write_wraparound(self, value: bool) -> None:
7984
def write_protected(self) -> bool:
8085
"""The status of write protection. Default value on initialization is
8186
``False``.
87+
8288
When a ``WP`` pin is supplied during initialization, or using
8389
``write_protect_pin``, the status is tied to that pin and enables
8490
hardware-level protection.
91+
8592
When no ``WP`` pin is supplied, protection is only at the software
8693
level in this library.
8794
"""
@@ -90,7 +97,9 @@ def write_protected(self) -> bool:
9097
def __len__(self) -> int:
9198
"""The size of the current EEPROM chip. This is one more than the highest
9299
address location that can be read or written to.
100+
93101
.. code-block:: python
102+
94103
eeprom = adafruit_24lc32.EEPROM_I2C()
95104
# size returned by len()
96105
len(eeprom)
@@ -101,7 +110,9 @@ def __len__(self) -> int:
101110

102111
def __getitem__(self, address: Union[int, slice]) -> bytearray:
103112
"""Read the value at the given index, or values in a slice.
113+
104114
.. code-block:: python
115+
105116
# read single index
106117
eeprom[0]
107118
# read values 0 thru 9 with a slice
@@ -139,7 +150,9 @@ def __getitem__(self, address: Union[int, slice]) -> bytearray:
139150

140151
def __setitem__(self, address: Union[int, slice], value: Union[int, Sequence[int]]) -> None:
141152
"""Write the value at the given starting index.
153+
142154
.. code-block:: python
155+
143156
# write single index
144157
eeprom[0] = 1
145158
# write values 0 thru 4 with a list
@@ -194,12 +207,13 @@ def _write(self, start_address: int, data: Union[int, Sequence[int]], wraparound
194207

195208
class EEPROM_I2C(EEPROM):
196209
"""I2C class for EEPROM.
197-
:param: ~busio.I2C i2c_bus: The I2C bus the EEPROM is connected to.
198-
:param: int address: I2C address of EEPROM. Default address is ``0x50``.
199-
:param: bool write_protect: Turns on/off initial write protection.
200-
Default is ``False``.
201-
:param: wp_pin: (Optional) Physical pin connected to the ``WP`` breakout pin.
202-
Must be a ``digitalio.DigitalInOut`` object.
210+
211+
:param ~busio.I2C i2c_bus: The I2C bus the EEPROM is connected to.
212+
:param int address: I2C address of EEPROM. Default address is ``0x50``.
213+
:param bool write_protect: Turns on/off initial write protection.
214+
Default is ``False``.
215+
:param wp_pin: (Optional) Physical pin connected to the ``WP`` breakout pin.
216+
Must be a ``DigitalInOut`` object.
203217
"""
204218

205219
# pylint: disable=too-many-arguments

0 commit comments

Comments
 (0)