I would like to configure BMI160 on my wp76 mangOH red board to generate interrupt for free fall detection. How can I access the functions provided be the driver : https://github.com/mangOH/mangOH/tree/master/linux_kernel_modules/bmi160 , under bmi160_core.c, within my app to do it?
Should I create a .api including the functions within bmi160_core.c to access the functions within my app?
Does this help?
I remember I can send the signal() message to legato application on WP77 FW9.1.
You can see my code:
wakeup_by_kernel_driver.rar (207.5 KB)
It proves that the legato application can be waken up by sending a signal from kernel driver during sleep mode.
Below are the procedures:
- Please note that we need to set GPIO42 to be usable in linux application:
+wiocfg?42
+WIOCFG: 42,16,0,0,1,0,0
OK
-
compile kernel driver “gpio_interrupt” and run by “insmod /tmp/helloworld.ko”
-
run legato application hello2
-
run the following command to find out the pid of hello2
ps aux | grep hello2
root 1899 0.0 0.5 2932 996 ? S 05:37 0:00 hello2 -
echo 1899 > /sys/module/helloworld/parameters/TargetPID
-
type “logread -f &” to see the legato debug message in UART console.
-
toogle GPIO42 to high. (GPIO42 is connected to MangoH Red IOT expender board , pin 24.)
-
The legato debug message shows that the cnt value now is 1
-
remove the USB cable so that module will go to sleep mode (no more response on UART console now)
-
toogle GPIO42 to low.
-
connect USB cable and now the module wakes up.
-
toogle GPIO42 to high again. The legato debug message shows that the cnt value now is 3 which means that the legato application hello2 actually wakes up once during sleep mode.