- Timestamp:
- 05/15/10 01:04:11 (2 years ago)
- Children:
- 3d477f9e40ceaedf2ee58027d5e0a5c098150f62
- Parents:
- 811533e58cd3e57fc04f2e7809d3f6ddd6198a82
- git-committer:
- Luper Rouch <luper.rouch@…> (05/15/10 01:04:11)
- File:
-
- 1 edited
-
pompilop/pompilop/serial/__init__.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pompilop/pompilop/serial/__init__.py
r811533e r0280387 89 89 AUX_MAX = 32 90 90 91 def __init__(self, command, input, channel, data, aux=None, device=0):91 def __init__(self, command, channel, data, aux=None, device=0, input=True): 92 92 self.command = command 93 93 if device < 0 or device >= self.DEVICES_MAX: … … 121 121 ret.append(CHANNEL_HEADER) 122 122 ret.append(chr(CHANNEL_VALUE_BASE + self.channel)) 123 # Aux bytes 124 if self.aux is not None: 125 ret.append(AUX_HEADER) 126 ret.append(chr(AUX_VALUE_BASE + self.aux)) 123 127 # Data bytes 124 128 dumped_data = base96(self.data) … … 141 145 return "\x20" 142 146 bytes = [] 143 while value: 144 byte = value & 0x5f 145 bytes.append(chr(byte + 0x20)) 146 value >>= 5 147 print bytes 147 while value > 0: 148 if value >= 0x60: 149 bytes.append("\x7f") 150 else: 151 bytes.append(chr(value + 0x20)) 152 value -= 0x60 148 153 return "".join(reversed(bytes)) 149 154
Note: See TracChangeset
for help on using the changeset viewer.
