第7章 Other Devices

7.1. LED

The Armadillo-400 Series LEDs are supported as LED class devices. The LEDs can be controlled with the files under the LED class directories. For the LED class directories and corresponding LEDs, refer to 表7.1「LEDs and LED Class Directories」.

表7.1 LEDs and LED Class Directories

LED Class DirectoryDescription
/sys/class/leds/red/LED3 (red)
/sys/class/leds/green/LED4 (green)
/sys/class/leds/yellow/LED5 (yellow)

7.1.1. Activating and Deactivating LEDs

LEDs can be turned on and off by writing an appropriate value to the brightness file under the LED class directory. A value between 0 and 255 can be written to the brightness file.

Writing any value apart from 0 to the brightness file turns the LED on. As the Armadillo-400 Series LEDs do not have brightness control functionality, the value has no effective meaning.

[armadillo ~]# echo 1 > /sys/class/leds/yellow/brightness

図7.1 Turning LED5 On


Writing 0 to the brightness file turns the LED off.

[armadillo ~]# echo 0 > /sys/class/leds/yellow/brightness

図7.2 Turning LED5 Off


The current state of the LED can be obtained by reading the brightness file. 0 represents the off state, and any other value represents an on state.

[armadillo ~]# cat /sys/class/leds/yellow/brightness
0

図7.3 Displaying LED5 State


7.1.2. Using Triggers

A trigger to turn the LED on and off can be set by writing an appropriate value to the trigger file under the LED class directory. For values supported by the trigger file, refer to 表7.1「LEDs and LED Class Directories」.

表7.2 trigger Configuration

ConfigurationDescription
noneNo trigger is set.
mmc0LED acts as microSD card access lamp.
timerBlink on and off at certain intervals. After setting this trigger, delay_on and delay_off files appear under the LED class directory which can be used to set the on and off times in millisecond increments.
heartbeatBlink on and off like a heart beat.
default-onUsed mainly from the kernel. The LED is turned on at boot time.

Executing the commands below will cause LED3 to repeatedly turn on for 1 second and then off for 500 milliseconds.

[armadillo ~]# echo timer > /sys/class/leds/red/trigger
[armadillo ~]# echo 1000 > /sys/class/leds/red/delay_on
[armadillo ~]# echo 500 > /sys/class/leds/red/delay_off

図7.4 Specifying timer As Trigger For LED3


The current trigger of the LED can be obtained by reading the trigger file. The value enclosed in [] is the current trigger.

[armadillo ~]# cat /sys/class/leds/yellow/trigger
[none] mmc0 timer heartbeat default-on

図7.5 Displaying LED3 Timer


7.2. GPIO

The Armadillo-400 Series GPIO are supported as GPIO class devices. The GPIO can be controlled with the files under the GPIO class directories. For the GPIO class directories and corresponding GPIO, refer to 表7.3「GPIO and GPIO Class Directories」.

表7.3 GPIO and GPIO Class Directories

GPIO Class DirectoryDescription
/sys/class/gpio/CON9_1/CON9 pin 1
/sys/class/gpio/CON9_2/CON9 pin 2
/sys/class/gpio/CON9_11/CON9 pin 11
/sys/class/gpio/CON9_12/CON9 pin 12
/sys/class/gpio/CON9_13/CON9 pin 13
/sys/class/gpio/CON9_14/CON9 pin 14
/sys/class/gpio/CON9_15/CON9 pin 15
/sys/class/gpio/CON9_16/CON9 pin 16
/sys/class/gpio/CON9_17/CON9 pin 17
/sys/class/gpio/CON9_18/CON9 pin 18
/sys/class/gpio/CON9_21/CON9 pin 21
/sys/class/gpio/CON9_22/CON9 pin 22
/sys/class/gpio/CON9_23/CON9 pin 23
/sys/class/gpio/CON9_24/CON9 pin 24
/sys/class/gpio/CON9_25/CON9 pin 25
/sys/class/gpio/CON9_26/CON9 pin 26
/sys/class/gpio/CON9_27/CON9 pin 27
/sys/class/gpio/CON9_28/CON9 pin 28

7.2.1. Changing I/O Direction

The I/O direction can be changed by writing an appropriate value to the direction file under the GPIO class directory. For values supported by the direction file, refer to 表7.4「direction Configuration」.

表7.4 direction Configuration

ConfigurationDescription
highSet I/O direction to OUTPUT. The input level can be obtained and set in this state. The input level will be HIGH.
outSet I/O direction to OUTPUT. The input level can be obtained and set in this state. The input level will be LOW.
lowThis is the same as setting "out".
inSet I/O direction to INPUT. The input level can be obtained but not set in this state.

7.2.2. Obtaining Input Level

The input level can be obtained by reading the value file under the GPIO class directory. 0 represents a LOW level and 1 a HIGH level. The input level can be obtained both when the I/O direction is set to INPUT and OUTPUT.

[armadillo ~]# cat /sys/devices/virtual/gpio/CON9_1/value
0

図7.6 Obtaining CON9_1 Input Level


7.2.3. Configuring Output Level

The output level can be set by writing an appropriate value to the value file under the GPIO directory. 0 represents a LOW level and 1 a HIGH level. Output level configuration can only be carried out when the I/O direction is set to OUTPUT.

[armadillo ~]# echo 1 > /sys/devices/virtual/gpio/CON9_2/value

図7.7 Configuring CON9_2 Output Level


7.3. RTC

As the RTC Option Module is connected by default in the Armadillo-420 Basic Model Development Set, time information can be maintained even after disconnecting power by using the RTC (calendar clock) function.

To set time information to the RTC, first set the system clock. After that, then set the hardware clock (RTC) to match the system clock.

7.3.1. Setting System Clock With date

The time format used as an argument to the date command is: MMDDhhmmCCYY.ss. In the example below, the date and time are set to 1/23/2000 4:56:00.

[armadillo ~]#date Displays the current system clock
[armadillo ~]#date 012304562000.00
[armadillo ~]#date
Check that the system clock was set correctly
      

7.3.2. Setting System Clock With NTP Client

The system clock can be set using the NTP client. For more information, refer to 「NTP Client」.

7.3.3. Setting Hardware Clock

[armadillo ~]#hwclock Displays the hardware clock
[armadillo ~]#hwclock --utc --systohc Sets hardware clock in UTC
[armadillo ~]#hwclock
Check that the hardware clock was set correctly
      

7.4. UVC Compatible Web Cameras

UVC (USB Video Class) compatible Web cameras can be used with the Armadillo-400 Series.[8]

With the default image on the Armadillo-420 Basic Model Development Set, when a UVC compatible Web camera is connected, the video server starts automatically and the video recorded by the camera can be viewed from a browser.

MJPG-streamer is used as the video server, and is started by udev when a Web camera is connected. LED3 (red) will blink while MJPG-streamer is running.

While LED3 (red) is blinking, the MJPG-Streamer demo page can be displayed by accessing http://(Armadillo-420's IP address):8080/ in a Web browser.

MJPG-Streamer Demo Page

図7.8 MJPG-Streamer Demo Page


[警告]

The Java runtime must be installed on the PC being used in order to run the Java sample. Also, an appropriate codec must be installed on the PC in order to display the Stream in Internet Explorer.



[8] For information on devices tested with the Armadillo-400 Series, refer to the tested devices page (http://armadillo.atmark-techno.com/tested-devices) on the Armadillo Developers Site.