The PT2323
class provides a MicroPython implementation for controlling the PT2323 6-Channel Audio Selector IC using
I2C communication. This library offers an intuitive interface for managing audio sources, channel muting, master mute,
enhance surround mode, and mixed channel setups.
- Download the
PT2323.py
file from this repository. - Copy the file to your MicroPython device, placing it in the same directory as your project.
Import the PT2323
class and initialize it with your I2C port:
from PT2323 import PT2323
from machine import Pin, I2C
# Initialize the I2C port (replace with your pins)
i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=100000)
# Initialize the PT2323 instance
pt2323 = PT2323(port=i2c)
Set the input source to route audio stereo group or the 6-channel input:
# Set input source to the third stereo group (0-4)
pt2323.input_source(source=2)
Enable or disable the master mute for all channels:
# Mute all channels
pt2323.master_mute(status=True)
# Unmute all channels
pt2323.master_mute(status=False)
Enable or disable mute for a specific channel (0-5):
# Mute channel 2
pt2323.channel_mute(channel=1, status=True)
# Unmute channel 4
pt2323.channel_mute(channel=3, status=False)
Enable or disable the surround sound enhancement:
# Enable surround mode
pt2323.enhance_surround(status=True)
# Disable surround mode
pt2323.enhance_surround(status=False)
Enable or disable the 2-channel to 6-channel audio translation:
# Enable mixed channel setup
pt2323.mixed_channel(status=True)
# Disable mixed channel setup
pt2323.mixed_channel(status=False)
For comprehensive details about the PT2323 functionality and usage, please refer to the official PT2323 documentation.
The class documentation offers in-depth explanations, usage examples, and detailed parameter information for each method.
If you're new to the PT2323 6-Channel Audio Selector IC and its usage with the provided MicroPython code, here's how to start:
- Clone or download this repository to your local machine.
- Review the class documentation to understand available methods and usage.
- Utilize the
__doc__
orhelp()
method to explore class details. - Follow the example usage provided in the Usage section of this README.md file to integrate the PT2323 class into your project.
- If you have any suggestions or find issues, feel free to contribute by creating issues or pull requests on the repository.
The class methods are documented in the PT2258 class documentation. It includes the following methods:
__init__(self, port: I2C = None) -> None
: Initialize the PT2323 instance.input_source(source: int) -> None
: Set the input source for the PT2323.master_mute(status: bool = False) -> None
: Enable or disable master mute for all channels.channel_mute(channel: int, status: bool = False) -> None
: Enable or disable mute for a specific channel.enhance_surround(status: bool = False) -> None
: Enable or disable the surround functionality.mixed_channel(status: bool = False) -> None
: Enable or disable the 2-channel to 6-channel translation.
If you find any issues or have suggestions for improvements, feel free to contribute by creating issues or pull requests on the repository.
- Python
- MicroPython
- MicroPython Compatible Boards
- PT2323 6-Channel Audio Selector IC
This code was created by @zerovijay We appreciate your contributions to enhance this project!
This project is licensed under the MIT License.