47 #include "lib/sensors.h" 55 #define PRINTF(...) printf(__VA_ARGS__) 60 #define MOTION_SENSOR_PORT_BASE GPIO_PORT_TO_BASE(MOTION_SENSOR_PORT) 61 #define MOTION_SENSOR_PIN_MASK GPIO_PIN_MASK(MOTION_SENSOR_PIN) 63 void (*presence_int_callback)(uint8_t value);
65 PROCESS(motion_int_process,
"Motion interrupt process handler");
74 presence_int_callback(0);
87 .handler = motion_interrupt_handler,
94 return MOTION_SUCCESS;
100 return GPIO_READ_PIN(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
104 configure(
int type,
int value)
106 if(type != MOTION_ACTIVE) {
107 PRINTF(
"Motion: invalid configuration option\n");
112 presence_int_callback = NULL;
114 return MOTION_SUCCESS;
129 return MOTION_SUCCESS;
132 SENSORS_SENSOR(motion_sensor, MOTION_SENSOR, value, configure, status);
Datatype for GPIO event handlers.
#define GPIO_ENABLE_INTERRUPT(PORT_BASE, PIN_MASK)
Enable interrupt triggering for pins with PIN_MASK of port with PORT_BASE.
#define PROCESS(name, strname)
Declare a process.
Header file for the cc2538 System Control driver.
#define PROCESS_YIELD_UNTIL(c)
Yield the currently running process until a condition occurs.
#define PROCESS_BEGIN()
Define the beginning of a process.
Header file with register and macro declarations for the cc2538 GPIO module.
#define PROCESS_END()
Define the end of a process.
Header file with declarations for the I/O Control module.
#define IOC_OVERRIDE_DIS
Override Disabled.
#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.
#define GPIO_READ_PIN(PORT_BASE, PIN_MASK)
Read pins with PIN_MASK of port with PORT_BASE.
void gpio_hal_register_handler(gpio_hal_event_handler_t *handler)
Register a function to be called whenever a pin triggers an event.
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
#define GPIO_DISABLE_INTERRUPT(PORT_BASE, PIN_MASK)
Disable interrupt triggering for pins with PIN_MASK of port with PORT_BASE.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
#define PROCESS_EXITHANDLER(handler)
Specify an action when a process exits.
void process_poll(struct process *p)
Request a process to be polled.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to input.
uint32_t gpio_hal_pin_mask_t
GPIO pin mask representation.
#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...
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
#define gpio_hal_pin_to_mask(pin)
Convert a pin to a pin mask.
Header file for the GPIO HAL.
Digital motion sensor header file.
void process_start(struct process *p, process_data_t data)
Start a process.