Examples will be with LEDE-Project latest sources from git.
check-humidity-7688 is a fork of Onion Omega2p
checkHumidity which reads temperature values directly from memory.
We need LEDE Project / OpenWRT source configured for LinkIt Smart 7688 and compiled at least once. Kernel should be compiled with /dev/mem support as this is the way check-humidity-7688 works.
The checkHumidity binary should work on mediatek 7688 without problems but if you need to recompile it for different arch/platform here is how it is done:
getting the source and compiling it:
$ git clone https://github.com/devane/check-humidity-7688
$ cd check-humidity-7688
$ make clean
$ sh xCompile.sh -buildroot /home/user/lede
Cleaning...
rm -f -r build bin
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ -c -g -I include -c -o build/fastgpioomega2.o src/fastgpioomega2.cpp
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ -c -g -I include -c -o build/main.o src/main.cpp
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ -c -g -I include -c -o build/module.o src/module.cpp
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ -c -g -I include -c -o build/dht_read.o src/dht_read.cpp
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ -c -g -I include -c -o build/common_dht_read.o src/common_dht_read.cpp
Linking...
/home/user/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin/mipsel-openwrt-linux-g++ build/fastgpioomega2.o build/main.o build/module.o build/dht_read.o build/common_dht_read.o -o bin/checkHumidity
We can check if it is compiled for the right architecture:
$ file bin/checkHumidity
bin/checkHumidity: ELF 32-bit LSB
executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked,
interpreter /lib/ld-musl-mipsel-sf.so.1, with debug_info, not stripped
Now just copy the binary on your mt7688 and it should work just fine.
Notes:
xCompile.sh is a shell script (included in source) from MediaTek documentation page on how to cross-compile your own program. You should only point where is the source of the LEDE-Project / OpenWRT with -buildroot option.
Wiring diagram connecting DHT11 sensor to LinkIt Smart 7688, signal (data) wire is connected to pin 26 - GPIO19.
DHT11 Pinout
Example output of checkHumidity:
root@LEDE:~# ./checkHumidity 19 DHT11
33.000000
26.000000