]> git.zerfleddert.de Git - fnordlicht-mini/blame_incremental - firmware/doc/pwm_table.py
ignore binary
[fnordlicht-mini] / firmware / doc / pwm_table.py
... / ...
CommitLineData
1#!/usr/bin/python
2#
3# compute pwm reference table
4
5clock = 16000000
6basefreq = 125
7levels = 256
8interval_cycles = 64000
9
10if __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
20print "sum: %d" % sum
Impressum, Datenschutz