2 | | I am controlling the volume of the MAX9744 using the CircuitPython Libraries (see [https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi] ). |
| 2 | |
| 3 | UPDATE: Based on a posting of user j1nx on the mycroft forum (thanks a lot!) the better way to control the initial value of the Adafruit using i2cset and an udev-rule |
| 4 | ==== Enable I2C ==== |
| 5 | I2C is not enabled by default so run and enable I2C in the Interfacing Options |
| 6 | ==== Volume control with i2cset (preferred) ==== |
| 7 | Install the i2c-tools: |
| 8 | * sudo apt-get install i2c-tools |
| 9 | The command to set the volume (30) is: |
| 10 | * i2cset -y 1 0x4b 30 |
| 11 | Create the udev-rule: |
| 12 | * sudo nano /etc/udev/rules.d/10-i2c-sound.rules |
| 13 | with the content: |
| 14 | {{{ |
| 15 | SUBSYSTEM=="i2c", ATTR{name}=="bcm2835 I2C adapter", RUN+="/usr/sbin/i2cset -y 1 0x4b 30" |
| 16 | }}} |
| 17 | This blindly sets the volume as soon as the i2c adapter is seen by udev. |
| 18 | ===== How to find the value for the udev rule ===== |
| 19 | Use the command: |
| 20 | * udevadm info -a -p /sys/bus/i2c/devices/i2c-1 |
| 21 | to get the values for SUBSYSTEM and ATTR |
| 22 | ==== Volume control with the Adafruit python library (alternative) ==== |
| 23 | Control the volume of the MAX9744 using the CircuitPython Libraries (see [https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi] ). |