Changeset 9d933f34d0845a0e2174fb91c2fc7809c83c0bdc


Ignore:
Timestamp:
05/08/10 00:41:28 (2 years ago)
Author:
Luper Rouch <flupke@…>
Children:
4549db4ca6fda39655fd1888e95e5f415c1bf047
Parents:
06c5c29de5c9c613c7ccb1995d2792ecaa925d68
git-committer:
Luper Rouch <flupke@…> (05/08/10 00:41:28)
Message:

pompilop: made a command line tool

Location:
pompilop
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • pompilop/pompilop/__init__.py

    r34b14fc r9d933f3  
     1__version__ = "0.1_pre" 
  • pompilop/pompilop/serial/__init__.py

    r34b14fc r9d933f3  
    5656    CHANNEL_NAME = "CHN0" 
    5757 
     58    COMMANDS_STRINGS = { 
     59            "METER": METER, 
     60            "MUTE": MUTE, 
     61            "MIX_GAIN": MIX_GAIN, 
     62            "SIGNAL_LEVEL": SIGNAL_LEVEL, 
     63            "SIGNAL_POLARITY": SIGNAL_POLARITY, 
     64            "SIGNAL_DELAY": SIGNAL_DELAY, 
     65            "EQ_TYPE": EQ_TYPE, 
     66            "EQ_FREQUENCY": EQ_FREQUENCY, 
     67            "EQ_LEVEL": EQ_LEVEL, 
     68            "EQ_BYPASS": EQ_BYPASS, 
     69            "GEQ_LEVEL": GEQ_LEVEL, 
     70            "GEQ_BYPASS": GEQ_BYPASS, 
     71            "CROSSOVER_TYPE": CROSSOVER_TYPE, 
     72            "CROSSOVER_FREQUENCY": CROSSOVER_FREQUENCY, 
     73            "CROSSOVER_SLOPE": CROSSOVER_SLOPE, 
     74            "FIR_TYPE": FIR_TYPE, 
     75            "FIR_FREQUENCY": FIR_FREQUENCY, 
     76            "COMPRESSOR_THRESHOLD": COMPRESSOR_THRESHOLD, 
     77            "COMPRESSOR_ATTACK": COMPRESSOR_ATTACK, 
     78            "COMPRESSOR_RELEASE": COMPRESSOR_RELEASE, 
     79            "COMPRESSOR_RATIO": COMPRESSOR_RATIO, 
     80            "LIMITER_THRESHOLD": LIMITER_THRESHOLD, 
     81            "LIMITER_ATTACK": LIMITER_ATTACK, 
     82            "LIMITER_RELEASE": LIMITER_RELEASE, 
     83            "MIXER": MIXER, 
     84            "CHANNEL_NAME": CHANNEL_NAME, 
     85        } 
     86 
    5887    DEVICES_MAX = 16 
    5988    CHANNELS_MAX = 8 
    6089    AUX_MAX = 32 
    6190 
    62     def __init__(self, command, input, channel, data, device=0): 
     91    def __init__(self, command, input, channel, data, aux=None, device=0): 
    6392        self.command = command 
    6493        if device < 0 or device >= self.DEVICES_MAX: 
     
    72101        self.channel = channel 
    73102        self.data = data 
     103        self.aux = aux 
    74104     
    75105    def tolist(self): 
     
    97127        return ret 
    98128 
     129    @classmethod 
     130    def from_strings(cls, command, input, channel, data): 
     131        data = int(data) 
     132        return Command(cls.COMMANDS_STRINGS[command], input, channel, data) 
     133 
    99134 
    100135def base96(value): 
     136    """ 
     137    Convert integer *value* to a string encoded in base 96, shifted by 0x20. 
     138    """ 
    101139    bytes = [] 
    102140    while value: 
     
    142180 
    143181 
    144 if __name__ == "__main__": 
    145     # Init serial connection 
    146     ser = serial.Serial("/dev/tty.usbserial", 115200) 
    147  
     182def send_command(command, write=True, sender=DEFAULT_SENDER,  
     183        dev="/dev/tty.usbserial"): 
     184    """ 
     185    Send a single :class:`Command`. 
     186    """ 
     187    cmd_data = format_commands([command], write=write, sender=sender) 
     188    print cmd_data 
     189    #ser = serial.Serial(dev, 115200) 
     190    #ser.write(cmd_data) 
     191    #ser.close() 
  • pompilop/pompilop/tests/test_serial.py

    r34b14fc r9d933f3  
    2020                "\x01\x57\x7F\x03\x4D\x55\x54\x30\x08\x20\x09\x21\x0A" 
    2121                "\x22\x10\x21\x1F\x2E\x02"), 
     22            (Command(Command.EQ_FREQUENCY, True, 3, aux=5), 
     23                "\x01\x57\x7F\x03\x45\x51\x46\x30\x08\x20\x09\x20\x0A" 
     24                "\x23\x0B\x25\x10\x21\x1F\x44\x02"), 
    2225        ] 
    2326    for cmd, expected in data: 
    2427        assert_equal(format_commands([cmd]), expected) 
    25                  
    26  
  • pompilop/setup.py

    • Property mode changed from 100644 to 100755
    r34b14fc r9d933f3  
     1#!/usr/bin/env python 
     2 
     3from setuptools import setup, find_packages 
     4from pompilop import __version__ 
     5 
     6 
     7setup( 
     8    name = "pompilop", 
     9    version = __version__, 
     10    author = "Luper Rouch", 
     11    author_email = "luper.rouch@gmail.com", 
     12    maintainer = "Luper Rouch", 
     13    maintainer_email = "luper.rouch@gmail.com", 
     14    description = "Utilities to control Xilica processors.", 
     15    long_description =  
     16""" 
     17Xilica processors offer blablablabl 
     18""", 
     19    setup_requires = ["nose"], 
     20    install_requires = ["pyserial"], 
     21    scripts = ["pompilop/bin/pompicontrol.py"], 
     22    packages = find_packages("."), 
     23) 
     24 
Note: See TracChangeset for help on using the changeset viewer.