Difference between revisions of "Example brightness"

From wiki.emacinc.com
Jump to: navigation, search
m (Added useful information and marked FinalDraft.)
Line 1: Line 1:
{{todo|InProgress(12.27.13-11:41->JG+)|Jgreene|project=oe 4,oe 5,jg,md,InProgress}}
+
{{todo|InProgress(12.27.13-11:41->JG+);(12.30.13-16:55->MD+)|Jgreene|project=oe 4,oe 5,jg,md,FinalDraft}}
 
This is a guide to the <code>brightness</code> 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.
  
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.
+
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 <code>brightness</code> project builds one executable: <code>brightness</code>.
 
The <code>brightness</code> project builds one executable: <code>brightness</code>.
Line 26: Line 26:
 
==Usage and Behavior==
 
==Usage and Behavior==
  
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.  
+
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.  
  
 
===Hardware Requirements===
 
===Hardware Requirements===
Line 34: Line 34:
 
===Using <code>brightness</code>===
 
===Using <code>brightness</code>===
  
From the terminal, first set the DISPLAY variable.
+
From the terminal, first set the DISPLAY variable:
  
 
  export DISPLAY=:0.0
 
  export DISPLAY=:0.0
  
Then run the <code>brightness</code> C executable.
+
Then run the <code>brightness</code> C executable:
  
 
  ./brightness
 
  ./brightness
Line 47: Line 47:
  
 
Slide the slider, click the spinner arrows or enter a new brightness value (in range [0,255]) to change the LCD backlight value.
 
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==
 
==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.
 
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.

Revision as of 16:54, 30 December 2013

TODO: {{#todo:InProgress(12.27.13-11:41->JG+);(12.30.13-16:55->MD+)|Jgreene|oe 4,oe 5,jg,md,FinalDraft}}

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

1. Open the C/C++ editing perspective.

stub

2. Open the project files.

stub

3. Build the project.

stub

4. Upload the executables to the target system.

stub

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.

Gtk interface.jpg

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.