Appiko
pir_sense.h
1 
63 #ifndef CODEBASE_PERIPHERAL_MODULES_PIR_SENSE_H_
64 #define CODEBASE_PERIPHERAL_MODULES_PIR_SENSE_H_
65 
66 #include "stdint.h"
67 #include "stdbool.h"
68 
69 #if SYS_CFG_PRESENT == 1
70 #include "sys_config.h"
71 #endif
72 #ifndef SAADC_CHANNEL_USED_PIR_SENSE
73 #define SAADC_CHANNEL_USED_PIR_SENSE 0
74 #endif
75 
76 #ifndef PPI_CHANNEL_USED_PIR_SENSE_1
77 #define PPI_CHANNEL_USED_PIR_SENSE_1 0
78 #endif
79 
80 #ifndef PPI_CHANNEL_USED_PIR_SENSE_2
81 #define PPI_CHANNEL_USED_PIR_SENSE_2 1
82 #endif
83 
84 #ifndef PPI_CHANNEL_USED_PIR_SENSE_3
85 #define PPI_CHANNEL_USED_PIR_SENSE_3 2
86 #endif
87 
88 #ifndef RTC_USED_PIR_SENSE
89 #define RTC_USED_PIR_SENSE 0
90 #endif
91 
96 typedef struct {
97  uint32_t sense_interval_ms;
100  uint32_t threshold;
101  uint32_t irq_priority;
103  void (*handler)(int32_t adc_val);
106 
111 void pir_sense_start(pir_sense_cfg * init);
112 
113 
117 void pir_sense_stop(void);
118 
119 #endif /* CODEBASE_PERIPHERAL_MODULES_PIR_SENSE_H_ */
120 
uint32_t pir_offset_analog_in
The analog input number of PIR signal.
Definition: pir_sense.h:99
void pir_sense_stop(void)
Disable the peripherals involved - SAADC, PPIs and RTC0.
Definition: pir_sense.c:125
uint32_t pir_signal_analog_in
The sampling interval in ms.
Definition: pir_sense.h:98
void pir_sense_start(pir_sense_cfg *init)
Definition: pir_sense.c:57
uint32_t threshold
The analog input number of PIR offset.
Definition: pir_sense.h:100
Stucture for passing the configuration for initializing the PIR Sense module.
Definition: pir_sense.h:96