aboutsummaryrefslogtreecommitdiff
path: root/recipes-demo/de10-nano-adxl-apps/files/adxl_calibrate.sh
blob: 3df7d36d22661c9f3d82cc90ba5a1c57faf8146a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

SYSFS_DEVICE_DIR="/sys/devices/platform/soc/ffc04000.i2c/i2c-0/0-0053/"
DEVFS_INPUT_EVENT_FILE="/dev/input/by-path/platform-ffc04000.i2c-event"

# enabled adxl
echo 0 > ${SYSFS_DEVICE_DIR}/disable

# set the sample rate to maximum
echo 15 > ${SYSFS_DEVICE_DIR}/rate

# do not auto sleep
echo 0 > ${SYSFS_DEVICE_DIR}/autosleep

# read some samples
hexdump -n 160 ${DEVFS_INPUT_EVENT_FILE} > /dev/null

# store calibration
echo 1 > ${SYSFS_DEVICE_DIR}/calibrate