(08-20-2019, 09:13 PM)Tim Curtis Wrote: Hi,
I'm not getting any demand for it and thus its not getting any priority on the TODO list but if another dev wants to write the code, integrate and test it I'll have a look.
-Tim
This is simple python program written in few hours that uses onboard i2c. In my opininion it's not that nobody awaits for Allo Attenuator to be working in Moode. I show you how simple it is to use with bare I2C and Python. To use it I2C needs to be initialized as usually on Raspberry PI and then you can issue a command like :
python ALLO.py 5
that will set volume to 5 with mute on
If you want to turn mute off to have to add 64 to that. Here is the script to be written in ALLO.py file:
# To run it you must have I2C enabled on Raspberry PI and Python working (by default it is). R-Attenuator must be connected to I2C lanes, that's all.
# Usage in linux bash:
# python ALLO.py VOLUME
# where VOLUME is in range of 63 - 127 , where 64 is 0dB and 127 is -63dB, 63 and less is mute ON
# mute is on 6th bit (counted from 0) , 0 is mute ON, 1 is mute OFF,
# so overall value for volume is in range of 0 - 127, but mute being off makes it 64 - 127
#
# Reading push buttons is not implemented because it's not needed for anything.
import smbus
import sys
bus = smbus.SMBus(1)
ADDRESS = 0x21
VOLUME = int(sys.argv[1])
class ALLO():
def __init__(self):
self.write_command()
def write_command(self):
bus.write_byte(ADDRESS, VOLUME)
from ALLO import ALLO
allo = ALLO()
andrewewa
moOde is superb