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