Skip to content

Commit 1247671

Browse files
authored
update readme.md (#5)
- update readme.md (badges) - add changelog.md - minor edits
1 parent 902c872 commit 1247671

File tree

6 files changed

+94
-38
lines changed

6 files changed

+94
-38
lines changed

AsyncAnalog.cpp

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
//
22
// FILE: AsyncAnalog.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.5
4+
// VERSION: 0.1.6
55
// DATE: 2018-09-05
6-
// PURPOSE: async version of analogRead, prevent blocking wait
7-
//
8-
// backgrounder
9-
// https://www.avrfreaks.net/forum/tut-c-newbies-guide-avr-adc?name=PNphpBB2&file=viewtopic&t=56429
10-
//
11-
// HISTORY:
12-
// 0.1.0 2018-09-05 initial version, based upon analogRead()
13-
// 0.1.1 2020-03-26 minor refactor
14-
// 0.1.2 2020-05-27 update library.json
15-
// 0.1.3 2020-12-12 added Arduino CI, minor fixes
16-
// 0.1.4 2020-12-12 update Arduino CI, minor fixes
17-
// 0.1.5 2021-12-13 update library.json, license, readme
6+
// PURPOSE: Async version of analogRead, prevent blocking wait
7+
// URL: https://github.com/RobTillaart/AsyncAnalog
188

199

2010
#include "AsyncAnalog.h"
2111

12+
2213
#if defined(ARDUINO_ARCH_AVR)
2314

2415
AsyncAnalog::AsyncAnalog(const uint8_t pin)
@@ -60,17 +51,18 @@ bool AsyncAnalog::ready()
6051

6152
int AsyncAnalog::value()
6253
{
63-
// we have to read ADCL first; doing so locks both ADCL
64-
// and ADCH until ADCH is read. reading ADCL second would
65-
// cause the results of each conversion to be discarded,
66-
// as ADCL and ADCH would be locked when it completed.
67-
int low = ADCL;
68-
int high = ADCH;
69-
// combine the two bytes
70-
return (high << 8) | low;
54+
// ADCL has to be read first.
55+
// Doing so locks both ADCL and ADCH until ADCH is read.
56+
// Reading ADCL second would cause the results of each conversion to
57+
// be discarded as ADCL and ADCH would be locked when it completed.
58+
uint16_t lo = ADCL;
59+
uint16_t hi = ADCH;
60+
// Combine two parts.
61+
// _lastValue = (hi * 256) + lo;
62+
return (hi * 256) + lo;
7163
}
7264

73-
#endif // ARDUINO_ARCH_AVR
65+
#endif // ARDUINO_ARCH_AVR
7466

7567

76-
// -- END OF FILE --
68+
// -- END OF FILE --

AsyncAnalog.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22
//
33
// FILE: AsyncAnalog.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.1.5
5+
// VERSION: 0.1.6
66
// DATE: 2018-09-05
7-
// PURPOSE: async version of analogRead for AVR
7+
// PURPOSE: Async version of analogRead for AVR
88
// URL: https://github.com/RobTillaart/AsyncAnalog
9-
//
109

1110

1211
#if !defined(ARDUINO_ARCH_AVR)
1312

1413
#error “AsyncAnalog library only supports boards with an AVR processor .”
15-
14+
1615
#else
1716

1817
// (ARDUINO_ARCH_SAM) future
18+
// (ARDUINO_ARCH_ESP32) future
19+
// (ARDUINO_ARCH_ESP8266) future
1920

2021

2122
#include "Arduino.h"
2223
#include "wiring_private.h"
2324
#include "pins_arduino.h"
2425

25-
#define ASYNCANALOG_LIB_VERSION (F("0.1.5"))
26+
#define ASYNCANALOG_LIB_VERSION (F("0.1.6"))
2627

2728

2829
class AsyncAnalog
@@ -35,9 +36,11 @@ class AsyncAnalog
3536
int value();
3637

3738
private:
38-
uint8_t _pin;
39+
uint8_t _pin;
40+
// uint16_t _lastValue;
3941
};
4042

41-
#endif
43+
#endif // defined(ARDUINO_ARCH_AVR)
44+
4245

