pir.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef PIR_H
22 #define PIR_H
23 
24 #include "kernel_types.h"
25 #include "periph/gpio.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 typedef struct {
35  gpio_t gpio_dev;
37 } pir_t;
38 
42 #ifndef PIR_MSG_T_STATUS_START
43 #define PIR_MSG_T_STATUS_START 150
44 #endif
45 
49 typedef enum {
52 } pir_event_t;
53 
70 int pir_init(pir_t *dev, gpio_t gpio);
71 
79 pir_event_t pir_get_status(const pir_t *dev);
80 
95 int pir_register_thread(pir_t *dev);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* PIR_H */
102 
Types used by the kernel.
int pir_init(pir_t *dev, gpio_t gpio)
Initialize a PIR motion sensor.
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
Low-level GPIO peripheral driver interface definitions.
device descriptor for a PIR sensor
Definition: pir.h:34
#define PIR_MSG_T_STATUS_START
value to configure sensitivity of sensore
Definition: pir.h:43
int pir_register_thread(pir_t *dev)
Register a thread for notification whan state changes on the motion sensor.
gpio_t gpio_dev
GPIO device which is used.
Definition: pir.h:35
kernel_pid_t msg_thread_pid
thread to msg on irq
Definition: pir.h:36
motion was detected
Definition: pir.h:50
pir_event_t pir_get_status(const pir_t *dev)
Read the current status of the motion sensor.
pir_event_t
event type for a PIR sensor
Definition: pir.h:49
no motion is detected
Definition: pir.h:51