Editing LED patterns

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 168: Line 168:
Although the trigger information for engine 3 is listed we have no control over the keyboard LED, so it has no effect. Attempting to add a pattern for engine 3 after the pattern for engine 2 causes the pattern to no longer function.
Although the trigger information for engine 3 is listed we have no control over the keyboard LED, so it has no effect. Attempting to add a pattern for engine 3 after the pattern for engine 2 causes the pattern to no longer function.
-
 
-
...and there's more. Engine can actually do sub/add arithmetics, branches, and select which leds it controls.
 
-
 
-
Pavel Machek created a simple compiler, it is at https://gitorious.org/tui/tui/source/5b3f5cacf8e208d3ea50d6066e549940d85e55be:maemo/notcc.py , and it can use more features of the chip than described here.
 
=== Default LED Patterns for Nokia N900 ===
=== Default LED Patterns for Nokia N900 ===
Line 250: Line 246:
=== Low Level ===
=== Low Level ===
-
'''see also [[N900_Hardware_LED]] !'''
+
'''this section should get merged with [[N900_Hardware_LED]] !'''
-
   
+
 
 +
The N8x0 had a LP5521<ref name="lp5521-spec">http://www.national.com/pf/LP/LP5521.html</ref> <ref name="lp5521-driver">http://mxr.maemo.org/fremantle/source/kernel/drivers/i2c/chips/lp5521.c</ref> programmable three channel controller LED Driver which handles the leds.
 +
(actually N900 has a LP5523 <ref name="lp5523-spec">http://www.national.com/pf/LP/LP5523.html</ref> <ref name="leds-lp5523-driver">http://mxr.maemo.org/fremantle/source/kernel/drivers/leds/leds-lp5523.c</ref>, which has 3 engines like LP5521 but can drive 9 LEDs via a multiplexer. This chip also has double the RAM size for 'programs', plus 2 per-machine and one global register variable and a true set of conditional branch and arithmetic commands.
 +
 
 +
Alas the LP5523 driver doesn't support any of those advanced features of LP5523, and even abuses one of those extremely smart engines for a stupid occasional kbd backlight ramp-up/down.<br>
 +
''This could as well get done in mce by a 25ms timer that writes 40 new brightness values to the master control of kbd LEDs during 1 second. There's really no reason why you need to assign 1 of those 3 machines to this *occasional* short ramp function and break true rainbow 3 color effects on indicator LED. Sound rationale: while kbd bl ramp the ''CPU is awake anyway''. No obvious benefit in offloading the task to a LP5532 engine [except from saving 50 lines of code in mce]!)''
 +
 
 +
The controller can be programmed via "/sys/class/i2c-adapter/i2c-2/2-0032" (FIXME: is this stable?). In that directory there are three files corresponding to the three channels: engine1_mode, engine2_mode and engine3_mode. Each file "stores" one of "run", "load", "disabled" (it seems that there is another mode "direct" but it doesn't work):
 +
* run: The program runs
 +
* disabled: The channel is disabled - not running
 +
* load: In that state, there are two more files in that directory:
 +
** engine1_leds is in the form "0000rgb00" (9 digits, "1" or "0"), where rgb control which leds should participate. The 6 "0" in the above pattern correspond to the 6 kbd white leds controlled by mce via engine3, so readout of engine3_leds gives 111100011 ;-)
 +
** engine1_load accepts a string as specified above (e.g. 9d804000427f0d7f7f007f0042000000). Though LP5523 has an absolute storage of 96 steps a 16bits, which can dynamically partitioned between the three engines, the driver is retarded and limits this to a fixed 16 words a 16bit per engine (<s>ToDo: check if driver supports >16 instructions / machine</s> no it doesn't :-/)
 +
After that, when the state is changed to "run", the program will be run by the controller.
-
Alas the LP5523 driver doesn't support any of those advanced features of LP5523, and uses one of those  engines for a kbd backlight ramp-up/down.<br>
+
In order for the leds to work, the led_current of the appropriate leds need to be set to non-zero values. This is accomplished by writing to files leds:lp5523:[bgr]/'''led_current''' under the same directory. '''Don't mess with''' the default settings here that come with driver init, they are suitable and changing to higher values may and for certain values '''will kill your LEDS'''!.
-
''This could as well get done in mce by a 25ms timer that writes 40 new brightness values to the master control of kbd LEDs during 1 second.''
+
-
See [[N900_Hardware_LED]] for hardware programming details.
+
NOTE: There must be a delay (how much? The specs of LP5521 mentions it) between writes to sysfs files.
== References ==
== References ==
-
Also see [[N900_Hardware_LED]]!  
+
Also see [[N900_Hardware_LED]]! (somebody should have cleaned this duplication rather than ruthlessly copying)
<references />
<references />

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: