Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
devboard_sensorif.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022, 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 Silabs Si7021 temperature / humidity sensor
30*/
31
32#ifndef DEVBOARD_SENSORIF_H
33#define DEVBOARD_SENSORIF_H
34
35/* Decimal mask for temperature sensor */
36#define DECIMAL_MASK_FOUR_BITS 0x0F
37#define DECIMAL_MASK_TWO_BITS 0x03
38
39/* devboard comms interface configuration */
40#define I2C_PORTNUM 1 // interface port for I2C
41#define SPI_PORTNUM 1 // interface port for SPI
42
43/* devboard pin assignments (chili2 pins) for sensor interface */
44/* at the moment same mapping as mikrobus click */
45#define SENSORIF_AN_PIN 36
46#define SENSORIF_RST_PIN 6
47#define SENSORIF_CS_PIN 34
48#define SENSORIF_SCK_PIN 33
49#define SENSORIF_MISO_PIN 32
50#define SENSORIF_MOSI_PIN 31
51#define SENSORIF_PWM_PIN 35
52#define SENSORIF_INT_PIN 5
53// Tx (UART) not connected
54// Rx (UART) not connected
55#define SENSORIF_SCL_PIN 2
56#define SENSORIF_SDA_PIN 4
57
66
67typedef struct
68{
70 void (*sensorif_handler)();
71 uint8_t (*sensorif_initialise)();
73
74/* functions */
75
76void select_sensorif(sensorif_callbacks *callback, dvbd_sensorif_type dev_type, void (*handler)());
77
78/* application handlers */
83
84#endif // DEVBOARD_SENSORIF_H
void SENSORIF_Handler_LTR303ALS(void)
Definition devboard_sensorif.c:155
void SENSORIF_Handler_MAX30205(void)
Definition devboard_sensorif.c:122
void SENSORIF_Handler_TMP102(void)
SENSORIF Handler Example for TMP102.
Definition devboard_sensorif.c:180
dvbd_sensorif_type
Definition devboard_sensorif.h:59
@ STYPE_SI7021
Definition devboard_sensorif.h:61
@ STYPE_LTR303ALS
Definition devboard_sensorif.h:62
@ STYPE_TMP102
Definition devboard_sensorif.h:64
@ STYPE_MAX30205
Definition devboard_sensorif.h:63
@ STYPE_NONE
Definition devboard_sensorif.h:60
void select_sensorif(sensorif_callbacks *callback, dvbd_sensorif_type dev_type, void(*handler)())
Definition devboard_sensorif.c:46
void SENSORIF_Handler_SI7021(void)
SENSORIF Handler Example for SI7021.
Definition devboard_sensorif.c:88
Definition devboard_sensorif.h:68
dvbd_sensorif_type dev_type
Definition devboard_sensorif.h:69