Go to the documentation of this file.
72 #ifndef PIR_MSG_T_STATUS_START
73 #define PIR_MSG_T_STATUS_START 150
int pir_init(pir_t *dev, const pir_params_t *params)
Initialize a PIR motion sensor.
@ PIR_NOGPIO
errors while initializing the GPIO
device descriptor for a PIR sensor
int16_t kernel_pid_t
Unique process identifier.
@ PIR_STATUS_INACTIVE
no motion is detected
@ PIR_STATUS_ACTIVE
motion was detected
pir_params_t p
Configuration parameters.
@ PIR_NOTHREAD
errors while registering the thread
#define PIR_MSG_T_STATUS_START
Sensitivity of sensor.
@ PIR_TIMEERR
errors while getting the time information
Scheduler API definition.
int pir_register_thread(pir_t *dev)
Register a thread for notification when state changes on the motion sensor.
kernel_pid_t msg_thread_pid
thread to msg on irq
@ PIR_OK
everything went as expected
bool active
Indicate PIR is active or not.
Parameters needed for device initialization.
uint64_t last_read_time
Last time when PIR status is read.
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
int pir_get_occupancy(pir_t *dev, int16_t *occup)
Read OCCUPANCY value.
gpio_t gpio
GPIO device which is used.
Low-level GPIO peripheral driver interface definitions.
uint64_t start_active_time
Time when PIR starts to be active.
bool active_high
Active when GPIO pin is high or not.
uint64_t accum_active_time
Accumulated active time.