Chapter 5
Usage
After booting up and logging in to our Beagle Bone Black running Linux, we
will navigate to the directory where files created by our OPT3001 Device Driver
are located. To do that, please run:
# cd /sys/bus/iio/devices/iio\:device0
# ls
dev
\verb|in_illuminance_integration_time| power
events
\verb|integration_time_available|
subsystem
\verb|in_illuminance_input| name
uevent
In order to get a single-shot Light measurement, all we have to do is read
in_illuminance_input
file.
# cat \verb|in_illuminance_input|
7.800000
We can also setup thresholds and have events fire when such thresholds are
reached. In order to illustrate that we will make use of
iio_event_monitor
, a
tool which can be found at
drivers/staging/iio/Documentation/iio_event_monitor.c
.
Let’s setup some thresholds:
# cd events
# ls
\verb|in_illuminance_thresh_falling_en|
\verb|in_illuminance_thresh_falling_hysteresis|
\verb|in_illuminance_thresh_falling_value|
\verb|in_illuminance_thresh_rising_en|
\verb|in_illuminance_thresh_rising_hysteresis|
\verb|in_illuminance_thresh_rising_value|
# echo 200 > \verb|in_illuminance_thresh_falling_value|
# echo 500 > \verb|in_illuminance_thresh_rising_value|
# echo 1 > \verb|in_illuminance_thresh_fallin_en|
# \verb|iio_event_monitor /dev/iio\:device0|
Event: time: 946685148546403596,
type
: illuminance, channel: 0, evtype:
thresh, direction: rising
13
Summary of Contents for OPT3001EVM
Page 1: ...OPT3001EVM Linux Getting Started Guide Felipe Balbi August 18 2014 ...
Page 2: ...This page is intentionally left blank ...
Page 7: ...CHAPTER 3 HARDWARE PLATFORM 4 Figure 3 1 connecting opt3001evm to beagle bone black ...
Page 15: ...CHAPTER 4 THE LINUX KERNEL 12 Figure 4 10 Exitting menuconfig ...