Firefly-RK3128 Buy Specs

Quad-core Cortex-A7 open source board,frequency up to 1.3GHz, integrated Mali-400 MP2 graphics processors, support OpenGL ES1.1/2.0, embedded high-performance 2D hardware acceleration, and can achieve 1080P H.265 video decoding and H.264 video coding.

¬¬

LED

Update time:2018-04-17 Views:2466

Introduction

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

LED GPIO
Blue GPIO1_C7
Yellow GPIO1_C6

Both are programmable using ether LEDs class devices or GPIOs.

LEDs as Class Devices

Linux has its own LED subsystem for LED devices. In Firefly-RK3128, 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

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/rk3128-fireprime.dts:

leds {compatible = "gpio-leds";power {label = "firefly:blue:power";linux,default-trigger = "ir-power-click";default-state = "on";gpios = <&gpio1 GPIO_C7 GPIO_ACTIVE_LOW>;};user {label = "firefly:yellow:user";linux,default-trigger = "ir-user-click";default-state = "off";gpios = <&gpio1 GPIO_C6 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); //ONled_trigger_event(ledtrig_ir_click, LED_OFF); //OFF