#!/bin/sh

cd /home/root/lcd-lx45

do_enum=1
if [ "x-p" == "x$1" ]
then
    do_enum=1
    shift
fi
if [ "x" != "x$1" ]
then
    industrialio_lcd_lx45.bin=$1
fi
rmmod fpga_ctrl.ko
insmod fpga_ctrl.ko
insmod fpga_i2c.ko
insmod ads7843.ko
insmod fpga_lcdctlr.ko
echo "1" > /sys/devices/fpga_ctrl/cmd
echo "2" > /sys/devices/fpga_ctrl/cmd
cat industrialio_lcd_lx45.bin > /sys/devices/fpga_ctrl/image
if [ 1 -eq $do_enum ]
then
    echo "3" > /sys/devices/fpga_ctrl/cmd
fi
echo -n "FPGA State = "
cat /sys/devices/fpga_ctrl/state
cat /sys/devices/fpga_ctrl/version

sleep 1

echo "1" > /sys/devices/fpga_ctrl/3/backlight

sleep 1

echo "100" > /sys/devices/fpga_ctrl/3/duty

sleep 5
