Skip to content

Commit

Permalink
wrote module docs
Browse files Browse the repository at this point in the history
  • Loading branch information
XENONFFM committed Aug 16, 2024
1 parent 930f9e9 commit f742296
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions pca9674/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Finn Scheller
#
# SPDX-License-Identifier: MIT
"""
PCA9674 Digital IO Expander
====================================================
The `pca9674` module contains classes to support the PCA9674 and PCA9674A I2C I/O extenders.
Each pin can be accessed directly or as a digitalio pin object.
* Author(s): Finn Scheller
"""
1 change: 1 addition & 0 deletions pca9674/digital_inout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
====================================================
Digital input/output of the PCA9674.
Enables the use of the PCA9674 I/O as a digitalio pin object.
* Author(s): Finn Scheller
"""
Expand Down
17 changes: 15 additions & 2 deletions pca9674/pca9674.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,21 @@


class PCA9674:
OUTPUT = 0
INPUT = 1
"""Supports PCA9674(A) instance on specified I2C bus and optionally
at the specified I2C address.
:param ~I2C i2c: The i2c bus
:param int address: The I2C address of the device
:param int pin_config: The initial pin configuration, defaults to 0x00 (all pins as outputs)
Configure each pin as input (0) or output (1). To set all pins as inputs, use 0xFF.
The PCA9674(A) has 8 pins, numbered 1-8.
The least significant bit (LSB) corresponds to pin 1.
Example: To set pins 1, 2, 5, 6 as outputs and 3, 4, 7, 8 as inputs,
use 0xF0 (in binary: 0b11001100).
"""

def __init__(self, i2c: I2C, address: int = _PCA9674_ADDRESS, pin_config=0x00):
self.i2c = i2c
Expand Down

0 comments on commit f742296

Please sign in to comment.