PIDUINO
Loading...
Searching...
No Matches
max1161x.h
1/* Copyright © 2018-2025 Pascal JEAN, All rights reserved.
2 This file is part of the Piduino Library.
3
4 The Piduino Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 The Piduino Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with the Piduino Library; if not, see <http://www.gnu.org/licenses/>.
16*/
17#pragma once
18
19#include <piduino/converter.h>
20#include <piduino/i2cdev.h>
21
22namespace Piduino {
23
46 class Max1161x : public Converter {
47
48 public:
49
55 enum MaxIndex {
61 Max11617 = 17
62 };
63
72 Max1161x (int busId = I2cDev::Info::defaultBus().id(), MaxIndex maxId = Max11615, int referenceId = DefaultReference, double fsr = 0, bool bipolar = false);
73
77 virtual ~Max1161x();
78
93 explicit Max1161x (const std::string &parameters);
94
100 static std::string registeredName() {
101 return "max1161x";
102 }
103
108 struct Info {
110 int addr;
111 int nchan;
112 double intref;
113 double fsr;
114 int busId;
115
122
131 Info (MaxIndex id, int addr, int nchan, double intref, double fsr);
132
138 void setId (MaxIndex id);
139 };
140
145 const Info & info() const;
146
147 protected:
152 class Private;
154
155 private:
160 };
161}
162
163
164/* ========================================================================== */
The Converter class provides an interface for analog-to-digital and digital-to-analog converters.
Definition converter.h:34
@ DefaultReference
Default reference voltage.
Definition converter.h:183
static Info defaultBus()
Gets information about the default I2C bus on the system.
Class for the MAX11612 to MAX11617 series of analog-to-digital converters.
Definition max1161x.h:46
const Info & info() const
Returns the information about the Max1161x converter.
Max1161x(const std::string &parameters)
Constructs a Max1161x object from a string of parameters.
Max1161x(Private &dd)
Max1161x(int busId=I2cDev::Info::defaultBus().id(), MaxIndex maxId=Max11615, int referenceId=DefaultReference, double fsr=0, bool bipolar=false)
Constructs a Max1161x object with the specified I2C device and parameters.
MaxIndex
Enumeration of the Max1161x models. This enum represents the different models of the Max1161x series.
Definition max1161x.h:55
static std::string registeredName()
Returns the name registered for this converter.
Definition max1161x.h:100
virtual ~Max1161x()
Destructor for the Max1161x class.
Internal implementation class for GpioDevice.
#define PIMP_DECLARE_PRIVATE(Class)
PIMP_DECLARE_PRIVATE.
Definition global.h:82
Global namespace for Piduino.
Definition board.h:28
Structure containing information about the Max1161x converter.
Definition max1161x.h:108
int busId
The I2C bus ID used for communication.
Definition max1161x.h:114
MaxIndex id
The Max1161x model ID (12, 13, 14, 15, 16, or 17).
Definition max1161x.h:109
Info(MaxIndex id=Max11615, int busId=I2cDev::Info::defaultBus().id())
Default constructor for Info.
double intref
The internal reference voltage value.
Definition max1161x.h:112
Info(MaxIndex id, int addr, int nchan, double intref, double fsr)
Constructs an Info object with the specified parameters.
double fsr
The full-scale range value.
Definition max1161x.h:113
void setId(MaxIndex id)
Sets the Max1161x model ID.
int addr
The I2C address of the converter.
Definition max1161x.h:110
int nchan
The number of channels configured for the converter.
Definition max1161x.h:111