From 5b3bd67fb9c780d51b25b5304589b1aab0a1e8a7 Mon Sep 17 00:00:00 2001 From: henryk Date: Sat, 1 Mar 2008 20:24:22 +0000 Subject: Add pwm led code from sniffonly branch git-svn-id: https://svn.openpcd.org:2342/trunk@435 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/gammatable.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 openpicc/application/gammatable.py (limited to 'openpicc/application/gammatable.py') diff --git a/openpicc/application/gammatable.py b/openpicc/application/gammatable.py new file mode 100644 index 0000000..a2e59cd --- /dev/null +++ b/openpicc/application/gammatable.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +a = range(1001) + +#b = [ (pow(10, (float(e)/500))) * 202 - 202 for e in a] +b = [ 65534 * (pow((float(e)/1000), 2)) for e in a] +maximum = max(b)+1 + +print "/* Autogenerated from gammatable.py */" +print "const u_int16_t gammatable[] = {" + ", ".join( [str(int(round(int(e)))) for e in b] ) + "};" +print "#define GAMMA_MAX %i" % maximum +print "#define GAMMA_LEN %i" % len(b) + -- cgit v1.2.3