43-
// -- END OF FILE --
46+
// -- END OF FILE --

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Change Log AsyncAnalog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
9+
## [0.1.6] - 2023-10-17
10+
- update readme.md
11+
- add changelog.md
12+
- minor edits
13+
14+
15+
## [0.1.5] - 2021-12-13
16+
- update library.json
17+
- update license
18+
- update readme.md
19+
20+
## [0.1.4] - 2020-12-12
21+
- update Arduino CI
22+
- minor fixes
23+
24+
## [0.1.3] - 2020-12-12
25+
- added Arduino CI
26+
- minor fixes
27+
28+
## [0.1.2] - 2020-05-27
29+
- update library.json
30+
31+
## [0.1.1] - 2020-03-26
32+
- minor refactor
33+
34+
## [0.1.0] - 2018-09-05
35+
- initial version, based upon analogRead()
36+

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
[![Arduino CI](https://github.com/RobTillaart/AsyncAnalog/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
33
[![Arduino-lint](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/arduino-lint.yml)
44
[![JSON check](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/jsoncheck.yml)
5+
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/AsyncAnalog.svg)](https://github.com/RobTillaart/AsyncAnalog/issues)
6+
57
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/AsyncAnalog/blob/master/LICENSE)
68
[![GitHub release](https://img.shields.io/github/release/RobTillaart/AsyncAnalog.svg?maxAge=3600)](https://github.com/RobTillaart/AsyncAnalog/releases)
9+
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/AsyncAnalog.svg)](https://registry.platformio.org/libraries/robtillaart/AsyncAnalog)
710

811

912
# AsyncAnalog
@@ -13,7 +16,7 @@ Arduino Library for async reading of an analogue pin. **\[AVR ONLY\]**.
1316

1417
## Description
1518

16-
AsyncAnalog is a library to read the analogue port of an AVR in an asynchronous way.
19+
AsyncAnalog is a library to read the analogue port of an **AVR** in an asynchronous way.
1720
This means that the user must explicitly **start** the ADC, check if it is **ready**
1821
and read out its **value**.
1922

@@ -22,13 +25,18 @@ By using this class, the user prevents the (~112 uSec) blocking of the
2225

2326
The library works only for AVR boards now, other platforms might be supported in the future.
2427

28+
**WARNING**
2529
As the UNO has only one ADC that is multiplexed, one can only read one analogue pin
2630
in async way simultaneously.
2731

2832
**Use with care**
2933

3034

31-
## Interface
35+
## Interface
36+
37+
```cpp
38+
#include "AsynAnalog,h"
39+
```
3240

3341
- **AsyncAnalog(uint8_t pin)** constructor, defines the analogue pin to use.
3442
- **void start()** triggers a new ADC reading.
@@ -44,12 +52,29 @@ over Serial at 115200 baud.
4452

4553
## Future
4654

55+
#### Must
56+
57+
#### Should
58+
4759
- improve documentation.
60+
61+
#### Could
62+
4863
- investigate the performance gain.
49-
- asyncAnalogTest2.ino is no good test.
64+
- asyncAnalogTest2.ino is not a good test.
5065
- create examples
5166
- real world examples preferred.
5267
- investigate other platforms
5368
- fall back to normal analogRead for non AVR platforms ?
54-
-
69+
- better have specific code per platform.
70+
71+
#### Wont
72+
73+
## Support
74+
75+
If you appreciate my libraries, you can support the development and maintenance.
76+
Improve the quality of the libraries by providing issues and Pull Requests, or
77+
donate through PayPal or GitHub sponsors.
78+
79+
Thank you,
5580

library.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/AsyncAnalog.git"
1717
},
18-
"version": "0.1.5",
18+
"version": "0.1.6",
1919
"license": "MIT",
20-
"frameworks": "arduino",
20+
"frameworks": "*",
2121
"platforms": "*",
2222
"headers": "AsyncAnalog.h"
2323
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=AsyncAnalog
2-
version=0.1.5
2+
version=0.1.6
33
author=Rob Tillaart <rob.tillaart@gmail.com>
44
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
55
sentence=Arduino Library for async reading of an analog pin

0 commit comments

Comments
 (0)