@@ -64,33 +64,91 @@ def is_valid(cls, value):
64
64
65
65
66
66
class DataRate (CV ):
67
- """Options for ``data_rate``, for selecting the rate at which samples are taken while measuring
68
- the voltage across the input pins"""
67
+ """Options for :py:attr:`~adafruit_tla202x.TLA2024.data_rate`, to select the rate at which
68
+ samples are taken while measuring the voltage across the input pins
69
+
70
+ +-------------------------------+-------------------------+
71
+ | Rate | Measurement Rate |
72
+ +===============================+=========================+
73
+ | :py:const:`Rate.RATE_128SPS` | 128 Samples per second |
74
+ +-------------------------------+-------------------------+
75
+ | :py:const:`Rate.RATE_250SPS` | 250 Samples per second |
76
+ +-------------------------------+-------------------------+
77
+ | :py:const:`Rate.RATE_490SPS` | 490 Samples per second |
78
+ +-------------------------------+-------------------------+
79
+ | :py:const:`Rate.RATE_920SPS` | 920 Samples per second |
80
+ +-------------------------------+-------------------------+
81
+ | :py:const:`Rate.RATE_1600SPS` | 1600 Samples per second |
82
+ +-------------------------------+-------------------------+
83
+ | :py:const:`Rate.RATE_2400SPS` | 2400 Samples per second |
84
+ +-------------------------------+-------------------------+
85
+ | :py:const:`Rate.RATE_3300SPS` | 3300 Samples per second |
86
+ +-------------------------------+-------------------------+
69
87
70
88
71
- class Mode (CV ):
72
- """Options for ``mode``
73
-
74
- In Continuous mode, measurements are taken continuously and calling ``voltage`` will
75
- return the latest measurement.
89
+ """
76
90
77
- Setting the mode to ONE_SHOT makes the ADC take a single
78
- measurement and then goes into a low power state."""
79
91
92
+ DataRate .add_values (
93
+ (
94
+ ("RATE_128SPS" , 0x0 , 128 , None ),
95
+ ("RATE_250SPS" , 0x1 , 250 , None ),
96
+ ("RATE_490SPS" , 0x2 , 490 , None ),
97
+ ("RATE_920SPS" , 0x3 , 920 , None ),
98
+ ("RATE_1600SPS" , 0x4 , 1600 , None ),
99
+ ("RATE_2400SPS" , 0x5 , 2400 , None ),
100
+ ("RATE_3300SPS" , 0x6 , 3300 , None ),
101
+ )
102
+ )
80
103
81
- class Range (CV ):
82
- """Options for ``range``, used to select the measurement range by adjusting the
83
- gain of the internal amplifier"""
84
104
105
+ class Mode (CV ):
106
+ """Options for :py:attr:`~adafruit_tla202x.TLA2024.mode`
107
+
108
+ +----------------------------+--------------------------------------------------------------+
109
+ | Mode | Description |
110
+ +============================+==============================================================+
111
+ | :py:const:`Mode.CONTINUOUS`| In Continuous mode, measurements are taken |
112
+ | | |
113
+ | | continuously and getting |
114
+ | | :py:attr:`~adafruit_tla202x.TLA2024.voltage` |
115
+ | | |
116
+ | | will return the latest measurement. |
117
+ +----------------------------+--------------------------------------------------------------+
118
+ | :py:const:`Mode.ONE_SHOT` | Setting the mode to :py:data:`~Mode.ONE_SHOT` takes a single |
119
+ | | |
120
+ | | measurement and then goes into a low power state. |
121
+ +----------------------------+--------------------------------------------------------------+
85
122
86
- class Mux (CV ):
87
- """Options for ``mux`` to choose the inputs that voltage will be measured across"""
123
+ """
88
124
89
125
90
126
Mode .add_values (
91
127
(("CONTINUOUS" , 0 , "Continuous" , None ), ("ONE_SHOT" , 1 , "One Shot" , None ),)
92
128
)
93
129
130
+
131
+ class Range (CV ):
132
+ """Options for :py:attr:`~adafruit_tla202x.TLA2024.range`, used to select the measurement range
133
+ by adjusting the gain of the internal amplifier
134
+
135
+ +--------------------------------+-------------------+------------+
136
+ | Range | Measurement Range | Resolution |
137
+ +================================+===================+============+
138
+ | :py:const:`Range.RANGE_6_144V` | ±6.144 V | 3 mV |
139
+ +--------------------------------+-------------------+------------+
140
+ | :py:const:`Range.RANGE_4_096V` | ±4.096 V | 2 mV |
141
+ +--------------------------------+-------------------+------------+
142
+ | :py:const:`Range.RANGE_2_048V` | ±2.048 V | 1 mV |
143
+ +--------------------------------+-------------------+------------+
144
+ | :py:const:`Range.RANGE_1_024V` | ±1.024 V | 0.5 mV |
145
+ +--------------------------------+-------------------+------------+
146
+ | :py:const:`Range.RANGE_0_512V` | ±0.512 V | 0.25 mV |
147
+ +--------------------------------+-------------------+------------+
148
+
149
+ """
150
+
151
+
94
152
Range .add_values (
95
153
(
96
154
("RANGE_6_144V" , 0x0 , 6.144 , 3 ),
@@ -101,17 +159,34 @@ class Mux(CV):
101
159
("RANGE_0_256V" , 0x5 , 0.256 , 0.125 ),
102
160
)
103
161
)
104
- DataRate .add_values (
105
- (
106
- ("RATE_128SPS" , 0x0 , 128 , None ),
107
- ("RATE_250SPS" , 0x1 , 250 , None ),
108
- ("RATE_490SPS" , 0x2 , 490 , None ),
109
- ("RATE_920SPS" , 0x3 , 920 , None ),
110
- ("RATE_1600SPS" , 0x4 , 1600 , None ),
111
- ("RATE_2400SPS" , 0x5 , 2400 , None ),
112
- ("RATE_3300SPS" , 0x6 , 3300 , None ),
113
- )
114
- )
162
+
163
+
164
+ class Mux (CV ):
165
+ """Options for :py:attr:`~adafruit_tla202x.TLA2024.mux` to choose the inputs that voltage will
166
+ be measured across
167
+
168
+ +-------------------------------+--------------+--------------+
169
+ | Mux | Positive Pin | Negative Pin |
170
+ +===============================+==============+==============+
171
+ | :py:const:`Mux.MUX_AIN0_AIN1` | AIN 0 | AIN 1 |
172
+ +-------------------------------+--------------+--------------+
173
+ | :py:const:`Mux.MUX_AIN0_AIN3` | AIN 0 | AIN 3 |
174
+ +-------------------------------+--------------+--------------+
175
+ | :py:const:`Mux.MUX_AIN1_AIN3` | AIN 1 | AIN 3 |
176
+ +-------------------------------+--------------+--------------+
177
+ | :py:const:`Mux.MUX_AIN2_AIN3` | AIN 2 | AIN 3 |
178
+ +-------------------------------+--------------+--------------+
179
+ | :py:const:`Mux.MUX_AIN0_GND` | AIN 0 | GND |
180
+ +-------------------------------+--------------+--------------+
181
+ | :py:const:`Mux.MUX_AIN1_GND` | AIN 1 | GND |
182
+ +-------------------------------+--------------+--------------+
183
+ | :py:const:`Mux.MUX_AIN2_GND` | AIN 2 | GND |
184
+ +-------------------------------+--------------+--------------+
185
+ | :py:const:`Mux.MUX_AIN3_GND` | AIN 3 | GND |
186
+ +-------------------------------+--------------+--------------+
187
+
188
+ """
189
+
115
190
116
191
Mux .add_values (
117
192
(
@@ -125,6 +200,8 @@ class Mux(CV):
125
200
("MUX_AIN3_GND" , 0x7 , "AIN 3 to GND" , None ),
126
201
)
127
202
)
203
+
204
+
128
205
# TODO: Verify/fix negative voltages
129
206
# * check sign conversion
130
207
# implement AnalogIo/ AnalogRead API
0 commit comments