AIO-3288J Buy Spec

Uses RK3288 Quad-Core Cortex-A17 CPU, up to 1.8Ghz , integrated Quad-Core Mali-T764 GPU. Onboard 4G LTE interface, multiple display interface and serial port. Support Android/Linux/Ubuntu system. It can be quickly applied to a variety of industries.

LED

Update time:2018-04-13 Views:1169

1 Introduction

There are 2 LEDs on the Firefly-RK3288 development board, as the following table shows:

LED GPIO ref. GPIO number
Blue GPIO8_A1 257
Yellow GPIO8_A2 258

Both are programmable using ether LEDs class devices or GPIOs.

2 LEDs as Class Devices

Linux has its own LED subsystem for LED devices. In AIO-3288J, 2 LEDs are configured as LED class devices.

You can control them via /sys/class/leds/.

For more information, please read the document leds-class.txt .

The default status of the two on-board leds are:

  • Blue: on after the system powers on.

  • Yellow: defined by user.

You can change the behavior of each LED by using the echo command to write command to its trigger property:

root@firefly:~ # echo none >/sys/class/leds/firefly:blue:power/trigger
root@firefly:~ # echo default-on >/sys/class/leds/firefly:blue:power/trigger

You can also use the cat command to list all available values of the trigger attribute:

root@firefly:~ # cat /sys/class/leds/firefly:blue:power/trigger
none [ir-power-click] test_ac-online test_battery-charging-or-full test_battery-charging
test_battery-full test_battery-charging-blink-full-solid test_usb-online mmc0 mmc1 mmc2
backlight default-on rfkill0 rfkill1 rfkill2

3 Controlling LED in the Kernel

The steps to control LED in the kernel are shown below:

1. Define LED node in the dts file.

Define LED node in file  kernel/arch/arm/boot/dts/firefly-rk3288-AIO.dts:

 leds {
        compatible = "gpio-leds";
        power {
            label = "firefly:blue:power";
            linux,default-trigger = "ir-power-click";
            default-state = "on";
            gpios = <&gpio8 GPIO_A1 GPIO_ACTIVE_LOW>;
        };
        user{
            label = "firefly:yellow:user";
            linux,default-trigger = "ir-user-click";
            default-state = "off";
            gpios = <&gpio8 GPIO_A2 GPIO_ACTIVE_LOW>;
        };
  };

Note: The value of .compatible must match the one in drivers/leds/leds-gpio.c.

2. Include head files in the driver.

#include <linux/leds.h>

3. Control the LED in the drivers.

(1). Define a trigger.

DEFINE_LED_TRIGGER(ledtrig_ir_click);

(2). Register the trigger.

led_trigger_register_simple("ir-power-click", &ledtrig_ir_click);

(3). Turn on/off the LED.

led_trigger_event(ledtrig_ir_click, LED_FULL); //ON
led_trigger_event(ledtrig_ir_click, LED_OFF); //OFF