Skip to content

Commit 9ec1d36

Browse files
committed
0.1.4 AsyncAnalog
1 parent 89504e5 commit 9ec1d36

File tree

11 files changed

+64
-28
lines changed

11 files changed

+64
-28
lines changed

libraries/AsyncAnalog/.arduino-ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ compile:
22
# Choosing to run compilation tests on 2 different Arduino platforms
33
platforms:
44
- uno
5+
# - due
6+
# - zero
57
- leonardo
6-
8+
# - m4
9+
# - esp32
10+
# - esp8266
11+
- mega2560

libraries/AsyncAnalog/.github/workflows/arduino_test_runner.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ name: Arduino CI
44
on: [push, pull_request]
55

66
jobs:
7-
arduino_ci:
7+
runTest:
88
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: Arduino-CI/action@master
13-
# Arduino-CI/[email protected]
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- run: |
16+
gem install arduino_ci
17+
arduino_ci.rb

libraries/AsyncAnalog/AsyncAnalog.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
// https://www.avrfreaks.net/forum/tut-c-newbies-guide-avr-adc?name=PNphpBB2&file=viewtopic&t=56429
1010
//
1111
// 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
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
1617

1718

1819
#include "AsyncAnalog.h"
@@ -29,6 +30,7 @@ AsyncAnalog::AsyncAnalog(const uint8_t pin)
2930
#endif
3031
}
3132

33+
3234
void AsyncAnalog::start()
3335
{
3436
#if defined(ADCSRB) && defined(MUX5)
@@ -38,7 +40,7 @@ void AsyncAnalog::start()
3840
#endif
3941

4042
#if defined(ADMUX)
41-
// set the analog reference (high two bits of ADMUX) and select the
43+
// set the analogue reference (high two bits of ADMUX) and select the
4244
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
4345
// to 0 (the default).
4446
ADMUX = (DEFAULT << 6) | (_pin & 0x07);
@@ -69,4 +71,5 @@ int AsyncAnalog::value()
6971

7072
#endif // ARDUINO_ARCH_AVR
7173

72-
// -- END OF FILE --
74+
75+
// -- END OF FILE --

libraries/AsyncAnalog/AsyncAnalog.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
//
33
// FILE: AsyncAnalog.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.1.3
5+
// VERSION: 0.1.4
66
// DATE: 2018-09-05
7-
// PURPOSE: async version of analogRead
7+
// PURPOSE: async version of analogRead for AVR
88
// URL: https://github.com/RobTillaart/AsyncAnalog
99
//
1010

11+
1112
#if !defined(ARDUINO_ARCH_AVR)
1213

1314
#error “AsyncAnalog library 0.1.3 only supports boards with an AVR processor .”
@@ -21,12 +22,13 @@
2122
#include "wiring_private.h"
2223
#include "pins_arduino.h"
2324

24-
#define ASYNCANALOG_LIB_VERSION "0.1.3"
25+
#define ASYNCANALOG_LIB_VERSION (F("0.1.4"))
26+
2527

2628
class AsyncAnalog
2729
{
2830
public:
29-
AsyncAnalog(uint8_t pin);
31+
AsyncAnalog(const uint8_t pin);
3032

3133
void start();
3234
bool ready();

libraries/AsyncAnalog/README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11

22
[![Arduino CI](https://github.com/RobTillaart/AsyncAnalog/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
3+
[![Arduino-lint](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/arduino-lint.yml)
4+
[![JSON check](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/AsyncAnalog/actions/workflows/jsoncheck.yml)
35
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/AsyncAnalog/blob/master/LICENSE)
46
[![GitHub release](https://img.shields.io/github/release/RobTillaart/AsyncAnalog.svg?maxAge=3600)](https://github.com/RobTillaart/AsyncAnalog/releases)
57

8+
69
# AsyncAnalog
710

8-
Arduino Library for async reading of an analog pin. **\[AVR ONLY\]**
11+
Arduino Library for async reading of an analogue pin. **\[AVR ONLY\]**
912

1013

1114
## Description
12-
AsyncAnalog is a library to read the analog port in an asynchronous way.
15+
16+
AsyncAnalog is a library to read the analogue port of an AVR in an asynchronous way.
1317
This means that the user must explicitly **start** the ADC, check if it is **ready**
1418
and read out its **value**.
1519

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

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

21-
As the UNO has only one ADC that is multiplexed, one can only read one analog pin
25+
As the UNO has only one ADC that is multiplexed, one can only read one analogue pin
2226
in async way simultaneously.
2327

24-
## Interface
2528

26-
- **AsyncAnalog(uint8_t pin)** constructor, defines the analog pin to use.
27-
28-
The library consists of three main function:
29+
## Interface
2930

31+
- **AsyncAnalog(uint8_t pin)** constructor, defines the analogue pin to use.
3032
- **void start()** triggers a new ADC reading.
3133
- **bool ready()** returns true if sample is complete
3234
- **int value()** returns the value
3335

36+
3437
## Operation
3538

3639
The example **asyncAnalogTest2.ino** shows a loop of 1000 analogReads and prints
3740
over Serial at 115200 baud. The async test does this in less time. Note that faster
38-
baudrates shows an even bigger difference.
41+
baud rates shows an even bigger difference.
3942

4043
During the printing, the sampling continues.
4144

4245

46+
## Future
47+
48+
- investigate other platforms
49+
- fall back to normal analogRead for non AVR platforms ?
50+
-
51+

libraries/AsyncAnalog/examples/asyncAnalogTest/asyncAnalogTest.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
// VERSION: 0.1.1
55
// DATE: 2018-09-05
66

7+
78
#include "AsyncAnalog.h"
89

10+
911
AsyncAnalog AA(A0);
1012

1113
uint32_t start = 0;
@@ -22,6 +24,7 @@ void setup()
2224
start = micros();
2325
}
2426

27+
2528
void loop()
2629
{
2730

@@ -48,4 +51,5 @@ void loop()
4851
count++;
4952
}
5053

51-
// END OF FILE
54+
55+
// -- END OF FILE --

libraries/AsyncAnalog/examples/asyncAnalogTest2/asyncAnalogTest2.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
// VERSION: 0.1.0
55
// DATE: 2020-03-27
66

7+
78
#include "AsyncAnalog.h"
89

10+
911
AsyncAnalog AA(A0);
1012

1113
uint32_t start = 0;
@@ -70,4 +72,5 @@ void async_test()
7072
Serial.print("\n\n");
7173
}
7274

73-
// END OF FILE
75+
76+
// -- END OF FILE --

libraries/AsyncAnalog/keywords.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Syntax Coloring Map For AsyncAnalog
1+
# Syntax Colouring Map For AsyncAnalog
22

3-
# Datatypes (KEYWORD1)
3+
# Data types (KEYWORD1)
44
AsyncAnalog KEYWORD1
55

66

libraries/AsyncAnalog/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/AsyncAnalog.git"
1717
},
18-
"version": "0.1.3",
18+
"version": "0.1.4",
1919
"license": "MIT",
2020
"frameworks": "arduino",
2121
"platforms": "*"

libraries/AsyncAnalog/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.3
2+
version=0.1.4
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino Library for async reading of an analog pin

0 commit comments

Comments
 (0)