Skip to content

Commit

Permalink
Bump gpiodevice version and update examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Apr 23, 2024
1 parent 1df6e38 commit c9a2673
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
22 changes: 19 additions & 3 deletions examples/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,46 @@
# Configure the PMS5003 for Enviro+
# pins and ports may vary for your hardware!

# Default, try to auto-detect platform
# Default, assume Raspberry Pi compatible, running Raspberry Pi OS Bookworm
pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600)

# Raspberry Pi 4 (Raspberry Pi OS)
#
# GPIO22 and GPIO27 are enable and reset for Raspberry Pi 4
# use "raspi-config" to enable serial, or add
# "dtoverlay=uart0" to /boot/config.txt
#
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="GPIO22", pin_reset="GPIO27")

# Raspberry Pi 5 (Raspberry Pi OS)
# PIN15 and PIN13 are enable and reset for Raspberry Pi 5
#
# GPIO22 and GPIO27 are enable and reset for Raspberry Pi 5
# On older versions of Bookworm these might be PIN15 and PIN13
# use "raspi-config" to enable serial, or add
# "dtoverlay=uart0-pi5" to /boot/firmware/config.txt
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="PIN15", pin_reset="PIN13")
#
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="GPIO22", pin_reset="GPIO27")

# ROCK 5B
#
# Use "armbian-config" to enable rk3568-uart2-m0
# Disable console on ttyS2 with:
# sudo systemctl stop [email protected]
# sudo systemctl disable [email protected]
# sudo systemctl mask [email protected]
# add "console=display" to /boot/armbianEnv.txt
#
# pms5003 = PMS5003(device="/dev/ttyS2", baudrate=9600, pin_enable="PIN_15", pin_reset="PIN_13")

# Other
#
# Use gpiod to request the pins you want, and pass those into PMS5003 as LineRequest, offset tuples.
#
# from pms5003 import OUTL, OUTH
# from gpiod import Chip
# lines = Chip.request_lines(consumer="PMS5003", config={22: OUTH, 27: OUTL})
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable=(lines, 22), pin_reset=(lines, 27))

try:
while True:
data = pms5003.read()
Expand Down
23 changes: 20 additions & 3 deletions examples/specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,47 @@
# Configure the PMS5003 for Enviro+
# pins and ports may vary for your hardware!

# Default, try to auto-detect platform
# Default, assume Raspberry Pi compatible, running Raspberry Pi OS Bookworm
pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600)

# Raspberry Pi 4 (Raspberry Pi OS)
#
# GPIO22 and GPIO27 are enable and reset for Raspberry Pi 4
# use "raspi-config" to enable serial, or add
# "dtoverlay=uart0" to /boot/config.txt
#
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="GPIO22", pin_reset="GPIO27")

# Raspberry Pi 5 (Raspberry Pi OS)
# PIN15 and PIN13 are enable and reset for Raspberry Pi 5
#
# GPIO22 and GPIO27 are enable and reset for Raspberry Pi 5
# On older versions of Bookworm these might be PIN15 and PIN13
# use "raspi-config" to enable serial, or add
# "dtoverlay=uart0-pi5" to /boot/firmware/config.txt
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="PIN15", pin_reset="PIN13")
#
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable="GPIO22", pin_reset="GPIO27")

# ROCK 5B
#
# Use "armbian-config" to enable rk3568-uart2-m0
# Disable console on ttyS2 with:
# sudo systemctl stop [email protected]
# sudo systemctl disable [email protected]
# sudo systemctl mask [email protected]
# add "console=display" to /boot/armbianEnv.txt
#
# pms5003 = PMS5003(device="/dev/ttyS2", baudrate=9600, pin_enable="PIN_15", pin_reset="PIN_13")

# Other
#
# Use gpiod to request the pins you want, and pass those into PMS5003 as LineRequest, offset tuples.
#
# from pms5003 import OUTL, OUTH
# from gpiod import Chip
# lines = Chip.request_lines(consumer="PMS5003", config={22: OUTH, 27: OUTL})
# pms5003 = PMS5003(device="/dev/ttyAMA0", baudrate=9600, pin_enable=(lines, 22), pin_reset=(lines, 27))


try:
while True:
data = pms5003.read()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ classifiers = [
]
dependencies = [
"gpiod",
"gpiodevice",
"gpiodevice>=0.0.4",
"pyserial"
]

Expand Down

0 comments on commit c9a2673

Please sign in to comment.