Note: This document was moved here from the Github project wiki.
Note: This is definitely the long way round to get the pi-topPULSE working, and is provided only for interest. If you are running pi-topOS, you do not need to worry about this - everything is already included! If you are running Raspbian, please consult the readme.md
file here for the simpler method of enabling the pulse.
I2C is required to communicate with the function-enabling IC as part of initialisation.
The simplest way to do this is by running raspi-config
, selecting Interfacing Options
→ I2C
→ Select "Yes" to enabling I2C.
The included version of Pyserial on Raspbian on Python 3 does not support custom baud rates, which is required for LEDs to work. Run the upgrade-python3-pyserial
script in the manual-install folder to update to the latest version of Pyserial.
You will also need to enable UART. The simplest way to do this is by running raspi-config
, selecting Interfacing Options
→ Serial
→ Select "No" to enabling a login shell accessible over serial → Select "Yes" for enabling serial port hardware.
The new pi-top has built-in HDMI-to-I2S audio conversion, which eliminates the need for reconfiguring the operating system to use I2S. Enabling this requires communicating with the hub, which can be as follows:
sudo apt install python3-pt-common
Now you can use pt-hdmi-to-i2s as follows:
pt-hdmi-to-i2s enable
pt-hdmi-to-i2s disable
I2S enabling/disabling and volume control configuration on the original pi-top (v1) and pi-topCEED form part of the general pi-top device management system, however can be configured manually via the following commands, followed by a reboot, using pt-i2s:
pt-i2s enable
pt-i2s disable
Volume control for pi-topPULSE can be enabled by loading soundcard device information with the following command (with a pi-topPULSE connected, and with I2S enabled), followed by a reboot, using hifiberry-alsactl.restore:
/usr/sbin/alsactl -f hifiberry-alsactl.restore restore
The easiest way to get the pi-topPULSE library is to install the debian package directly:
sudo apt install python3-pt-pulse
You can also download the library files from this repository and use them locally.
Once you have installed the library, you can now initialise the device:
from ptpulse import configuration as ptpulsecfg
host_device_id = 2
ptpulsecfg.initialise(host_device_id)
enabled, reboot_required, v2_hub_hdmi_to_i2s_required = ptpulsecfg.enable_device()
if (reboot_required):
print("Reboot required")
elif (v2_hub_hdmi_to_i2s_required):
print("HDMI to I2S required")
elif (enabled):
print("Successfully enabled pi-topPULSE")
else:
print("Failed to enable pi-topPULSE")
** NOTE: the host device ID for your device can be found here**
You are now ready to use the pi-topPULSE! Check out the examples folder to get some inspiration of how you can use it.