Skip to content

Commit

Permalink
licheervnano: fix audio test volume, add gpio button test
Browse files Browse the repository at this point in the history
  • Loading branch information
0x754C committed Jan 23, 2024
1 parent 1296110 commit e4e96ab
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@
#include "cv181x_asic_sd.dtsi"
#include "cv181x_default_memmap.dtsi"

#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/gpio/gpio.h>

/ {
/delete-node/ i2c@04040000;

gpio-keys {
compatible = "gpio-keys";
key-user {
label = "User Key";
linux,code = <KEY_DISPLAYTOGGLE>;
debounce-interval = <1>;
gpios = <&porta 30 1>;
};
};

wifisd:wifi-sd@4320000 {
compatible = "cvitek,cv181x-sdio";
bus-width = <4>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,14 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=y
CONFIG_KEYBOARD_MATRIX=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_ACTIVITY=y
19 changes: 12 additions & 7 deletions ramdisk/rootfs/overlay/cv1812cp_licheerv_nano_sd/opt/audio.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/sh

export LD_LIBRARY_PATH=/mnt/system/lib/

if [ -z "$1" ]
then
echo "usage: $0 count"
exit 1
fi

seq 1 $1 | while read line
do
echo "Now record sound"
arecord -Dhw:0,0 -d 5 -r 48000 -f S16_LE -t wav /tmp/ramdisk/test.wav
echo "Set ADC Volume"
echo "0
24
1
" | sample_audio 6

echo "Now record sound"
arecord -Dhw:0,0 -d $1 -r 48000 -f S16_LE -t wav /tmp/ramdisk/test.wav

echo "Now play sound"
aplay -D hw:1,0 -f S16_LE /tmp/ramdisk/test.wav
done
echo "Now play sound"
aplay -D hw:1,0 -f S16_LE /tmp/ramdisk/test.wav
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ int main(void) {
memset(fb, 0, fb_finfo.smem_len);

int touchfd = -1;
touchfd = open("/dev/input/event0", O_RDONLY);
touchfd = open("/dev/input/event1", O_RDONLY);

// fb_vinfo.xres // screen x max
// fb_vinfo.yres // screen y max
Expand Down Expand Up @@ -299,13 +299,15 @@ int main(void) {
exit(EXIT_FAILURE);
}

int buttonfd;
buttonfd = open("/dev/input/event0", O_RDONLY);

struct {
struct timeval time;
unsigned short type;
unsigned short code;
unsigned int val;
} touchdata;
} inputevdata;

if (touchfd >= 0) {
switch(fork()) {
Expand All @@ -314,17 +316,17 @@ int main(void) {
exit(EXIT_FAILURE);
case 0:
while(1) {
if (read(touchfd, &touchdata, sizeof(touchdata))
== sizeof(touchdata)) {
switch(touchdata.code) {
if (read(touchfd, &inputevdata, sizeof(inputevdata))
== sizeof(inputevdata)) {
switch(inputevdata.code) {
case 53:
touch_xmove = touchdata.val;
touch_xmove = inputevdata.val;
break;
case 54:
touch_ymove = touchdata.val;
touch_ymove = inputevdata.val;
break;
case 330:
touch_btn = touchdata.val;
touch_btn = inputevdata.val;
break;
}
}
Expand Down Expand Up @@ -382,6 +384,35 @@ int main(void) {
}
}

if (buttonfd >= 0) {
switch(fork()) {
case -1:
perror("fork");
exit(EXIT_FAILURE);
case 0:
while(1) {
if (read(buttonfd, &inputevdata, sizeof(inputevdata))
== sizeof(inputevdata)) {
switch(inputevdata.code) {
case 431:
if (inputevdata.val == 1) {
draw_solid(fb_vinfo.xres - 40, fb_vinfo.yres - 40,
fb_vinfo.xres - 1, fb_vinfo.yres - 1,
GREEN | AFULL);
} else {
draw_solid(fb_vinfo.xres - 40, fb_vinfo.yres - 40,
fb_vinfo.xres - 1, fb_vinfo.yres - 1,
0);
}
break;
}
}
}
}
}



time_t start_time;
start_time = time(NULL);

Expand Down
Binary file modified ramdisk/rootfs/overlay/cv1812cp_licheerv_nano_sd/opt/vendortest
Binary file not shown.

0 comments on commit e4e96ab

Please sign in to comment.