Skip to content

Commit 1859ca7

Browse files
committed
changes per comments
1 parent 008565f commit 1859ca7

File tree

4 files changed

+58
-48
lines changed

4 files changed

+58
-48
lines changed

adafruit_pn532/i2c.py

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,43 @@ def __init__(
5050
uses clock stretching. Optional IRQ pin (not used),
5151
resetp pin and debugging output.
5252
53-
:param busio.I2C i2c: The I2C bus the PN532 is connected to.
53+
:param ~busio.I2C i2c: The I2C bus the PN532 is connected to.
5454
:param int address: The I2C device address. Defaults to :const:`0x24`
55-
:param DigitalInOut reset: board pin the PN532 reset is connected to
56-
:param DigitalInOut req: board pin the PN532 P32 is connected to
57-
:param bool debug: if true print additional debug statements
55+
:param digitalio.DigitalInOut reset: board pin the PN532 reset is connected to
56+
:param digitalio.DigitalInOut req: board pin the PN532 P32 is connected to
57+
:param bool debug: if True print additional debug statements. Defaults to False
5858
5959
**Quickstart: Importing and using the device**
60-
Here is an example of using the :class:`PN532_I2C` class.
61-
First you will need to import the libraries to use the sensor
6260
63-
.. code-block:: python
61+
Here is an example of using the :class:`PN532_I2C` class.
62+
First you will need to import the libraries to use the sensor
6463
65-
import board
66-
import busio
67-
from digitalio import DigitalInOut
68-
from adafruit_pn532.i2c import PN532_I2C
64+
.. code-block:: python
6965
70-
Once this is done you can define your `board.I2C` object and define your object
71-
.. code-block:: python
66+
import board
67+
import busio
68+
from digitalio import DigitalInOut
69+
from adafruit_pn532.i2c import PN532_I2C
7270
73-
i2c = busio.I2C(board.SCL, board.SDA)
74-
reset_pin = DigitalInOut(board.D6)
75-
# On Raspberry Pi, you must also connect a pin to P32 "H_Request" for hardware
76-
# wakeup! this means we don't need to do the I2C clock-stretch thing
77-
req_pin = DigitalInOut(board.D12)
78-
pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin)
79-
# Configure PN532 to communicate with MiFare cards
80-
pn532.SAM_configuration()
71+
Once this is done you can define your `board.I2C` object and define your object
8172
82-
Now you have access to the attributes and functions of the PN532 RFID/NFC shield or breakout
73+
.. code-block:: python
8374
84-
.. code-block:: python
75+
i2c = busio.I2C(board.SCL, board.SDA)
76+
reset_pin = DigitalInOut(board.D6)
77+
# On Raspberry Pi, you must also connect a pin to P32 "H_Request" for hardware
78+
# wakeup! this means we don't need to do the I2C clock-stretch thing
79+
req_pin = DigitalInOut(board.D12)
80+
pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin)
81+
# Configure PN532 to communicate with MiFare cards
82+
pn532.SAM_configuration()
8583
86-
uid = pn532.read_passive_target(timeout=0.5)
84+
Now you have access to the attributes and functions of the PN532 RFID/NFC
85+
shield or breakout
86+
87+
.. code-block:: python
88+
89+
uid = pn532.read_passive_target(timeout=0.5)
8790
8891
"""
8992
self.debug = debug

adafruit_pn532/spi.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def __init__(
6464
"""Create an instance of the PN532 class using SPI
6565
Optional IRQ pin (not used)
6666
67-
:param busio.SPI spi: The spi bus the PN532 is connected to.
68-
:param DigitalInOut cs: board pin the PN532 chip select line is connected to
69-
:param DigitalInOut irq: board pin the PN532 P32 is connected to
70-
:param DigitalInOut reset: board pin the PN532 reset is connected to
71-
:param bool debug: if true print additional debug statements
67+
:param ~busio.SPI spi: The spi bus the PN532 is connected to.
68+
:param digitalio.DigitalInOut cs: board pin the PN532 chip select line is connected to
69+
:param digitalio.DigitalInOut irq: board pin the PN532 P32 is connected to
70+
:param digitalio.DigitalInOut reset: board pin the PN532 reset is connected to
71+
:param bool debug: if True print additional debug statements. Defaults to False
7272
7373
**Quickstart: Importing and using the device**
74-
Here is an example of using the :class:`PN532_I2C` class.
74+
Here is an example of using the :class:`PN532_SPI` class.
7575
First you will need to import the libraries to use the sensor
7676
7777
.. code-block:: python
@@ -82,13 +82,15 @@ def __init__(
8282
from adafruit_pn532.spi import PN532_SPI
8383
8484
Once this is done you can define your `busio.SPI` object and define your PN532 object
85+
8586
.. code-block:: python
8687
8788
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
8889
cs_pin = DigitalInOut(board.D5)
8990
pn532 = PN532_SPI(spi, cs_pin, debug=False)
9091
91-
Now you have access to the attributes and functions of the PN532 RFID/NFC shield or breakout
92+
Now you have access to the attributes and functions of the PN532 RFID/NFC
93+
shield or breakout
9294
9395
.. code-block:: python
9496

adafruit_pn532/uart.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,35 @@ def __init__(
3838
"""Create an instance of the PN532 class using Serial connection.
3939
Optional reset pin and debugging output.
4040
41-
:param busio.UART i2c: The I2C bus the PN532 is connected to.
42-
:param DigitalInOut reset: board pin the PN532 reset is connected to
43-
:param bool debug: if true print additional debug statements
41+
:param ~busio.UART uart: The uart object the PN532 is connected to.
42+
:param digitalio.DigitalInOut reset: board pin the PN532 reset is connected to
43+
:param bool debug: if True print additional debug statements. Defaults to False
4444
4545
**Quickstart: Importing and using the device**
46-
Here is an example of using the :class:`PN532_I2C` class.
47-
First you will need to import the libraries to use the sensor
4846
49-
.. code-block:: python
47+
Here is an example of using the :class:`PN532_I2C` class.
48+
First you will need to import the libraries to use the sensor
5049
51-
import board
52-
import busio
53-
from digitalio import DigitalInOut
54-
from adafruit_pn532.uart import PN532_UART
50+
.. code-block:: python
5551
56-
Once this is done you can define your `busio.UART` object and define your PN532 object
57-
.. code-block:: python
52+
import board
53+
import busio
54+
from digitalio import DigitalInOut
55+
from adafruit_pn532.uart import PN532_UART
5856
59-
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0.1)
60-
pn532 = PN532_UART(uart, debug=False)
57+
Once this is done you can define your `busio.UART` object and define your PN532 object
6158
62-
Now you have access to the attributes and functions of the PN532 RFID/NFC shield or breakout
59+
.. code-block:: python
6360
64-
.. code-block:: python
61+
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0.1)
62+
pn532 = PN532_UART(uart, debug=False)
6563
66-
uid = pn532.read_passive_target(timeout=0.5)
64+
Now you have access to the attributes and functions of the PN532 RFID/NFC
65+
shield or breakout
66+
67+
.. code-block:: python
68+
69+
uid = pn532.read_passive_target(timeout=0.5)
6770
6871
"""
6972
self.debug = debug

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
4040
}
4141

42+
autoclass_content = "both"
43+
4244
# Add any paths that contain templates here, relative to this directory.
4345
templates_path = ["_templates"]
4446

0 commit comments

Comments
 (0)