mirror of
https://github.com/mon/PocketVoltex.git
synced 2026-09-27 09:23:12 +03:00
19 lines
502 B
Python
19 lines
502 B
Python
from __future__ import print_function
|
|
import math
|
|
|
|
BRIGHTNESS_LEVELS = 64
|
|
|
|
print("// Generated by LogCurveGen.py")
|
|
print("PROGMEM const static uint8_t ledLogCurve[] = {", end='')
|
|
for i in range(BRIGHTNESS_LEVELS):
|
|
# newline every 8
|
|
if i % 8 == 0:
|
|
print("\n\t", end='')
|
|
if i == 0:
|
|
mapped = 0
|
|
else:
|
|
mapped = int(math.log(i,BRIGHTNESS_LEVELS-1) * BRIGHTNESS_LEVELS)
|
|
# map to the different order in the board
|
|
print('{}, '.format(mapped), end='')
|
|
print("};")
|