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 1: | Line 1: | ||
== N800 == | == N800 == | ||
- | The | + | The N800 has a single-colour (blue) LED behind the dpad. |
== N810 == | == N810 == | ||
- | The | + | The N810 has an RGB LED. |
== N900 == | == N900 == | ||
=== File Location === | === File Location === | ||
- | |||
- | |||
The file defining patterns can be found in | The file defining patterns can be found in | ||
/etc/mce/mce.ini | /etc/mce/mce.ini | ||
- | An application ([http://talk.maemo.org/showthread.php?t=27818 mcedit]) for modifying LED patterns was written for the | + | An application ([http://talk.maemo.org/showthread.php?t=27818 mcedit]) for modifying LED patterns was written for the n8x0, but this will not work with the n900 due to the new mce.ini format. |
- | + | ||
- | + | ||
=== Pattern Format === | === Pattern Format === | ||
- | |||
The patterns are broken down as follows: | The patterns are broken down as follows: | ||
:<tt>PatternName=Priority;ScreenOn;Timeout;LEDsToMap;Engine1Pattern;Engine2Pattern</tt> | :<tt>PatternName=Priority;ScreenOn;Timeout;LEDsToMap;Engine1Pattern;Engine2Pattern</tt> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
==== Priority ==== | ==== Priority ==== | ||
Line 42: | Line 27: | ||
Since currently only a single pattern at a time can be displayed, this is used to assign importance to the LED patterns. Although only a single LED pattern can be displayed at any time, multiple patterns may be active, the pattern with the highest priority being displayed. | Since currently only a single pattern at a time can be displayed, this is used to assign importance to the LED patterns. Although only a single LED pattern can be displayed at any time, multiple patterns may be active, the pattern with the highest priority being displayed. | ||
- | A common example of this is where the | + | A common example of this is where the n900 is on charge, the battery is full (starting PatternBatteryFull with a priority of 40), and an SMS message is received (PatternCommunicationSMS with a priority of 30). On receipt of the SMS, the LED begins to display the flashing blue led of an SMS. Once that SMS has been dismissed, the green LED of the full battery notification is again displayed. |
==== ScreenOn ==== | ==== ScreenOn ==== | ||
Line 69: | Line 54: | ||
For example, "rG" maps the red channel to Engine 1, and the green channel to Engine 2. | For example, "rG" maps the red channel to Engine 1, and the green channel to Engine 2. | ||
- | You should avoid mapping the same channel to both engines, for example "rR", "gG" or "bB" | + | You should avoid mapping the same channel to both engines, for example "rR", "gG" or "bB" |
==== Engine Pattern ==== | ==== Engine Pattern ==== | ||
- | This is a series of text that describes the speed and intensity of changes in the LED(s) | + | This is a series of text that describes the speed and intensity of changes in the LED(s) beign managed by that particular engine. See below for a breakdown of the patterns. Each can be at most 16 commands long. |
=== Lysti Format Engine Patterns and Commands === | === Lysti Format Engine Patterns and Commands === | ||
Line 80: | Line 65: | ||
:<tt>9d8040007f007f0040ff7f007f000000</tt> | :<tt>9d8040007f007f0040ff7f007f000000</tt> | ||
- | Breaking this down for ease of reading we get a list of 8 commands, each of which is four characters long. | + | Breaking this down for ease of reading we get a list of 8 commands, each of which is four characters long. |
:<tt>9d80 4000 7f00 7f00 40ff 7f00 7f00 0000</tt> | :<tt>9d80 4000 7f00 7f00 40ff 7f00 7f00 0000</tt> | ||
- | ==== 9d80 - Refresh Engine | + | ==== 9d80 - Refresh Engine Multiplexor ==== |
- | This is to be used as the first command of every pattern. If this is excluded from the pattern, the led won't flash. | + | This is to be used as the first command of every pattern). If this is excluded from the pattern, the led won't flash. |
==== 40xx - Set channel brightness ==== | ==== 40xx - Set channel brightness ==== | ||
Line 120: | Line 105: | ||
- | ==== A000 .. BFFF - Branch | + | |
+ | ==== A000 .. BFFF - Branch ==== | ||
101<llllll><sssssss> : 16bit | 101<llllll><sssssss> : 16bit | ||
- | llllll : 6bit; Loop count, 0=infinite loop, | + | llllll : 6bit; Loop count, 0=infinite loop, max 63 loops |
- | sssssss : 7 bit; Step number; Value to store to PC (0-95 actual progspace of LP5523 of 96 16bit commands. [Unclear if that's absolute address, or probably offset | + | sssssss : 7 bit; Step number; Value to store to PC (0-95 actual progspace of LP5523 of 96 16bit commands. [Unclear if that's absolute address, or probably offset to start of program space assigned to the particular engine]) |
- | + | ||
- | + | ||
==== c000 - End pattern execution ==== | ==== c000 - End pattern execution ==== | ||
Line 134: | Line 118: | ||
(also d000 = with hw INT; c800/d800 = with PC reset. INT might serve to signal end-of-pattern to main CPU ->*) | (also d000 = with hw INT; c800/d800 = with PC reset. INT might serve to signal end-of-pattern to main CPU ->*) | ||
- | The pattern is terminated without repeating. | + | The pattern is terminated without repeating. It is important to note here that although that pattern has stopped, it is still active *) until the Timeout time has passed. As a consequence of this any higher priority patterns (patterns with a lower priority value, since 0 is the highest and 255 is the lowest) will not be displayed until the pattern has fully expired. In the case that the timeout is 0, it will not display until the notification is dismissed. |
- | + | ||
- | + | ||
- | + | ||
- | It is important to note here that although that pattern has stopped, it is still active *) until the Timeout time has passed. As a consequence of this any higher priority patterns (patterns with a lower priority value, since 0 is the highest and 255 is the lowest) will not be displayed until the pattern has fully expired. In the case that the timeout is 0, it will not display until the notification is dismissed. | + | |
==== Sending and receiving engine triggers ==== | ==== Sending and receiving engine triggers ==== | ||
Line 145: | Line 125: | ||
The following pattern does exactly that: | The following pattern does exactly that: | ||
- | :<tt>PatternTest=29;1;0;rG; | + | :<tt>PatternTest=29;1;0;rG;9d80400008ffe0044000c000;9d80e08040ffc000</tt> |
===== e002, e004, e008 - Send engine trigger ===== | ===== e002, e004, e008 - Send engine trigger ===== | ||
Line 157: | Line 137: | ||
A signal is sent from the current engine to signal another engine. | A signal is sent from the current engine to signal another engine. | ||
- | 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. |
===== e080, e100, e200 - Wait for engine trigger ===== | ===== e080, e100, e200 - Wait for engine trigger ===== | ||
Line 168: | Line 148: | ||
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. | ||
- | |||
- | |||
- | |||
- | |||
=== Default LED Patterns for Nokia N900 === | === Default LED Patterns for Nokia N900 === | ||
Line 190: | Line 166: | ||
=== Community-Made Patterns === | === Community-Made Patterns === | ||
- | ''Please note that these patterns should | + | ''Please note that these patterns should all be on one line.'' |
- | ''They can also be used for any notification | + | ''They can also be used for any notification.'' |
A traffic-light battery charging pattern, courtesy of [http://talk.maemo.org/showthread.php?p=512430#post512430 blue_led] | A traffic-light battery charging pattern, courtesy of [http://talk.maemo.org/showthread.php?p=512430#post512430 blue_led] | ||
Line 217: | Line 193: | ||
=== Step by step instructions === | === Step by step instructions === | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
* Open terminal | * Open terminal | ||
- | * Gain [[ | + | * Gain [[Root access]] |
- | * Make a backup ( | + | * Make a backup (not necessary!) from original mce.ini -file, for example: |
- | * Open | + | cp /etc/mce/mce.ini /etc/mce/mce.ini_old |
- | * Search for a line: | + | * Open /etc/mce/mce.ini with a text editor (nano, vim, leafpad...) |
+ | * Search for a line: | ||
+ | [LEDPatternLystiRX51] | ||
* Make your changes to the lines below | * Make your changes to the lines below | ||
* Save | * Save | ||
- | * Restart mce -process. Either reboot or type | + | * Restart mce -process. Either reboot or type to terminal: |
+ | initctl stop mce; sleep 2; initctl start mce | ||
- | Please note: restarting mce several times in 2 minutes will cause the | + | Please note: restarting mce several times in 2 minutes will cause the n900 to think there is a problem with mce, and not restart it. The initctl program will inform you of this. When it does, simply wait a while before trying again. |
- | + | === Low Level === | |
- | + | ||
- | / | + | The N900 has 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 it has a LP5523 it seems <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) | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | 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). LP5523 has an absolute storage of 96 steps a 16bits, which can dynamically partitioned between the three engines. (ToDo: check if driver supports >16 instructions / machine) | ||
+ | After that, when the state is changed to "run", the program will be ran by the controller. | ||
- | + | 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. Perhaps (?) not or values are suitable. | |
- | + | NOTE: There must be a delay (how much? The specs of LP5521 mentions it) between writes to sysfs files. | |
- | + | ||
- | + | {{Reflist}} | |
[[Category:N900 Hardware]] | [[Category:N900 Hardware]] | ||
[[Category:Power users]] | [[Category:Power users]] |
Learn more about Contributing to the wiki.