47 #include "lib/sensors.h"
54 #define PRINTF(...) printf(__VA_ARGS__)
59 #define MOTION_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(MOTION_SENSOR_PORT)
60 #define MOTION_SENSOR_PIN_MASK GPIO_PIN_MASK(MOTION_SENSOR_PIN)
62 void (*presence_int_callback)(uint8_t value);
64 PROCESS(motion_int_process,
"Motion interrupt process handler");
73 presence_int_callback(0);
79 motion_interrupt_handler(uint8_t port, uint8_t pin)
87 return MOTION_SUCCESS;
93 return GPIO_READ_PIN(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
97 configure(
int type,
int value)
99 if(type != MOTION_ACTIVE) {
100 PRINTF(
"Motion: invalid configuration option\n");
105 presence_int_callback =
NULL;
107 return MOTION_SUCCESS;
123 return MOTION_SUCCESS;
126 SENSORS_SENSOR(motion_sensor, MOTION_SENSOR, value, configure, status);
#define GPIO_TRIGGER_SINGLE_EDGE(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to trigger an interrupt on single edge (controlled by G...
void process_poll(struct process *p)
Request a process to be polled.
#define GPIO_ENABLE_INTERRUPT(PORT_BASE, PIN_MASK)
Enable interrupt triggering for pins with PIN_MASK of port with PORT_BASE.
#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to input.
#define IOC_OVERRIDE_DIS
Override Disabled.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define GPIO_READ_PIN(PORT_BASE, PIN_MASK)
Read pins with PIN_MASK of port with PORT_BASE.
Digital motion sensor header file.
#define PROCESS_EXITHANDLER(handler)
Specify an action when a process exits.
#define NULL
The null pointer.
Header file with declarations for the I/O Control module.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
Header file for the cc2538 System Control driver.
#define GPIO_DETECT_RISING(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to trigger an interrupt on rising edge.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PROCESS_YIELD_UNTIL(c)
Yield the currently running process until a condition occurs.
void nvic_interrupt_enable(uint32_t intr)
Enables interrupt intr.
#define GPIO_DISABLE_INTERRUPT(PORT_BASE, PIN_MASK)
Disable interrupt triggering for pins with PIN_MASK of port with PORT_BASE.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
void gpio_register_callback(gpio_callback_t f, uint8_t port, uint8_t pin)
Register GPIO callback.
#define PROCESS_BEGIN()
Define the beginning of a process.