以前投稿したADS1x15ライブラリを改良してみた。
Single-shotモードだけだと、I2C-100KHzモードでは3300SPSデータレートを生かしきれないため新たにContinuousモード対応をしてみた。さらにADS1015/ADS1115のソースを完全に分けたので両方同時に使うことが可能。って、そんなことする人いないと思うけど...(-_-;)
アプリからは、Single-shot/Continuousモードを気にすることなく同様な手順で使うことができるようになっている。また、待ち時間がないポーリング方式と変換待ちをする両方のスタイルをサポートしているのでアプリに合わせたスタイルで利用することが可能だ。
例えばリアルタイム処理系ならContinuous+ポーリング方式、省電力系ならSingle-shot+変換待ち方式が適切かもしれない。詳細は下記サンプルスケッチを参考にしてほしい。
ちなみにContinuousモードでは新しいADC設定を書き込んでも次回の変換開始まで反映されないため新しい設定での値を確実に取得するには現在の変換終了を待たなければいけない。変換終了を知る最良の方法はチップのALERT/RDYピンをチェックすることであるが途中でADC設定変更を行うことなどそう頻繁にはないであろうと思われることやGPIOを余計に使いALERT/RDYピンをチェックしたところで節約できる時間は平均的に0.5変換時間程度であることから設定変更時に無条件に1変換時間を待つ仕様としている。
【サンプル・スケッチ】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
#include "Arduino.h" #include "Wire.h" #include "ADS1015.h" ADS1015<> adc; // use arduino standard wire class. #define NO_WAIT_CODE void setup(void) { // Wire Initialize. Wire.begin(); Wire.setClock(400000); // 400KHz >= 3300SPS // ADC settings. adc.mux(ADS1015_MUX_AIN0_AIN1); adc.pga(ADS1015_PGA_2048V); adc.dr(ADS1015_DR_3300SPS); // true : continuous-conversion mode. false: single-shot mode. adc.begin(true); } void change_adc_setting() { adc.pga(ADS1015_PGA_1024V); // execute restart() method after changing ADC settings. adc.restart(); } #ifdef NO_WAIT_CODE void loop(void) { switch (adc.handle()) { default: break; case ADS1015_STATUS_NO_DEVICE: printf("No Device\n"); break; case ADS1015_STATUS_READY: printf("adc value = %d uV\n", adc.voltage()); delay(1000); break; } } #else void loop(void) { // wait for conversion if (adc.conversion()) printf("adc value = %d uV\n", adc.voltage()); else printf("No Device\n"); delay(1000); } #endif |
【ADS1015】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
/* ADS1015.h - ADC Library for ADS1015 Copyright (c) 2020 Sasapea's Lab. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ADS1015_H #define __ADS1015_H #include <stdint.h> #include <stdbool.h> #ifdef ARDUINO #include <Arduino.h> #else #define makeWord(h, l) (((uint16_t)(h) << 8) | (uint8_t)(l)) #define lowByte(w) (uint8_t)(w) #define highByte(w) (uint8_t)((w) >> 8) #endif #define ADS1015_RETRY_INTERVAL 1000000 #define ADS1015_DEVICE_ADDRESS 0x48 #define ADS1015_RESOLUSION 12 typedef enum { ADS1015_STATUS_NO_DEVICE, ADS1015_STATUS_IDLE, ADS1015_STATUS_BUSY, ADS1015_STATUS_READY, } ADS1015_STATUS; typedef enum { ADS1015_REG_CONVERSION, ADS1015_REG_CONFIG, ADS1015_REG_LO_THRESH, ADS1015_REG_HI_THRESH, } ADS1015_REG; typedef enum { ADS1015_OS_NONE, ADS1015_OS_CONVERSION, } ADS1015_OS; typedef enum { ADS1015_MUX_AIN0_AIN1, ADS1015_MUX_AIN0_AIN3, ADS1015_MUX_AIN1_AIN3, ADS1015_MUX_AIN2_AIN3, ADS1015_MUX_AIN0_GND, ADS1015_MUX_AIN1_GND, ADS1015_MUX_AIN2_GND, ADS1015_MUX_AIN3_GND, } ADS1015_MUX; typedef enum { ADS1015_PGA_6144V, ADS1015_PGA_4096V, ADS1015_PGA_2048V, ADS1015_PGA_1024V, ADS1015_PGA_0512V, ADS1015_PGA_0256V, ADS1015_PGA_0128V, } ADS1015_PGA; #define ADS1015_REFERENCES \ { 6144000, 4096000, 2048000, 1024000, 512000, 256000, 128000 } typedef enum { ADS1015_MODE_CONTINUOUS, ADS1015_MODE_POWER_DOWN, } ADS1015_MODE; typedef enum { ADS1015_DR_128SPS, ADS1015_DR_250SPS, ADS1015_DR_490SPS, ADS1015_DR_920SPS, ADS1015_DR_1600SPS, ADS1015_DR_2400SPS, ADS1015_DR_3300SPS, } ADS1015_DR; #define ADS1015_CONVERSION_TIMES \ { 1000000 / 128, 1000000 / 250, 1000000 / 490, 1000000 / 920, \ 1000000 / 1600, 1000000 / 2400, 1000000 / 3300 } typedef enum { ADS1015_COMP_MODE_TRADITIONAL, ADS1015_COMP_MODE_WINDOW, } ADS1015_COMP_MODE; typedef enum { ADS1015_COMP_POL_ACTIVE_LOW, ADS1015_COMP_POL_ACTIVE_HIGH, } ADS1015_COMP_POL; typedef enum { ADS1015_COMP_LAT_DISABLE, ADS1015_COMP_LAT_ENABLE, } ADS1015_COMP_LAT; typedef enum { ADS1015_COMP_QUE_ONE, ADS1015_COMP_QUE_TWO, ADS1015_COMP_QUE_FOUR, ADS1015_COMP_QUE_DISABLE, } ADS1015_COMP_QUE; typedef union { struct { ADS1015_COMP_QUE comp_que :2; ADS1015_COMP_LAT comp_lat :1; ADS1015_COMP_POL comp_pol :1; ADS1015_COMP_MODE comp_mode:1; ADS1015_DR dr :3; ADS1015_MODE mode :1; ADS1015_PGA pga :3; ADS1015_MUX mux :3; ADS1015_OS os :1; } reg; uint16_t val; } ADS1015_CONFIG; template<typename WIRE = TwoWire, WIRE& WOBJ = Wire> class ADS1015 { private: uint8_t _addr; int32_t _value; unsigned long _start; ADS1015_CONFIG _config; ADS1015_CONFIG _active; ADS1015_STATUS _status; uint8_t write_reg(ADS1015_REG reg, uint16_t data) { WOBJ.beginTransmission(_addr); WOBJ.write(reg); WOBJ.write(highByte(data)); WOBJ.write(lowByte(data)); return WOBJ.endTransmission(); } uint8_t read_reg(ADS1015_REG reg, uint16_t *data) { WOBJ.beginTransmission(_addr); WOBJ.write(reg); uint8_t rv = WOBJ.endTransmission(false); if (rv == 0) { if (WOBJ.requestFrom(_addr, sizeof(*data)) == sizeof(*data)) { uint8_t high = WOBJ.read(); uint8_t low = WOBJ.read(); *data = makeWord(high, low); } else rv = 4; } return rv; } bool start(void) { uint8_t rv = write_reg(ADS1015_REG_CONFIG, _config.val); if (rv) _status = ADS1015_STATUS_NO_DEVICE; else { _status = ADS1015_STATUS_BUSY; _active = _config; } _start = micros(); return rv == 0; } ADS1015_STATUS fetch(void) { uint16_t val; _start = micros(); uint8_t rv = read_reg(ADS1015_REG_CONVERSION, &val); if (rv) return _status = ADS1015_STATUS_NO_DEVICE; if (_active.reg.mode == ADS1015_MODE_POWER_DOWN) _status = ADS1015_STATUS_IDLE; else _status = ADS1015_STATUS_BUSY; if (_active.reg.mux < ADS1015_MUX_AIN0_GND) _value = (int16_t)val; else _value = val; return ADS1015_STATUS_READY; } uint32_t conversion_time(void) { static const uint32_t CONVERSION_TIMES[] = ADS1015_CONVERSION_TIMES; return CONVERSION_TIMES[_active.reg.dr]; } public: ADS1015(uint8_t addr = ADS1015_DEVICE_ADDRESS) : _addr(addr) , _value(0) , _start(0) , _status(ADS1015_STATUS_NO_DEVICE) { const ADS1015_CONFIG _DEFAULT = { ADS1015_COMP_QUE_DISABLE, ADS1015_COMP_LAT_DISABLE, ADS1015_COMP_POL_ACTIVE_LOW, ADS1015_COMP_MODE_TRADITIONAL, ADS1015_DR_1600SPS, ADS1015_MODE_POWER_DOWN, ADS1015_PGA_2048V, ADS1015_MUX_AIN0_AIN1, ADS1015_OS_CONVERSION, }; _config = _active = _DEFAULT; } void mux(ADS1015_MUX value) { _config.reg.mux = value; } void pga(ADS1015_PGA value) { _config.reg.pga = value; } void dr(ADS1015_DR value) { _config.reg.dr = value; } void comp_mode(ADS1015_COMP_MODE value) { _config.reg.comp_mode = value; } void comp_pol(ADS1015_COMP_POL value) { _config.reg.comp_pol = value; } void comp_lat(ADS1015_COMP_LAT value) { _config.reg.comp_lat = value; } void comp_que(ADS1015_COMP_QUE value) { _config.reg.comp_que = value; } uint8_t low_threshold(uint16_t value) { return write_reg(ADS1015_REG_LO_THRESH, value); } uint8_t high_threshold(uint16_t value) { return write_reg(ADS1015_REG_HI_THRESH, value); } uint8_t resolution(void) { return ADS1015_RESOLUSION; } uint32_t reference(void) { static const uint32_t REFERENCES[] = ADS1015_REFERENCES; return REFERENCES[_active.reg.pga]; } int32_t result(void) { return _value; } int32_t voltage(void) { return (int32_t)((int64_t)result() * reference() / 32768); } void begin(bool continuous = false) { if (!continuous) _start = micros() - ADS1015_RETRY_INTERVAL; else { _config.reg.mode = ADS1015_MODE_CONTINUOUS; _config.reg.os = ADS1015_OS_NONE; start(); } } bool restart(void) { if ((_config.val == _active.val) || (_config.reg.mode == ADS1015_MODE_POWER_DOWN)) return true; unsigned long t = (_status == ADS1015_STATUS_BUSY ? conversion_time() : 0); if (!start()) return false; if (t) { delayMicroseconds(t); _start = micros(); } return true; } bool conversion(void) { unsigned long t = 0; if (_status == ADS1015_STATUS_BUSY) t = micros() - _start; else if (!start()) return false; if (t < conversion_time()) delayMicroseconds(conversion_time() - t); return fetch() == ADS1015_STATUS_READY; } ADS1015_STATUS handle(void) { switch (_status) { default: case ADS1015_STATUS_NO_DEVICE: if (micros() - _start < ADS1015_RETRY_INTERVAL) break; case ADS1015_STATUS_IDLE: start(); break; case ADS1015_STATUS_BUSY: if (micros() - _start < conversion_time()) break; return fetch(); } return _status; } }; #endif |
【ADS1115】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
/* ADS1115.h - ADC Library for ADS1115 Copyright (c) 2020 Sasapea's Lab. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ADS1115_H #define __ADS1115_H #include <stdint.h> #include <stdbool.h> #ifdef ARDUINO #include <Arduino.h> #else #define makeWord(h, l) (((uint16_t)(h) << 8) | (uint8_t)(l)) #define lowByte(w) (uint8_t)(w) #define highByte(w) (uint8_t)((w) >> 8) #endif #define ADS1115_RETRY_INTERVAL 1000000 #define ADS1115_DEVICE_ADDRESS 0x48 #define ADS1115_RESOLUSION 16 typedef enum { ADS1115_STATUS_NO_DEVICE, ADS1115_STATUS_IDLE, ADS1115_STATUS_BUSY, ADS1115_STATUS_READY, } ADS1115_STATUS; typedef enum { ADS1115_REG_CONVERSION, ADS1115_REG_CONFIG, ADS1115_REG_LO_THRESH, ADS1115_REG_HI_THRESH, } ADS1115_REG; typedef enum { ADS1115_OS_NONE, ADS1115_OS_CONVERSION, } ADS1115_OS; typedef enum { ADS1115_MUX_AIN0_AIN1, ADS1115_MUX_AIN0_AIN3, ADS1115_MUX_AIN1_AIN3, ADS1115_MUX_AIN2_AIN3, ADS1115_MUX_AIN0_GND, ADS1115_MUX_AIN1_GND, ADS1115_MUX_AIN2_GND, ADS1115_MUX_AIN3_GND, } ADS1115_MUX; typedef enum { ADS1115_PGA_6144V, ADS1115_PGA_4096V, ADS1115_PGA_2048V, ADS1115_PGA_1024V, ADS1115_PGA_0512V, ADS1115_PGA_0256V, } ADS1115_PGA; #define ADS1115_REFERENCES \ { 6144000, 4096000, 2048000, 1024000, 512000, 256000 } typedef enum { ADS1115_MODE_CONTINUOUS, ADS1115_MODE_POWER_DOWN, } ADS1115_MODE; typedef enum { ADS1115_DR_8SPS, ADS1115_DR_16SPS, ADS1115_DR_32SPS, ADS1115_DR_64SPS, ADS1115_DR_128SPS, ADS1115_DR_250SPS, ADS1115_DR_475SPS, ADS1115_DR_860SPS, } ADS1115_DR; #define ADS1115_CONVERSION_TIMES \ { 1000000 / 8, 1000000 / 16, 1000000 / 32, 1000000 / 64, \ 1000000 / 128, 1000000 / 250, 1000000 / 475, 1000000 / 860 } typedef enum { ADS1115_COMP_MODE_TRADITIONAL, ADS1115_COMP_MODE_WINDOW, } ADS1115_COMP_MODE; typedef enum { ADS1115_COMP_POL_ACTIVE_LOW, ADS1115_COMP_POL_ACTIVE_HIGH, } ADS1115_COMP_POL; typedef enum { ADS1115_COMP_LAT_DISABLE, ADS1115_COMP_LAT_ENABLE, } ADS1115_COMP_LAT; typedef enum { ADS1115_COMP_QUE_ONE, ADS1115_COMP_QUE_TWO, ADS1115_COMP_QUE_FOUR, ADS1115_COMP_QUE_DISABLE, } ADS1115_COMP_QUE; typedef union { struct { ADS1115_COMP_QUE comp_que :2; ADS1115_COMP_LAT comp_lat :1; ADS1115_COMP_POL comp_pol :1; ADS1115_COMP_MODE comp_mode:1; ADS1115_DR dr :3; ADS1115_MODE mode :1; ADS1115_PGA pga :3; ADS1115_MUX mux :3; ADS1115_OS os :1; } reg; uint16_t val; } ADS1115_CONFIG; template<typename WIRE = TwoWire, WIRE& WOBJ = Wire> class ADS1115 { private: uint8_t _addr; int32_t _value; unsigned long _start; ADS1115_CONFIG _config; ADS1115_CONFIG _active; ADS1115_STATUS _status; uint8_t write_reg(ADS1115_REG reg, uint16_t data) { WOBJ.beginTransmission(_addr); WOBJ.write(reg); WOBJ.write(highByte(data)); WOBJ.write(lowByte(data)); return WOBJ.endTransmission(); } uint8_t read_reg(ADS1115_REG reg, uint16_t *data) { WOBJ.beginTransmission(_addr); WOBJ.write(reg); uint8_t rv = WOBJ.endTransmission(false); if (rv == 0) { if (WOBJ.requestFrom(_addr, sizeof(*data)) == sizeof(*data)) { uint8_t high = WOBJ.read(); uint8_t low = WOBJ.read(); *data = makeWord(high, low); } else rv = 4; } return rv; } bool start(void) { uint8_t rv = write_reg(ADS1115_REG_CONFIG, _config.val); if (rv) _status = ADS1115_STATUS_NO_DEVICE; else { _status = ADS1115_STATUS_BUSY; _active = _config; } _start = micros(); return rv == 0; } ADS1115_STATUS fetch(void) { uint16_t val; _start = micros(); uint8_t rv = read_reg(ADS1115_REG_CONVERSION, &val); if (rv) return _status = ADS1115_STATUS_NO_DEVICE; if (_active.reg.mode == ADS1115_MODE_POWER_DOWN) _status = ADS1115_STATUS_IDLE; else _status = ADS1115_STATUS_BUSY; if (_active.reg.mux < ADS1115_MUX_AIN0_GND) _value = (int16_t)val; else _value = val; return ADS1115_STATUS_READY; } uint32_t conversion_time(void) { static const uint32_t CONVERSION_TIMES[] = ADS1115_CONVERSION_TIMES; return CONVERSION_TIMES[_active.reg.dr]; } public: ADS1115(uint8_t addr = ADS1115_DEVICE_ADDRESS) : _addr(addr) , _value(0) , _start(0) , _status(ADS1115_STATUS_NO_DEVICE) { const ADS1115_CONFIG _DEFAULT = { ADS1115_COMP_QUE_DISABLE, ADS1115_COMP_LAT_DISABLE, ADS1115_COMP_POL_ACTIVE_LOW, ADS1115_COMP_MODE_TRADITIONAL, ADS1115_DR_128SPS, ADS1115_MODE_POWER_DOWN, ADS1115_PGA_2048V, ADS1115_MUX_AIN0_AIN1, ADS1115_OS_CONVERSION, }; _config = _active = _DEFAULT; } void mux(ADS1115_MUX value) { _config.reg.mux = value; } void pga(ADS1115_PGA value) { _config.reg.pga = value; } void dr(ADS1115_DR value) { _config.reg.dr = value; } void comp_mode(ADS1115_COMP_MODE value) { _config.reg.comp_mode = value; } void comp_pol(ADS1115_COMP_POL value) { _config.reg.comp_pol = value; } void comp_lat(ADS1115_COMP_LAT value) { _config.reg.comp_lat = value; } void comp_que(ADS1115_COMP_QUE value) { _config.reg.comp_que = value; } uint8_t low_threshold(uint16_t value) { return write_reg(ADS1115_REG_LO_THRESH, value); } uint8_t high_threshold(uint16_t value) { return write_reg(ADS1115_REG_HI_THRESH, value); } uint8_t resolution(void) { return ADS1115_RESOLUSION; } uint32_t reference(void) { static const uint32_t REFERENCES[] = ADS1115_REFERENCES; return REFERENCES[_active.reg.pga]; } int32_t result(void) { return _value; } int32_t voltage(void) { return (int32_t)((int64_t)result() * reference() / 32768); } void begin(bool continuous = false) { if (!continuous) _start = micros() - ADS1115_RETRY_INTERVAL; else { _config.reg.mode = ADS1115_MODE_CONTINUOUS; _config.reg.os = ADS1115_OS_NONE; start(); } } bool restart(void) { if ((_config.val == _active.val) || (_config.reg.mode == ADS1115_MODE_POWER_DOWN)) return true; unsigned long t = (_status == ADS1115_STATUS_BUSY ? conversion_time() : 0); if (!start()) return false; if (t) { delayMicroseconds(t); _start = micros(); } return true; } bool conversion(void) { unsigned long t = 0; if (_status == ADS1115_STATUS_BUSY) t = micros() - _start; else if (!start()) return false; if (t < conversion_time()) delayMicroseconds(conversion_time() - t); return fetch() == ADS1115_STATUS_READY; } ADS1115_STATUS handle(void) { switch (_status) { default: case ADS1115_STATUS_NO_DEVICE: if (micros() - _start < ADS1115_RETRY_INTERVAL) break; case ADS1115_STATUS_IDLE: start(); break; case ADS1115_STATUS_BUSY: if (micros() - _start < conversion_time()) break; return fetch(); } return _status; } }; #endif |