2
0
Fork 0

Add Python script for generating code.

This commit is contained in:
bruce 2013-09-12 23:52:35 +08:00
parent 6c85dbf251
commit 27c33adc80
1 changed files with 13 additions and 0 deletions

13
py/atten_levels.py Normal file
View File

@ -0,0 +1,13 @@
lvls = [.75, 1.5, 3, 6, 12, 24]
def get_db(i):
db = 0.0
for d in lvls:
if i & 0x1:
db += d
i >>= 1
return db
for i in range(2**6):
db = get_db(i)
print '"%.2f dB",' % db,