]>
Commit | Line | Data |
---|---|---|
ec1bef8e | 1 | #!/usr/bin/python |
2 | # | |
3 | # compute pwm reference table | |
4 | ||
5 | clock = 16000000 | |
6 | basefreq = 125 | |
7 | levels = 256 | |
8 | interval_cycles = 64000 | |
9 | ||
10 | if __name__ == "__main__": | |
11 | last = 0 | |
12 | sum = 0 | |
13 | for i in range(1,levels): | |
14 | cycles = (i/float(levels-1))**2*float(clock)/float(basefreq) | |
15 | delta = round(cycles-last) | |
16 | print "%6d: %10d %6d %6d" % (i, round(cycles), delta, round(cycles) % interval_cycles) | |
17 | last = cycles | |
18 | sum+=delta | |
19 | ||
20 | print "sum: %d" % sum |