Appiko
tssp_detect.h
1 
29 #ifndef TSSP_DETECT_H
30 #define TSSP_DETECT_H
31 
32 #include "stdint.h"
33 #include "stdbool.h"
34 #include "boards.h"
35 
36 #if SYS_CFG_PRESENT == 1
37 #include "sys_config.h"
38 #endif
39 
40 #ifndef RTC_USED_TSSP_DETECT
41 #define RTC_USED_TSSP_DETECT 0
42 #endif
43 
44 #ifndef EGU_USED_TSSP_DETECT
45 #define EGU_USED_TSSP_DETECT 0
46 #endif
47 
48 #ifndef PPI_CH_USED_TSSP_DETECT_1
49 #define PPI_CH_USED_TSSP_DETECT_1 7
50 #endif
51 
52 #ifndef PPI_CH_USED_TSSP_DETECT_2
53 #define PPI_CH_USED_TSSP_DETECT_2 8
54 #endif
55 
56 #ifndef GPIOTE_CH_USED_TSSP_DETECT
57 #define GPIOTE_CH_USED_TSSP_DETECT 7
58 #endif
59 
60 
61 #ifndef TSSP_DETECT_FREQ
62 #ifdef MS_TIMER_FREQ
63 #define TSSP_DETECT_FREQ MS_TIMER_FREQ
64 #else
65 #define TSSP_DETECT_FREQ 32768
66 #endif
67 #endif
68 
70 #define TSSP_DETECT_TICKS_MS(ms) ((uint32_t) ROUNDED_DIV( (TSSP_DETECT_FREQ*(uint64_t)(ms)) , 1000) )
71 
72 
76 typedef struct
77 {
79  uint32_t rx_en_pin;
80 
82  uint32_t rx_in_pin;
83 
86 
89 
92  void (*tssp_missed_handler) (void);
93 
95  void (*tssp_detect_handler) (uint32_t ticks);
96 
98 
104 void tssp_detect_init (tssp_detect_config_t * tssp_detect_config);
105 
110 void tssp_detect_window_detect (void);
111 
116 void tssp_detect_pulse_stop (void);
117 
121 void tssp_detect_window_stop (void);
122 
127 void tssp_detect_pulse_detect (void);
128 
133 void tssp_detect_window_sync (uint32_t sync_ms);
134 
135 #endif /* TSSP_DETECT_H */
136 
void tssp_detect_window_stop(void)
Function to stop IR missed window detection.
Definition: tssp_detect.c:172
void tssp_detect_pulse_detect(void)
Function to start module is pulse detecting mode.
Definition: tssp_detect.c:196
void tssp_detect_init(tssp_detect_config_t *tssp_detect_config)
Function to initialize IR detect sub-module.
Definition: tssp_detect.c:86
void tssp_detect_window_sync(uint32_t sync_ms)
Function to Synchronize TSSP detector to IR transmitter which is being used.
Definition: tssp_detect.c:214
Structure to store information required to use this module.
Definition: tssp_detect.h:76
uint32_t window_duration_ticks
Definition: tssp_detect.h:88
void tssp_detect_pulse_stop(void)
Function to stop IR pulse detection.
Definition: tssp_detect.c:156
void tssp_detect_window_detect(void)
Function to start IR pulse detection.
Definition: tssp_detect.c:131