Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
motion_click.h
Go to the documentation of this file.
1 
5 /*
6  * Copyright (c) 2022, Cascoda Ltd.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the copyright holder nor the
17  * names of its contributors may be used to endorse or promote products
18  * derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*
33  * Example click interface driver
34 */
35 
36 #ifndef MOTION_CLICK_H
37 #define MOTION_CLICK_H
38 
39 #include <stdint.h>
40 
41 /* use detection pin as interrupt (1) instead of polling (0) */
42 #ifndef MOTION_USE_INTERRUPT
43 #define MOTION_USE_INTERRUPT 0
44 #endif
45 
46 /* new state inluding changes or static behaviour */
47 typedef enum
48 {
53  MOTION_CH_ERROR = 4
55 
57 {
58  MOTION_ST_OK = 0, /* read values ok */
59  MOTION_ST_FAIL = 1 /* acquisition failed */
60 };
61 
62 /* timing parameters [ms] */
63 #ifndef MOTION_T_TONMIN
64 #define MOTION_T_TONMIN 1000 /* 1 second minimum on time */
65 #endif
66 
67 /* new functions */
70 void MIKROSDK_MOTION_Enable(void);
71 void MIKROSDK_MOTION_Disable(void);
72 void MIKROSDK_MOTION_pin_mapping(uint8_t enable, uint8_t output);
73 uint8_t MIKROSDK_MOTION_Initialise(void);
74 uint8_t MIKROSDK_MOTION_Reinitialise(void);
75 uint8_t MIKROSDK_MOTION_Acquire(uint8_t *detection_state, uint32_t *detection_time);
76 
77 #endif // MOTION_CLICK_H
motion_status
Definition: motion_click.h:57
@ MOTION_ST_OK
Definition: motion_click.h:58
@ MOTION_ST_FAIL
Definition: motion_click.h:59
void MIKROSDK_MOTION_Disable(void)
Definition: motion.c:151
void MIKROSDK_MOTION_pin_mapping(uint8_t enable, uint8_t output)
Definition: motion.c:157
uint8_t MIKROSDK_MOTION_Acquire(uint8_t *detection_state, uint32_t *detection_time)
Definition: motion.c:197
motion_detect_state_changes_t
Definition: motion_click.h:48
@ MOTION_CH_PRESENT
Definition: motion_click.h:52
@ MOTION_CH_NO_DETECT
Definition: motion_click.h:49
@ MOTION_CH_ERROR
Definition: motion_click.h:53
@ MOTION_CH_DETECTED
Definition: motion_click.h:50
@ MOTION_CH_NOT_PRESENT
Definition: motion_click.h:51
void MIKROSDK_MOTION_Enable(void)
Definition: motion.c:145
uint8_t MIKROSDK_MOTION_alarm_triggered(void)
Definition: motion.c:95
motion_detect_state_changes_t MIKROSDK_MOTION_get_detected(void)
Definition: motion.c:103
uint8_t MIKROSDK_MOTION_Reinitialise(void)
Definition: motion.c:185
uint8_t MIKROSDK_MOTION_Initialise(void)
Definition: motion.c:164
FILE * output
Definition: sniffer.c:194