openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
max116xx.h
Go to the documentation of this file.
1/*
2 * openMMC -- Open Source modular IPM Controller firmware
3 *
4 * Copyright (C) 2021 Augusto Fraga Giachero <augusto.fraga@cnpem.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
20 */
21
31#ifndef MAX116XX_H_
32#define MAX116XX_H_
33
34#include "mmc_error.h"
35#include "port.h"
36
41 MAX116XX_REF_VDD = 0b0000000, // VDD as voltage reference, AIN_/REF configured as an analog input
42 MAX116XX_REF_EXT = 0b0100000, // External reference, AIN_/REF configured as an reference input
43 MAX116XX_REF_INT_OFF = 0b1000000, // Internal reference off, AIN_/REF configured as an analog input
44 MAX116XX_REF_INT_ON = 0b1010000, // Internal reference on, AIN_/REF configured as an analog input
45 MAX116XX_REF_INT_OFF_OUT = 0b1100000, // Internal reference off, AIN_/REF configured as reference output
46 MAX116XX_REF_INT_ON_OUT = 0b1110000, // Internal reference on, AIN_/REF configured as reference output
47};
48
53
58
65
70
82
91mmc_err max116xx_set_config(uint8_t chip_id, const max116xx_cfg* cfg);
92
102mmc_err max116xx_read_uni(uint8_t chip_id, int16_t data[], uint8_t samples);
103
113mmc_err max116xx_read_bip(uint8_t chip_id, int16_t data[], uint8_t samples);
114
115#endif
mmc_err max116xx_set_config(uint8_t chip_id, const max116xx_cfg *cfg)
Configure the MAX11606-MAX11611 ADC.
Definition max116xx.c:34
max116xx_diff_mode
Definition max116xx.h:66
@ MAX116XX_DIFFERENTIAL
Definition max116xx.h:67
@ MAX116XX_SINGLE_ENDED
Definition max116xx.h:68
mmc_err max116xx_read_bip(uint8_t chip_id, int16_t data[], uint8_t samples)
Convert and read single or multiple channels, bipolar mode.
Definition max116xx.c:94
mmc_err max116xx_read_uni(uint8_t chip_id, int16_t data[], uint8_t samples)
Convert and read single or multiple channels, unipolar mode.
Definition max116xx.c:62
max116xx_ref_sel
MAX11606-MAX11611 reference selection enum.
Definition max116xx.h:40
@ MAX116XX_REF_INT_ON
Definition max116xx.h:44
@ MAX116XX_REF_INT_ON_OUT
Definition max116xx.h:46
@ MAX116XX_REF_INT_OFF_OUT
Definition max116xx.h:45
@ MAX116XX_REF_INT_OFF
Definition max116xx.h:43
@ MAX116XX_REF_EXT
Definition max116xx.h:42
@ MAX116XX_REF_VDD
Definition max116xx.h:41
max116xx_clk_sel
Definition max116xx.h:49
@ MAX116XX_CLK_EXT
Definition max116xx.h:51
@ MAX116XX_CLK_INT
Definition max116xx.h:50
max116xx_scan_mode
Definition max116xx.h:59
@ MAX116XX_SCAN_OFF_SINGLE_CONV
Definition max116xx.h:63
@ MAX116XX_SCAN_OFF
Definition max116xx.h:61
@ MAX116XX_SCAN_UPPER
Definition max116xx.h:62
@ MAX116XX_SCAN_FROM_AIN0
Definition max116xx.h:60
max116xx_pol_sel
Definition max116xx.h:54
@ MAX116XX_UNIPOLAR
Definition max116xx.h:55
@ MAX116XX_BIPOLAR
Definition max116xx.h:56
Error handling functions and codes.
mmc_err
Definition mmc_error.h:36
Port layer (includes all portable functions headers)
MAX11606-MAX11611 configuration struct.
Definition max116xx.h:74
enum max116xx_diff_mode diff_mode
Definition max116xx.h:80
uint8_t channel_sel
Definition max116xx.h:79
enum max116xx_pol_sel pol_sel
Definition max116xx.h:77
enum max116xx_scan_mode scan_mode
Definition max116xx.h:78
enum max116xx_ref_sel ref_sel
Definition max116xx.h:75
enum max116xx_clk_sel clk_sel
Definition max116xx.h:76