Skip to content

Commit 603c37a

Browse files
committed
0.3.1 ADC081S
1 parent df87da5 commit 603c37a

14 files changed

Lines changed: 56 additions & 32 deletions

File tree

libraries/ADC081S/.github/workflows/arduino-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
runs-on: ubuntu-latest
77
timeout-minutes: 5
88
steps:
9-
- uses: actions/checkout@v4
10-
- uses: arduino/arduino-lint-action@v1
9+
- uses: actions/checkout@v5
10+
- uses: arduino/arduino-lint-action@v2
1111
with:
1212
library-manager: update
1313
compliance: strict

libraries/ADC081S/.github/workflows/arduino_test_runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
timeout-minutes: 20
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
- uses: ruby/setup-ruby@v1
1313
with:
1414
ruby-version: 2.6

libraries/ADC081S/.github/workflows/jsoncheck.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
paths:
66
- '**.json'
77
pull_request:
8+
paths:
9+
- '**.json'
810

911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
1214
timeout-minutes: 5
1315
steps:
14-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1517
- name: json-syntax-check
1618
uses: limitusus/json-syntax-check@v2
1719
with:

libraries/ADC081S/ADC081S.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: ADC081S.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.3.0
4+
// VERSION: 0.3.1
55
// DATE: 2024-01-10
66
// PURPOSE: Arduino library for ADC081S 8 bit ADC (SPI)
77
// URL: https://github.com/RobTillaart/ADC081S
@@ -74,7 +74,7 @@ uint32_t ADC081S::count()
7474

7575
uint16_t ADC081S::read()
7676
{
77-
return readADC() >> 4; // remove 4 trailing zero's
77+
return readADC() >> 4; // remove 4 trailing zero bits
7878
}
7979

8080

@@ -197,7 +197,7 @@ ADC101S::ADC101S(uint8_t data, uint8_t clock) : ADC081S(data, clock)
197197

198198
uint16_t ADC101S::read()
199199
{
200-
return readADC() >> 2; // remove 2 trailing zero's
200+
return readADC() >> 2; // remove 2 trailing zero bits
201201
}
202202

203203

libraries/ADC081S/ADC081S.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: ADC081S.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.3.0
5+
// VERSION: 0.3.1
66
// DATE: 2024-01-10
77
// PURPOSE: Arduino library for ADC081S 8 bit ADC (SPI)
88
// URL: https://github.com/RobTillaart/ADC081S
@@ -13,7 +13,7 @@
1313
#include "SPI.h"
1414

1515

16-
#define ADC081S_LIB_VERSION (F("0.3.0"))
16+
#define ADC081S_LIB_VERSION (F("0.3.1"))
1717

1818

1919
#ifndef __SPI_CLASS__
@@ -45,9 +45,9 @@ class ADC081S
4545
// speed in Hz
4646
void setSPIspeed(uint32_t speed);
4747
uint32_t getSPIspeed();
48+
bool usesHWSPI();
4849

4950
// debugging
50-
bool usesHWSPI();
5151
uint32_t count(); // number of channels read.
5252

5353
void lowPower();

libraries/ADC081S/CHANGELOG.md

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

88

9+
## [0.3.1] - 2025-12-09
10+
- update GitHub actions
11+
- update examples
12+
- minor edits
13+
914
## [0.3.0] - 2024-11-06
1015
- fix #9, sync with ADC08XS
1116
- redo low level SPI_MODE3

libraries/ADC081S/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024-2024 Rob Tillaart
3+
Copyright (c) 2024-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

libraries/ADC081S/README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,42 @@ This library only supports the single channel versions.
2929
The library does not support the I2C versions of these devices.
3030
These can be recognized from the C as ADCxxxC
3131

32-
The library can put the device in **lowPower()** and needs a call to
33-
**wakeUp()** to wake up. Alternative way to wake up the device is to
34-
do a dummy **read()**.
32+
The library can put the device in **lowPower()** mode and needs a call to
33+
**wakeUp()** to wake up the device.
34+
Alternative way to wake up the device is to execute a dummy **read()**.
3535

3636
The library is not tested with hardware yet.
3737

3838
Feedback is as always welcome.
3939

4040

41-
#### 0.2.0 Breaking change
41+
### 0.2.0 Breaking change
4242

4343
Version 0.2.0 introduced a breaking change to improve handling the SPI dependency.
4444
The user has to call **SPI.begin()** or equivalent before calling **ADC.begin()**.
4545
Optionally the user can provide parameters to the **SPI.begin(...)**
4646

4747

48-
#### Performance
48+
### Performance
4949

