Skip to content

Commit 6c86d80

Browse files
authored
update readme.md COMP_POLARITY (#77)
- Fix #76, update readme.md Comparator Polarity - added defines to replace magic numbers (not used in code yet) - minor edits
1 parent 50dbd26 commit 6c86d80

File tree

10 files changed

+242
-45
lines changed

10 files changed

+242
-45
lines changed

ADS1X15.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: ADS1X15.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.4.3
4+
// VERSION: 0.4.4
55
// DATE: 2013-03-24
66
// PURPOSE: Arduino library for ADS1015 and ADS1115
77
// URL: https://github.com/RobTillaart/ADS1X15
@@ -24,7 +24,7 @@
2424

2525
// CONFIG REGISTER
2626

27-
// BIT 15 Operational Status // 1 << 15
27+
// BIT 15 Operational Status // 1 << 15
2828
#define ADS1X15_OS_BUSY 0x0000
2929
#define ADS1X15_OS_NOT_BUSY 0x8000
3030
#define ADS1X15_OS_START_SINGLE 0x8000
@@ -53,7 +53,7 @@
5353
#define ADS1X15_MODE_CONTINUE 0x0000
5454
#define ADS1X15_MODE_SINGLE 0x0100
5555

56-
// BIT 5-7 data rate sample per second // (0..7) << 5
56+
// BIT 5-7 data rate sample per second // (0..7) << 5
5757
/*
5858
differs for different devices, check datasheet or readme.md
5959
@@ -69,26 +69,26 @@ differs for different devices, check datasheet or readme.md
6969
| 7 | 3300 | 860 | fastest |
7070
*/
7171

72-
// BIT 4 comparator modi // 1 << 4
72+
// BIT 4 comparator modi // 1 << 4
7373
#define ADS1X15_COMP_MODE_TRADITIONAL 0x0000
7474
#define ADS1X15_COMP_MODE_WINDOW 0x0010
7575

76-
// BIT 3 ALERT active value // 1 << 3
76+
// BIT 3 ALERT active value // 1 << 3
7777
#define ADS1X15_COMP_POL_ACTIV_LOW 0x0000
7878
#define ADS1X15_COMP_POL_ACTIV_HIGH 0x0008
7979

80-
// BIT 2 ALERT latching // 1 << 2
80+
// BIT 2 ALERT latching // 1 << 2
8181
#define ADS1X15_COMP_NON_LATCH 0x0000
8282
#define ADS1X15_COMP_LATCH 0x0004
8383

84-
// BIT 0-1 ALERT mode // (0..3)
84+
// BIT 0-1 ALERT mode // (0..3)
8585
#define ADS1X15_COMP_QUE_1_CONV 0x0000 // trigger alert after 1 convert
8686
#define ADS1X15_COMP_QUE_2_CONV 0x0001 // trigger alert after 2 converts
8787
#define ADS1X15_COMP_QUE_4_CONV 0x0002 // trigger alert after 4 converts
8888
#define ADS1X15_COMP_QUE_NONE 0x0003 // disable comparator
8989

9090

91-
// _CONFIG masks
91+
// _CONFIG masks
9292
//
9393
// | bit | description |
9494
// |:-----:|:-----------------------|
@@ -131,7 +131,7 @@ void ADS1X15::reset()
131131
setMode(1); // _mode = ADS1X15_MODE_SINGLE;
132132
setDataRate(4); // middle speed, depends on device.
133133

134-
// COMPARATOR variables # see notes .h
134+
// COMPARATOR variables # see notes .h
135135
_compMode = 0;
136136
_compPol = 1;
137137
_compLatch = 0;
@@ -423,7 +423,7 @@ void ADS1X15::setWireClock(uint32_t clockSpeed)
423423
// TODO: get the real clock speed from the I2C interface if possible.
424424
uint32_t ADS1X15::getWireClock()
425425
{
426-
// UNO 328 and
426+
// UNO 328 and
427427
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
428428
uint32_t speed = F_CPU / ((TWBR * 2) + 16);
429429
return speed;

ADS1X15.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: ADS1X15.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.4.3
5+
// VERSION: 0.4.4
66
// DATE: 2013-03-24
77
// PURPOSE: Arduino library for ADS1015 and ADS1115
88
// URL: https://github.com/RobTillaart/ADS1X15
@@ -12,7 +12,7 @@
1212
#include "Arduino.h"
1313
#include "Wire.h"
1414

15-
#define ADS1X15_LIB_VERSION (F("0.4.3"))
15+
#define ADS1X15_LIB_VERSION (F("0.4.4"))
1616

1717
// allow compile time default address
1818
// address in { 0x48, 0x49, 0x4A, 0x4B }, no test...
@@ -31,6 +31,26 @@
3131
#define ADS1X15_INVALID_MODE 0xFE
3232

3333

34+
// PARAMETER CONSTANTS NOT USED IN CODE YET
35+
// enum ?
36+
#define ADS1X15_GAIN_6144MV 0x00
37+
#define ADS1X15_GAIN_4096MV 0x01
38+
#define ADS1X15_GAIN_2048MV 0x02
39+
#define ADS1X15_GAIN_1024MV 0x04
40+
#define ADS1X15_GAIN_0512MV 0x08
41+
#define ADS1X15_GAIN_0256MV 0x10
42+
43+
#define ADS1x15_COMP_MODE_TRADITIONAL 0x00
44+
#define ADS1x15_COMP_MODE_WINDOW 0x01
45+
46+
#define ADS1x15_COMP_POL_FALLING_EDGE 0x00
47+
#define ADS1x15_COMP_POL_RISING_EDGE 0x01
48+
49+
#define ADS1x15_COMP_POL_LATCH 0x00
50+
#define ADS1x15_COMP_POL_NOLATCH 0x01
51+
52+
53+
3454
class ADS1X15
3555
{
3656
public:
@@ -56,7 +76,7 @@ class ADS1X15
5676

5777

5878
// 0 = CONTINUOUS
59-
// 1 = SINGLE default
79+
// 1 = SINGLE default
6080
void setMode(uint8_t mode = 1); // invalid values are mapped to 1 (default)
6181
uint8_t getMode(); // 0xFE == invalid mode error.
6282

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77

8+
## [0.4.4] - 2024-06-28
9+
- Fix #76, update readme.md Comparator Polarity
10+
- added defines to replace magic numbers (not used in code yet)
11+
- minor edits
12+
813
## [0.4.3] - 2024-06-25
914
- Fix #74, ALERT/RDY pin documentation
1015
- update readme.md

0 commit comments

Comments
 (0)