-
Notifications
You must be signed in to change notification settings - Fork 1
/
tlc59108_i2c_test.sh
50 lines (41 loc) · 1.11 KB
/
tlc59108_i2c_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
#
#
DEVICE_SYSFS_PATH="/sys/devices/platform/omap/omap_i2c.2/i2c-2/2-0040"
BLINK_DELAY=1000000
REGADDR=regaddr
REGDATA=regdata
BKLTEN_ADDR=0xC
BKLTEN_DISABLE=0x10
BKLTEN_ENABLE=0x00
echo " "
echo " This script tests the i2c connectivity between the "
echo " CPU and the TLC59108. This requires that the FPGA "
echo " be programmed with the i2c slave at i2c address 0x40. "
echo " "
# Check to make sure the module is installed
if [[ -f $DEVICE_SYSFS_PATH/$REGADDR ]]
then
continue
else
echo " Error: $DEVICE_SYSFS_PATH not found."
echo " Please insmod tlc59108-i2c.ko"
exit 1
fi
sleep 2
echo " Blink the backlight a couple of times"
echo " "
# Blink the backlight
echo ${BKLTEN_ADDR} > ${DEVICE_SYSFS_PATH}/${REGADDR}
echo ${BKLTEN_DISABLE} > ${DEVICE_SYSFS_PATH}/${REGDATA}
usleep ${BLINK_DELAY}
echo ${BKLTEN_ENABLE} > ${DEVICE_SYSFS_PATH}/${REGDATA}
usleep ${BLINK_DELAY}
echo ${BKLTEN_DISABLE} > ${DEVICE_SYSFS_PATH}/${REGDATA}
usleep ${BLINK_DELAY}
echo ${BKLTEN_ENABLE} > ${DEVICE_SYSFS_PATH}/${REGDATA}
usleep ${BLINK_DELAY}
echo " "
echo " Test done."
exit 0