Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
expand13_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 EXPAND13_CLICK_H
37 #define EXPAND13_CLICK_H
38 
39 #include <stdint.h>
40 
41 /* use alarm pin as interrupt (1) with continuous mode instead of polling (0) with one-shot mode */
42 #define EXPAND13_USE_INTERRUPT 1
43 
44 /* pin masks */
45 #define EXPAND13_NO_PIN_MASK 0x00
46 #define EXPAND13_PIN_0_MASK 0x01
47 #define EXPAND13_PIN_1_MASK 0x02
48 #define EXPAND13_PIN_2_MASK 0x04
49 #define EXPAND13_PIN_3_MASK 0x08
50 #define EXPAND13_PIN_4_MASK 0x10
51 #define EXPAND13_PIN_5_MASK 0x20
52 #define EXPAND13_PIN_6_MASK 0x40
53 #define EXPAND13_PIN_7_MASK 0x80
54 #define EXPAND13_ALL_PINS_MASK 0xFF
55 
56 /* port numbers (note: only port 0 used in implementation */
57 #define EXPAND13_PORT_0 0x00
58 #define EXPAND13_PORT_1 0x01
59 #define EXPAND13_PORT_2 0x02
60 #define EXPAND13_PORT_3 0x03
61 #define EXPAND13_PORT_4 0x04
62 #define EXPAND13_PORT_5 0x05
63 
64 /* i2c address */
65 #define EXPAND13_I2C_ADDR 0x20
66 
67 /* timing parameters [ms] */
68 #define EXPAND13_T_RESET 1 /* 1 ms for reset */
69 
70 /* interrupt active low */
72 {
75 };
76 
77 /* data acquisition status */
79 {
80  EXPAND13_ST_OK = 0, /* read values ok */
81  EXPAND13_ST_FAIL = 3 /* acquisition failed */
82 };
83 
84 /* new functions */
85 void MIKROSDK_EXPAND13_pin_mapping(uint8_t reset, uint8_t irq);
87 uint8_t MIKROSDK_EXPAND13_Initialise(void);
88 uint8_t MIKROSDK_EXPAND13_Acquire(uint8_t *port0);
89 uint8_t MIKROSDK_EXPAND13_SetOutput(uint8_t io, uint8_t val);
90 uint8_t MIKROSDK_EXPAND13_Sense(uint8_t io, uint8_t *val);
91 
92 #endif // EXPAND13_CLICK_H
uint8_t MIKROSDK_EXPAND13_Initialise(void)
Definition: expand13.c:160
uint8_t MIKROSDK_EXPAND13_SetOutput(uint8_t io, uint8_t val)
Definition: expand13.c:201
uint8_t MIKROSDK_EXPAND13_alarm_triggered(void)
Definition: expand13.c:152
uint8_t MIKROSDK_EXPAND13_Sense(uint8_t io, uint8_t *val)
Definition: expand13.c:226
@ EXPAND13_INT_CLEARED
Definition: expand13_click.h:74
@ EXPAND13_INT_TRIGGERED
Definition: expand13_click.h:73
void MIKROSDK_EXPAND13_pin_mapping(uint8_t reset, uint8_t irq)
Definition: expand13.c:145
@ EXPAND13_ST_FAIL
Definition: expand13_click.h:81
@ EXPAND13_ST_OK
Definition: expand13_click.h:80
uint8_t MIKROSDK_EXPAND13_Acquire(uint8_t *port0)
Definition: expand13.c:188
expand13_alarm_state
Definition: sif_pi4ioe5v96248.h:78
expand13_status
Definition: sif_pi4ioe5v96248.h:85