add duo-init.sh and blink.sh

Signed-off-by: carbon <carbon@milkv.io>
This commit is contained in:
carbon
2024-06-18 15:36:38 +08:00
parent d830a0c389
commit 0cb3413fa0
9 changed files with 172 additions and 2 deletions

View File

@ -14,11 +14,21 @@ case "$1" in
fi fi
echo "Starting app..." echo "Starting app..."
if [ -f $SYSTEMPATH/duo-init.sh ]; then
. $SYSTEMPATH/duo-init.sh &
fi
if [ -f $SYSTEMPATH/blink.sh ]; then
. $SYSTEMPATH/blink.sh &
fi
if [ -f $USERDATAPATH/auto.sh ]; then if [ -f $USERDATAPATH/auto.sh ]; then
usleep 30000 usleep 30000
. $USERDATAPATH/auto.sh & . $USERDATAPATH/auto.sh &
exit 1 exit 1
fi fi
if [ -f $SYSTEMPATH/auto.sh ]; then if [ -f $SYSTEMPATH/auto.sh ]; then
usleep 30000 usleep 30000
. $SYSTEMPATH/auto.sh & . $SYSTEMPATH/auto.sh &

View File

@ -0,0 +1,21 @@
#!/bin/sh
LED_PIN=354
LED_GPIO=/sys/class/gpio/gpio${LED_PIN}
if test -d ${LED_GPIO}; then
echo "PIN ${LED_PIN} already exported"
else
echo ${LED_PIN} > /sys/class/gpio/export
fi
echo out > ${LED_GPIO}/direction
while true; do
echo 0 > ${LED_GPIO}/value
sleep 0.5
echo 1 > ${LED_GPIO}/value
sleep 0.5
done

View File

@ -0,0 +1,12 @@
#!/bin/sh
# Set Pin-29(GP22) to GPIO
devmem 0x0502707c 32 0x111
devmem 0x03001068 32 0x3
# Set Pin-19(GP14) to GPIO
duo-pinmux -w GP14/GP14 > /dev/null
# Insmod PWM Module
insmod /mnt/system/ko/cv181x_pwm.ko

View File

@ -0,0 +1,21 @@
#!/bin/sh
LED_PIN=354
LED_GPIO=/sys/class/gpio/gpio${LED_PIN}
if test -d ${LED_GPIO}; then
echo "PIN ${LED_PIN} already exported"
else
echo ${LED_PIN} > /sys/class/gpio/export
fi
echo out > ${LED_GPIO}/direction
while true; do
echo 0 > ${LED_GPIO}/value
sleep 0.5
echo 1 > ${LED_GPIO}/value
sleep 0.5
done

View File

@ -0,0 +1,12 @@
#!/bin/sh
# Set Pin-29(GP22) to GPIO
devmem 0x0502707c 32 0x111
devmem 0x03001068 32 0x3
# Set Pin-19(GP14) to GPIO
duo-pinmux -w GP14/GP14 > /dev/null
# Insmod PWM Module
insmod /mnt/system/ko/cv181x_pwm.ko

View File

@ -0,0 +1,21 @@
#!/bin/sh
LED_PIN=509
LED_GPIO=/sys/class/gpio/gpio${LED_PIN}
if test -d ${LED_GPIO}; then
echo "PIN ${LED_PIN} already exported"
else
echo ${LED_PIN} > /sys/class/gpio/export
fi
echo out > ${LED_GPIO}/direction
while true; do
echo 0 > ${LED_GPIO}/value
sleep 0.5
echo 1 > ${LED_GPIO}/value
sleep 0.5
done

View File

@ -0,0 +1,26 @@
#!/bin/sh
function set_gpio()
{
local gpio_num=$1
local gpio_val=$2
local gpio_path="/sys/class/gpio/gpio${gpio_num}"
if test -d ${gpio_path}; then
echo "GPIO ${gpio_num} already exported" >> /tmp/gpio.log 2>&1
else
echo ${gpio_num} > /sys/class/gpio/export
fi
echo out > ${gpio_path}/direction
sleep 0.1
echo ${gpio_val} > ${gpio_path}/value
}
# Hardware V1.1
gpio_b17=465
set_gpio ${gpio_b17} 0
# Insmod PWM Module
insmod /mnt/system/ko/cv181x_pwm.ko

View File

@ -0,0 +1,21 @@
#!/bin/sh
LED_PIN=509
LED_GPIO=/sys/class/gpio/gpio${LED_PIN}
if test -d ${LED_GPIO}; then
echo "PIN ${LED_PIN} already exported"
else
echo ${LED_PIN} > /sys/class/gpio/export
fi
echo out > ${LED_GPIO}/direction
while true; do
echo 0 > ${LED_GPIO}/value
sleep 0.5
echo 1 > ${LED_GPIO}/value
sleep 0.5
done

View File

@ -0,0 +1,26 @@
#!/bin/sh
function set_gpio()
{
local gpio_num=$1
local gpio_val=$2
local gpio_path="/sys/class/gpio/gpio${gpio_num}"
if test -d ${gpio_path}; then
echo "GPIO ${gpio_num} already exported" >> /tmp/gpio.log 2>&1
else
echo ${gpio_num} > /sys/class/gpio/export
fi
echo out > ${gpio_path}/direction
sleep 0.1
echo ${gpio_val} > ${gpio_path}/value
}
# Hardware V1.1
gpio_b17=465
set_gpio ${gpio_b17} 0
# Insmod PWM Module
insmod /mnt/system/ko/cv181x_pwm.ko