API libraries and CLI Tools for MAG3110 sensor.
You may use precompilled versions or build from source
- CMake 2.8
- Make
- C11 (gnu) compiler
- I2C-supported linux kernel (all that I know)
- git (optional) for cloning
This is generic CMake process.
First, create new empty directory:
mkdir -p /tmp/build-mag3110
cd /tmp
Then clone Git repo
git clone https://github.com/reddec/mag3110-tools.git
Use CMake for prepare MAKE files:
cd /tmp/build-mag3110
cmake -DCMAKE_BUILD_TYPE=Release /tmp/mag3110-tools
Compile and package:
make package
After build you can use one of following method:
- Use
mag3110-1.0.0-Linux.sh
as self-installer - Use
mag3110-1.0.0-Linux.tar.gz
as binary tar-ball - Use built files directly =)
You may use static or shared library.
mag3110 [-d data rate][-o oversampling][-i interval][-l name] <device> <address>
Where:
device
(text, required) - path of I2C device (like /dev/i2c-1)address
(text, required) - address of sensor in device in HEX (like 0x52)-d
(type: number, optional) - positive or zero value of data rate in range [0;8)-o
(type: number, optional) - positive or zero value of oversampling ratio in range [0;4)-i
(type: number, optional) - positive or zero value of scanning interval in milliseconds-l
(type: text, optional) - use output format as InfluxDB line format with this name as measurment
Format: <name>SPACE<value>SPACE<time in nanoseconds>SPACE<unit>
temp 22 287361999999000 c
magnetism-x 10001 287361999999000 c
magnetism-y 8733 287371999999000 c
magnetism-z -9877 287381999999000 c
Activates by flag -l <name>
<name> temp=22,magnetism-x=10001,magnetism-y=8733,magnetism-z=-9877 287381999999000