Добавлен модуль ядра и приложение для работы с трехосевыми магнитометрами.
[lede-packages.git] / hmc5843 / README.md
1 # linux-am2320-driver
2 Linux Device Driver for AM2320 
3
4 **Experimental**
5
6 Tested on a Raspberry pi 3 with kernel version 4.4.14-v7+
7
8 Usage
9 ------
10 You need to have the proper kernel headers installed to build this driver. Use this tool to install kernel headers https://github.com/notro/rpi-source
11
12 1. clone this repo 
13 2. git clone linux-am2320-driver
14 3. cd into directory
15 4. type make
16 5. sudo insmod am2320.ko
17 6. type lsmod and see whether the driver is loaded properly
18 7. sudo bash
19 8. if you have a new Raspberry pi (B+, 2 or 3)
20
21   echo am2320 0x5c > /sys/class/i2c-adapter/i2c-1/new_device
22
23   else if this is a Rev. 1
24
25   echo am2320 0x5c > /sys/class/i2c-adapter/i2c-0/new_device
26
27 Viewing measurements
28 ======================
29 cat /sys/bus/i2c/devices/1-005c/temp1_input
30
31 cat /sys/bus/i2c/devices/1-005c/humidity1_input
32
33 OR
34
35 cat /sys/class/i2c-adapter/i2c-1/1-005c/temp1_input
36
37 cat /sys/class/i2c-adapter/i2c-1/1-005c/humidity1_input
38
39 To remove from kernel
40 =====================
41 sudo bash
42 echo 0x5c > /sys/class/i2c-adapter/i2c-1/delete_device
43
44 then do,
45
46 rmmod am2320
47
48 Cleaning the directory
49 =======================
50 make clean
51