1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 06:45:10 +03:00

PEP8 radio/util/codecs.py

Fix white space
This commit is contained in:
Sean Vig 2015-10-08 23:39:54 -05:00
parent 054952edcb
commit be154140b3

View file

@ -8,6 +8,7 @@ SEG_SHIFT = (4) # Left shift for segment number.
SEG_MASK = (0x70) # Segment field mask.
BIAS = (0x84) # Bias for linear code.
def alaw2linear(a_val):
a_val ^= 0x55
@ -23,6 +24,7 @@ def alaw2linear(a_val):
else:
return -t
def ulaw2linear(u_val):
# Complement to obtain normal u-law value.
u_val = ~u_val
@ -37,17 +39,20 @@ def ulaw2linear(u_val):
else:
return (t - BIAS)
def pcmTable(fn):
result = []
for i in range(256):
result.append(fn(i))
return result
def tableToString(name, table):
result = 'const int16_t ' + name + '[256] = { '
result += ', '.join([str(i) for i in table])
result += ', '.join(str(i) for i in table)
result += ' };'
return result
print(tableToString('alawTable', pcmTable(alaw2linear)))
print(tableToString('ulawTable', pcmTable(ulaw2linear)))