<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.webos-internals.org/index.php?action=history&amp;feed=atom&amp;title=More_on_Leds</id>
	<title>More on Leds - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.webos-internals.org/index.php?action=history&amp;feed=atom&amp;title=More_on_Leds"/>
	<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=More_on_Leds&amp;action=history"/>
	<updated>2026-05-18T03:23:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>http://wiki.webos-internals.org/index.php?title=More_on_Leds&amp;diff=3238&amp;oldid=prev</id>
		<title>Hopspitfire at 05:59, 31 July 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=More_on_Leds&amp;diff=3238&amp;oldid=prev"/>
		<updated>2009-07-31T05:59:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:59, 31 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As mentioned in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/del&gt;[[controlling-leds-from-the-shell|Controlling LEDs from the Shell&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/del&gt;]], there are some sysfs endpoints for controlling the LEDs. For a small example of a native program twiddling the LEDs using these endpoints, check out:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As mentioned in [[controlling-leds-from-the-shell|Controlling LEDs from the Shell]], there are some sysfs endpoints for controlling the LEDs. For a small example of a native program twiddling the LEDs using these endpoints, check out:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;http://www.jasonlebrun.info/files/leds_demo.gz&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;http://www.jasonlebrun.info/files/leds_demo.gz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hopspitfire</name></author>
	</entry>
	<entry>
		<id>http://wiki.webos-internals.org/index.php?title=More_on_Leds&amp;diff=1445&amp;oldid=prev</id>
		<title>Hopspitfire: New page: As mentioned in Controlling LEDs from the Shell], there are some sysfs endpoints for controlling the LEDs. For a small example of a native program twid...</title>
		<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=More_on_Leds&amp;diff=1445&amp;oldid=prev"/>
		<updated>2009-07-21T23:15:52Z</updated>

		<summary type="html">&lt;p&gt;New page: As mentioned in [&lt;a href=&quot;/index.php?title=Controlling-leds-from-the-shell&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Controlling-leds-from-the-shell (page does not exist)&quot;&gt;Controlling LEDs from the Shell&lt;/a&gt;], there are some sysfs endpoints for controlling the LEDs. For a small example of a native program twid...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;As mentioned in [[[controlling-leds-from-the-shell|Controlling LEDs from the Shell]]], there are some sysfs endpoints for controlling the LEDs. For a small example of a native program twiddling the LEDs using these endpoints, check out:&lt;br /&gt;
&lt;br /&gt;
http://www.jasonlebrun.info/files/leds_demo.gz&lt;br /&gt;
&lt;br /&gt;
Just copy the program to your Palm Pre, and then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
gunzip leds_demo.gz&lt;br /&gt;
chmod u+x leds_demo&lt;br /&gt;
./leds_demo&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LEDS are controlled by a low power special-purpose LED driver IC, the LP8501. It's controlled by the i2c bus. It allows preset programs to do things like fade-ins and fade-outs without requiring CPU intervention. I'm investigating it more, stay tuned.&lt;br /&gt;
&lt;br /&gt;
Since the source is short, I'll post it right here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#include &amp;quot;stdio.h&amp;quot;&lt;br /&gt;
#include &amp;quot;math.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv) {&lt;br /&gt;
&lt;br /&gt;
    int i = 0, val = 0, phase1=120, phase2=240, s=1000;&lt;br /&gt;
    FILE *left_led, *right_led, *center_led; &lt;br /&gt;
    char buf[10];&lt;br /&gt;
    float PI = 3.14159;&lt;br /&gt;
&lt;br /&gt;
    if(argc &amp;lt; 4) {&lt;br /&gt;
        puts(&amp;quot;Usage: leds_demo delay(us) led2_offset led3_offset&amp;quot;);&lt;br /&gt;
        puts(&amp;quot;Phase is in degrees around a circle. 120, 240 for perfect spacing&amp;quot;);&lt;br /&gt;
        puts(&amp;quot;I.E.: leds_demo 1000 120 240&amp;quot;);&lt;br /&gt;
        puts(&amp;quot;This example will be run now&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
        s = atoi(argv[1]);&lt;br /&gt;
        phase1 = atoi(argv[2]);&lt;br /&gt;
        phase2 = atoi(argv[3]);&lt;br /&gt;
    }&lt;br /&gt;
    left_led =  fopen(&amp;quot;/sys/class/leds/core_navi_left/brightness&amp;quot;, &amp;quot;w&amp;quot;);&lt;br /&gt;
    right_led =  fopen(&amp;quot;/sys/class/leds/core_navi_right/brightness&amp;quot;, &amp;quot;w&amp;quot;);&lt;br /&gt;
    center_led =  fopen(&amp;quot;/sys/class/leds/core_navi_center/brightness&amp;quot;, &amp;quot;w&amp;quot;);&lt;br /&gt;
    while(1) {&lt;br /&gt;
        val = sin(i*2*PI/360.0)*32+32;&lt;br /&gt;
        sprintf(buf, &amp;quot;%d\n&amp;quot;, val); &lt;br /&gt;
        fwrite(buf, strlen(buf), 1, left_led);&lt;br /&gt;
        rewind(left_led);&lt;br /&gt;
&lt;br /&gt;
        val = sin((i+phase1)*2*PI/360.0)*32+32;&lt;br /&gt;
        sprintf(buf, &amp;quot;%d\n&amp;quot;, val); &lt;br /&gt;
        fwrite(buf, strlen(buf), 1, center_led);&lt;br /&gt;
        rewind(right_led);&lt;br /&gt;
        &lt;br /&gt;
        val = sin((i+phase2)*2*PI/360.0)*32+32;&lt;br /&gt;
        sprintf(buf, &amp;quot;%d\n&amp;quot;, val); &lt;br /&gt;
        fwrite(buf, strlen(buf), 1, right_led);&lt;br /&gt;
        rewind(center_led);&lt;br /&gt;
        &lt;br /&gt;
        i++;&lt;br /&gt;
        usleep(s);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hopspitfire</name></author>
	</entry>
</feed>