Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
sif_pi4ioe5v96248.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, Cascoda Ltd.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of the copyright holder nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28/*
29 * Sensor interface for Diodes/Pericom PI4IOE5V96248 48-bit gpio expander
30 * (Currently limited to 8 (port 0)
31*/
32
33#ifndef SIF_PI4IOE5V96248_H
34#define SIF_PI4IOE5V96248_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include <stdint.h>
41
42#define I2C_PORTNUM 1 // CLICK interface port for I2C
43
44/* interrupt pin */
45#define SIF_PI4IOE5V96248_INT_PIN 5
46
47/* reset pin */
48#define SIF_PI4IOE5V96248_RST_PIN 6
49
50/* pin masks */
51#define SIF_PI4IOE5V96248_NO_PIN_MASK 0x00
52#define SIF_PI4IOE5V96248_PIN_0_MASK 0x01
53#define SIF_PI4IOE5V96248_PIN_1_MASK 0x02
54#define SIF_PI4IOE5V96248_PIN_2_MASK 0x04
55#define SIF_PI4IOE5V96248_PIN_3_MASK 0x08
56#define SIF_PI4IOE5V96248_PIN_4_MASK 0x10
57#define SIF_PI4IOE5V96248_PIN_5_MASK 0x20
58#define SIF_PI4IOE5V96248_PIN_6_MASK 0x40
59#define SIF_PI4IOE5V96248_PIN_7_MASK 0x80
60#define SIF_PI4IOE5V96248_ALL_PINS_MASK 0xFF
61
62/* port numbers (note: only port 0 used in implementation */
63#define SIF_PI4IOE5V96248_PORT_0 0x00
64#define SIF_PI4IOE5V96248_PORT_1 0x01
65#define SIF_PI4IOE5V96248_PORT_2 0x02
66#define SIF_PI4IOE5V96248_PORT_3 0x03
67#define SIF_PI4IOE5V96248_PORT_4 0x04
68#define SIF_PI4IOE5V96248_PORT_5 0x05
69
70/* i2c address */
71#define SIF_PI4IOE5V96248_I2C_ADDR 0x20
72
73/* timing parameters [ms] */
74#define SIF_PI4IOE5V96248_T_RESET 1 /* 1 ms for reset */
75
76/* interrupt active low */
82
83/* data acquisition status */
85{
86 SIF_PI4IOE5V96248_ST_OK = 0, /* read values ok */
87 SIF_PI4IOE5V96248_ST_FAIL = 3 /* acquisition failed */
88};
89
90/* new functions */
93uint8_t SIF_PI4IOE5V96248_Acquire(uint8_t *port0);
94uint8_t SIF_PI4IOE5V96248_SetOutput(uint8_t io, uint8_t val);
95uint8_t SIF_PI4IOE5V96248_Sense(uint8_t io, uint8_t *val);
96
97#endif // SIF_PI4IOE5V96248_H
uint8_t SIF_PI4IOE5V96248_alarm_triggered(void)
Definition sif_pi4ioe5v96248.c:123
uint8_t SIF_PI4IOE5V96248_SetOutput(uint8_t io, uint8_t val)
Definition sif_pi4ioe5v96248.c:159
uint8_t SIF_PI4IOE5V96248_Sense(uint8_t io, uint8_t *val)
Definition sif_pi4ioe5v96248.c:180
uint8_t SIF_PI4IOE5V96248_Acquire(uint8_t *port0)
Definition sif_pi4ioe5v96248.c:150
uint8_t SIF_PI4IOE5V96248_Initialise(void)
Definition sif_pi4ioe5v96248.c:131
expand13_alarm_state
Definition sif_pi4ioe5v96248.h:78
@ SIF_PI4IOE5V96248_INT_CLEARED
Definition sif_pi4ioe5v96248.h:80
@ SIF_PI4IOE5V96248_INT_TRIGGERED
Definition sif_pi4ioe5v96248.h:79
expand13_status
Definition sif_pi4ioe5v96248.h:85
@ SIF_PI4IOE5V96248_ST_OK
Definition sif_pi4ioe5v96248.h:86
@ SIF_PI4IOE5V96248_ST_FAIL
Definition sif_pi4ioe5v96248.h:87