当前位置:网站首页>Rk3308 key and LED light

Rk3308 key and LED light

2022-06-10 15:59:00 Cat teacher NIA~

Hardware schematic diagram

LED Indicator light

Used on the microphone array daughter board 12 star RGB Light as effect indicator . The user can go through I2C Bus configuration LED Lamp drive IC To realize the lighting effect in different scenes .
 Insert picture description here
 Insert picture description here

Key Key

 Insert picture description here
Five control keys are integrated into the microphone array daughter board , Respectively : To control the volume increase or decrease VOL- and VOL+、 prohibit MIC Recorded
MIC_MUTE、 Switch device mode MODE、 Control the device to play or pause Play/Pause

POWER Control

 Insert picture description here

  • GPIO To choose GPIO0 Of pin, Generally, when the master is asleep ,GPIO0 The controller works with electricity , The others are out of power , Can't wake up ( Set interrupt ,linux Under the system , To be in dts Set in )
  • Sleep (suspend) Refer to , The system freezes the process , Then suspend the power supply of the equipment in turn to stop working , Enter low power mode ; Sleep Command :echo mem > /sys/power/state
  • Wake up the (resume) Refer to , Recover from sleep mode to normal working mode .EVB On power The key has a wake-up function , Press down power key , The system will wake up

 Insert picture description here

Configuration on the software

Key Key Configuration of

Related documents :

  • Rockchip_Developer_Guide_DeviceIo_Key_CN.pdf
  • Rockchip_RK3308_Developer_Guide_Linux_Input_CN.pdf
  • Y:\hxy\RK3308\sdk-1.5\buildroot\board\rockchip\rk3308\fs-overlay\etc\input-event-daemon.conf
  • Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\target\etc\input-event-daemon.conf( Same as above )
  • Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\build\input-event-daemon-v0.1.3\input-event-daemon.h
  • Y:\hxy\RK3308\sdk-1.5\kernel\drivers\input\keyboard\adc-keys.c

Related instructions :

  • cd work/hxy/RK3308/sdk-1.5
  • cd buildroot/output/rockchip_rk3308_release
  • make input-event-daemon-dirclean && make input-event-daemon-rebuild
  • grep -rwn "Keys" --include "*.conf"(-i: Case insensitive -n: According to the line Numbers -r: Traverse the directory layer by layer to find -w: Search by word --include: Specify matching file types )

customer demand :

  • Press the button Mode, Execute the customer's APP, And turn on the blue light
  • Press the button MIC_Mute, Close the customer's APP, And the red light is on
  • Press the button VOL+, Perform recording gain

Realization way : use input-event-daemon+shell Script implementation

buildroot Compile configuration

1. Source path :Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\build\input-event-daemon-v0.1.3

2. Code directory description :

  • input-event-daemon.c Monitor kernel event event , Then respond to the corresponding event according to the configuration file
  • target\etc\input-event-daemon.conf Key event settings

3.buildroot Add the corresponding compilation configuration :

  • #cd buildroot/output/rockchip_rk3308_release
  • #make menuconfig
  • choice Target packages -> Hardware handling -> input-event-daemon
  • #make input-event-daemon-dirclean && make input-event-daemon-rebuild
  • #./build.sh

Yes conf File configuration and writing shell Script

input-event-daemon.conf The file configuration is as follows (Keys Your name is not written casually , Yes. input-event-table.h Configured in ):
Linux in && and &,| and ||

[Global]
listen = /dev/input/event0
listen = /dev/input/event1
#listen = /dev/input/event2
#listen = /dev/input/event3

[Keys]
MODE          = ./data/LedTest 2&&echo 1 > /sys/class/leds/led33/brightness&&echo 0 > /sys/class/leds/led14/brightness&&source /data/openAPP.sh
PLAY		  = echo "-----Press PLAY-----"
MUTE          = ./data/LedTest 2&&echo 0 > /sys/class/leds/led33/brightness&&echo 1 > /sys/class/leds/led14/brightness&&source /data/closeAPP.sh
VOLUMEDOWN	  = export ALSA_LIB_ADD_GAIN=2
VOLUMEUP      = ./data/LedTest 2&&export ALSA_LIB_ADD_GAIN=4&&echo 1 > /sys/class/leds/led4/brightness
#PLAY = source /data/closeAPP.sh
#MUTE = echo "-----Press MUTE-----"
#POWER = echo mem > /sys/power/state
#MUTE = amixer -q set Master mute
#FN+VOLUMEUP = factory_reset_cfg
#CTRL+ALT+ESC = beep
#FN = softapServer Rockchip-Echo-123 &

[Switches]
RADIO:0 = ifconfig wlan0 down

[Idle]
1h 30m = vbetool dpms off
reset  = vbetool dpms on 

There are... On the small board 12 individual LED The lamp , From the triangle marked LED Start , according to green 、 red 、 blue The order of ( Corresponding led1、led2、led3 ) Sort

openAPP.sh The configuration is as follows :( Be careful not to end with Enter Key end , Otherwise, it will report a mistake )

#!/bin/sh
echo "open APP"
./data/rk_hw_vad

closeAPP.sh The configuration is as follows :

#!/bin/sh
echo "close APP"
kill -9 $(pidof rk_hw_vad)

LED Lamp configuration

echo 1 > /sys/class/leds/led33/brightness Turn on the blue light ( Changing the number size can adjust the brightness 0~255)
echo 0 > /sys/class/leds/led14/brightness Put out the red light
echo 1 > /sys/class/leds/led4/brightness Turn on the green light

Program yourself demo To write

LED_Demo To write

原网站

版权声明
本文为[Cat teacher NIA~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101528356141.html