5050
Although the ADC081S021 is rated at 200 KSPS, an Arduino UNO will not
5151
be able to fetch that much samples from the device.
5252
The reason is that an UNO cannot fetch the bits fast enough from the device.
53-
At maximum SPI speed of 8 MHz one will get at most 50 KSPS.
53+
At maximum SPI speed of 8 MHz one will get at most 50 KSPS.
54+
Furthermore the UNO has only 2KB RAM so it would fill up quite fast.
5455

5556
For the faster ones, see below, at 1 MSPS one need a clock of at least 16 MHz
5657
+ time to process the incoming data.
5758
A faster processor like an ESP32 or Teensy might do the job.
5859

60+
Investigations should be made for a sort of continuous mode.
61+
This would have the CS line constantly LOW and be able to read from the same
62+
address over and over. Note this is not in the library!
63+
5964
To be tested, feedback welcome.
6065

6166

62-
#### Compatibles
67+
### Compatibles
6368

6469
Texas instruments has 9 devices in this series, which can be used with the
6570
three classes of this library.
@@ -81,14 +86,16 @@ e.g ADC081S021 = 8 bits 1 channel SPI 200000
8186
S == SPI.C == I2C.
8287

8388

84-
#### Related
89+
### Related
8590

8691
- https://github.com/RobTillaart/ADC08XS 2 + 4 channel library
92+
- https://github.com/RobTillaart/ADC081S single channel version of this series.
8793
- https://gammon.com.au/adc tutorial about ADC's (UNO specific)
8894
- https://github.com/RobTillaart/MCP_ADC
8995
- https://github.com/RobTillaart/ADS1x15 (12 & 16 bit ADC, I2C, slow)
9096
- https://github.com/RobTillaart/PCF8591 (8 bit ADC + 1 bit DAC)
9197
- https://github.com/RobTillaart/MCP_DAC
98+
- https://www.mikroe.com/adc-19-click
9299

93100

94101
## Interface
@@ -97,7 +104,7 @@ S == SPI.C == I2C.
97104
#include "ADC081S.h"
98105
```
99106

100-
#### Constructors
107+
### Constructors
101108

102109
The ADC101S and ADC121S have an identical interface as the ADC081S.
103110

@@ -109,27 +116,30 @@ The ADC101S and ADC121S have an identical interface as the ADC081S.
109116
depending on number of bits of the actual ADC.
110117

111118

112-
#### Base
119+
### Read
120+
121+
- **uint16_t read()** reads a value from the device.
122+
123+
124+
### SPI
113125

114-
- **uint16_t read()** reads the value of the device.
115126
- **void setSPIspeed(uint32_t speed)** sets SPI clock in **Hz**,
116127
please read datasheet of the ADC first to get optimal speed.
117128
- **uint32_t getSPIspeed()** returns current speed in **Hz**.
129+
- **bool usesHWSPI()** returns true if hardware SPI is used.
118130

119131

120-
#### Low power
132+
### Low power
121133

122134
- **void lowPower()** put device in low power mode.
123135
- **void wakeUp()** put device in normal power mode.
124136
- **bool isLowPower()** returns true if in low power mode, so wakeUp needed().
125137

126-
Alternative way to wake up the device is to
127-
do a dummy **read()**.
138+
Alternative way to wake up the device is to do a dummy **read()** call.
128139

129140

130-
#### Debug
141+
### Debug
131142

132-
- **bool usesHWSPI()** returns true if hardware SPI is used.
133143
- **uint32_t count()** returns number of reads since start.
134144

135145

@@ -139,7 +149,7 @@ do a dummy **read()**.
139149

140150
- improve documentation
141151
- get hardware to test / verify working
142-
- align with ADC08XS where possible
152+
- align with ADC081S/ADC08XS where possible
143153

144154
#### Should
145155

libraries/ADC081S/examples/ADC081S_low_power/ADC081S_low_power.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ ADC081S adc01; // use HWSPI
1414
void setup()
1515
{
1616
Serial.begin(115200);
17+
Serial.println();
1718
Serial.println(__FILE__);
1819
Serial.print("ADC081S_LIB_VERSION: ");
1920
Serial.println(ADC081S_LIB_VERSION);
21+
Serial.println();
2022

2123
SPI.begin();
2224
adc01.begin(10);
@@ -30,7 +32,7 @@ void loop()
3032
delay(15000);
3133

3234
Serial.println("wake up for 15 seconds.");
33-
if (adc01.isLowPower())
35+
if (adc01.isLowPower())
3436
{
3537
adc01.wakeUp();
3638
}

libraries/ADC081S/examples/ADC081S_performance/ADC081S_performance.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ uint32_t start, stop, read_time;
1919
void setup()
2020
{
2121
Serial.begin(115200);
22+
Serial.println();
2223
Serial.println(__FILE__);
2324
Serial.print("ADC081S_LIB_VERSION: ");
2425
Serial.println(ADC081S_LIB_VERSION);

0 commit comments

Comments
 (0)