Difference between revisions of "Example brightness"

From wiki.emacinc.com
Jump to: navigation, search
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{todo|InProgress(11.13.13-13:48->JG+)|Jgreene|project=oe 4,oe 5,ky,md,InProgress}}
+
{{todo|SEOKWREV (12.27.13-11:41->JG+);(12.30.13-16:55->MD+);(12.31.13-10:16->JG+);(01.02.14-12:45->KY+);(03.27.14-16:40->BS+);(04.10.14-12:35->BS+)|Jgreene|project=oe 4,oe 5,jg,md,bs,SEOKWREV}}
<big>This procedure provides an overview of how to compile and run the ''brightness'' C example project. It assumes familiarity with the C programming language and is intended to be used by experienced programmers who are looking to learn the EMAC SDK.</big>
 
  
====1. Open the ''C/C++'' editing perspective====
+
{{#seo:
 +
|title=Example brightness
 +
|titlemode=append
 +
|keywords=Example brightness,brightness C,LCD brightness
 +
|description=This is a guide to the brightness C example project included in the EMAC OE SDK.  
 +
}}
 +
This is a guide to the <code>brightness</code> C example project included in the EMAC OE SDK.
  
====2. Open the ''brightness'' project====
+
This is a simple backlight brightness control. It's written for the EMAC PPC-E7 and SoM-9307 but it will probably run on anything with a backlight. It implements a slider application in GTK+ that directly controls the backlight through its sysfs interface. It has been tested under Xfbdev/Matchbox.
  
====3. Build, upload and run====
+
The <code>brightness</code> project builds one executable: <code>brightness</code>.
  
==What it does==
+
== Opening, Building and Uploading the Project Files ==
  
 +
For information on opening the project from within Eclipse, please see [[Importing the EMAC OE SDK Projects with Eclipse]].  Then, follow [[Using the EMAC OE SDK Projects with Eclipse]] for information on how to build, upload and execute the example.
  
 +
Alternatively, the <code>Makefile</code> can be used with the <code>make</code> command from the commandline to build and upload the example.  For more information on this method, please see [[Using EMAC OE SDK Example Projects]].
  
''From the comments in <code>brightness.c</code>''
+
==Usage and Behavior==
  
    Simple Brightness/Backlight control for the EMAC PPC-E7
+
The <code>brightness</code> C example project creates a GTK+ UI for controlling the backlight brightness. It gives us a slider, a spinner and a textfield.
    and SoM-9307. Implements a slider application in GTK+
+
 
    that directly controls the backlight through its sysfs
+
===Hardware Requirements===
    interface. Tested under Xfbdev/Matchbox.
+
 
 +
The <code>brightness</code> C example project is written for the EMAC PPC-E7 and SoM-9307 but it will probably run on anything with a backlight.
 +
 
 +
===Using <code>brightness</code>===
 +
 
 +
From the terminal, first set the DISPLAY variable:
 +
 
 +
export DISPLAY=:0.0
 +
 
 +
Then run the <code>brightness</code> C executable:
 +
 
 +
./brightness
 +
 
 +
A GTK+ UI appears on the LCD.
 +
 
 +
[[File:Gtk interface.jpg|left|frame|Figure 1: brightness ui]]
 +
 
 +
<br clear=all>
 +
 
 +
Slide the slider, click the spinner arrows or enter a new brightness value (in range [0,255]) to change the LCD backlight value.
 +
 
 +
===Behind the Scenes===
 +
 
 +
The <code>sysclass_get_level()</code> and <code>sysclass_set_level()</code> functions are responsible for retrieving and setting the backlight's brightness value, respectively.  These functions demonstrate a method of interfacing with the <code>/sys</code> virtual filesystem to set and retrieve values to and from the backlight driver in the kernel.
 +
 
 +
==Summary==
 +
 
 +
The <code>brightness</code> C example project creates a GTK+ UI for controlling the backlight-brightness on a EMAC PPC-E7, SoM-9307 or just about any other board with an LCD.

Latest revision as of 12:50, 10 April 2014

TODO: {{#todo:SEOKWREV (12.27.13-11:41->JG+);(12.30.13-16:55->MD+);(12.31.13-10:16->JG+);(01.02.14-12:45->KY+);(03.27.14-16:40->BS+);(04.10.14-12:35->BS+)|Jgreene|oe 4,oe 5,jg,md,bs,SEOKWREV}}

This is a guide to the brightness C example project included in the EMAC OE SDK.

This is a simple backlight brightness control. It's written for the EMAC PPC-E7 and SoM-9307 but it will probably run on anything with a backlight. It implements a slider application in GTK+ that directly controls the backlight through its sysfs interface. It has been tested under Xfbdev/Matchbox.

The brightness project builds one executable: brightness.

Opening, Building and Uploading the Project Files

For information on opening the project from within Eclipse, please see Importing the EMAC OE SDK Projects with Eclipse. Then, follow Using the EMAC OE SDK Projects with Eclipse for information on how to build, upload and execute the example.

Alternatively, the Makefile can be used with the make command from the commandline to build and upload the example. For more information on this method, please see Using EMAC OE SDK Example Projects.

Usage and Behavior

The brightness C example project creates a GTK+ UI for controlling the backlight brightness. It gives us a slider, a spinner and a textfield.

Hardware Requirements

The brightness C example project is written for the EMAC PPC-E7 and SoM-9307 but it will probably run on anything with a backlight.

Using brightness

From the terminal, first set the DISPLAY variable:

export DISPLAY=:0.0

Then run the brightness C executable:

./brightness

A GTK+ UI appears on the LCD.

Figure 1: brightness ui


Slide the slider, click the spinner arrows or enter a new brightness value (in range [0,255]) to change the LCD backlight value.

Behind the Scenes

The sysclass_get_level() and sysclass_set_level() functions are responsible for retrieving and setting the backlight's brightness value, respectively. These functions demonstrate a method of interfacing with the /sys virtual filesystem to set and retrieve values to and from the backlight driver in the kernel.

Summary

The brightness C example project creates a GTK+ UI for controlling the backlight-brightness on a EMAC PPC-E7, SoM-9307 or just about any other board with an LCD.