ads101x_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 OTA keys S.A.
3  * 2018 Acutam Automation, LLC
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
23 #include "board.h"
24 #include "saul_reg.h"
25 #include "ads101x.h"
26 #include "ads101x_regs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 #ifndef ADS101X_PARAM_I2C
37 #define ADS101X_PARAM_I2C (I2C_DEV(0))
38 #endif
39 #ifndef ADS101X_PARAM_ADDR
40 #define ADS101X_PARAM_ADDR (CONFIG_ADS101X_I2C_ADDRESS)
41 #endif
42 #ifndef ADS101X_PARAM_MUX_GAIN
43 #define ADS101X_PARAM_MUX_GAIN (ADS101X_AIN0_DIFFM_AIN1 \
44  | ADS101X_PGA_FSR_2V048)
45 #endif
46 #ifndef ADS101X_PARAM_ALERT_PIN
47 #define ADS101X_PARAM_ALERT_PIN (GPIO_UNDEF)
48 #endif
49 #ifndef ADS101X_PARAM_LOW_LIMIT
50 #define ADS101X_PARAM_LOW_LIMIT (10000U)
51 #endif
52 #ifndef ADS101X_PARAM_HIGH_LIMIT
53 #define ADS101X_PARAM_HIGH_LIMIT (20000U)
54 #endif
55 
56 #ifndef ADS101X_PARAMS
57 #define ADS101X_PARAMS { .i2c = ADS101X_PARAM_I2C, \
58  .addr = ADS101X_PARAM_ADDR, \
59  .mux_gain = ADS101X_PARAM_MUX_GAIN }
60 #endif
61 
62 #ifndef ADS101X_ALERT_PARAMS
63 #define ADS101X_ALERT_PARAMS { .i2c = ADS101X_PARAM_I2C, \
64  .addr = ADS101X_PARAM_ADDR, \
65  .alert_pin = ADS101X_PARAM_ALERT_PIN, \
66  .low_limit = ADS101X_PARAM_LOW_LIMIT, \
67  .high_limit = ADS101X_PARAM_HIGH_LIMIT }
68 #endif
69 #ifndef ADS101X_SAUL_INFO
70 #define ADS101X_SAUL_INFO { .name = "ads101x" }
71 #endif
78 {
79  ADS101X_PARAMS
80 };
81 
86 {
87  ADS101X_ALERT_PARAMS
88 };
89 
94 {
95  ADS101X_SAUL_INFO
96 };
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
ADS101x/111x ADC device driver.
static const saul_reg_info_t ads101x_saul_info[]
Additional meta information to keep in the SAUL registry.
Register definition for ADS101x/111x devices.
SAUL registry interface definition.
ADS101x/111x alert params.
Definition: ads101x.h:78
ADS101x/111x params.
Definition: ads101x.h:69
Additional data to collect for each entry.
Definition: saul_reg.h:48