sensor: Add threshold trigger support for MCP9808

The MCP9808 supports threshold triggering.  Add support for this feature
in the driver and the sample application.

If triggering is activated, the driver can create its own fiber or use
the system-wide sensor fiber.

Origin: Original
Change-Id: Ie825a22245cb48cbdffba3049011e4d305975d53
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
This commit is contained in:
Vlad Dogaru 2016-02-23 17:10:20 +02:00 committed by Anas Nashif
commit 49d96d95ab
7 changed files with 350 additions and 11 deletions

View file

@ -78,3 +78,52 @@ config MCP9808_I2C_DEV_NAME
help
Specify the device name of the I2C master device to which MCP9808 is
connected.
choice
prompt "MCP9808 trigger mode"
depends on MCP9808
default MCP9808_TRIGGER_NONE
config MCP9808_TRIGGER_NONE
bool "No trigger"
config MCP9808_TRIGGER_GLOBAL_FIBER
depends on GPIO
select MCP9808_TRIGGER
select SENSOR_DELAYED_WORK
bool "Use global fiber"
config MCP9808_TRIGGER_OWN_FIBER
depends on GPIO
select MCP9808_TRIGGER
bool "Use own fiber"
endchoice
config MCP9808_TRIGGER
bool
depends on MCP9808
config MCP9808_GPIO_CONTROLLER
string "GPIO controller for MCP9808 interrupt"
depends on MCP9808 && MCP9808_TRIGGER
default "GPIO_0"
help
The GPIO controller the MCP9808 interrupt is connected to.
config MCP9808_GPIO_PIN
int "GPIO pin for MCP9808 interrupt"
depends on MCP9808 && MCP9808_TRIGGER
default 3
help
The GPIO pin the MCP9808 interrupt is connected to.
config MCP9808_FIBER_STACK_SIZE
int "Sensor delayed work fiber stack size"
depends on MCP9808 && MCP9808_TRIGGER_OWN_FIBER
default 1024
config MCP9808_FIBER_PRIORITY
int "MCP9808 fiber priority"
depends on MCP9808 && MCP9808_TRIGGER_OWN_FIBER
default 10