mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.5 AsyncAnalog
This commit is contained in:
parent
871c7e4c5c
commit
8d8d01eeee
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: AsyncAnalog.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.3
|
||||
// VERSION: 0.1.5
|
||||
// DATE: 2018-09-05
|
||||
// PURPOSE: async version of analogRead, prevent blocking wait
|
||||
//
|
||||
@ -14,6 +14,7 @@
|
||||
// 0.1.2 2020-05-27 update library.json
|
||||
// 0.1.3 2020-12-12 added Arduino CI, minor fixes
|
||||
// 0.1.4 2020-12-12 update Arduino CI, minor fixes
|
||||
// 0.1.5 2021-12-13 update library.json, license, readme
|
||||
|
||||
|
||||
#include "AsyncAnalog.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: AsyncAnalog.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.4
|
||||
// VERSION: 0.1.5
|
||||
// DATE: 2018-09-05
|
||||
// PURPOSE: async version of analogRead for AVR
|
||||
// URL: https://github.com/RobTillaart/AsyncAnalog
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
#if !defined(ARDUINO_ARCH_AVR)
|
||||
|
||||
#error “AsyncAnalog library 0.1.3 only supports boards with an AVR processor .”
|
||||
#error “AsyncAnalog library only supports boards with an AVR processor .”
|
||||
|
||||
#else
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
#define ASYNCANALOG_LIB_VERSION (F("0.1.4"))
|
||||
#define ASYNCANALOG_LIB_VERSION (F("0.1.5"))
|
||||
|
||||
|
||||
class AsyncAnalog
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2021 Rob Tillaart
|
||||
Copyright (c) 2018-2022 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
# AsyncAnalog
|
||||
|
||||
Arduino Library for async reading of an analogue pin. **\[AVR ONLY\]**
|
||||
Arduino Library for async reading of an analogue pin. **\[AVR ONLY\]**.
|
||||
|
||||
|
||||
## Description
|
||||
@ -25,26 +25,30 @@ The library works only for AVR boards now, other platforms might be supported in
|
||||
As the UNO has only one ADC that is multiplexed, one can only read one analogue pin
|
||||
in async way simultaneously.
|
||||
|
||||
**Use with care**
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
- **AsyncAnalog(uint8_t pin)** constructor, defines the analogue pin to use.
|
||||
- **void start()** triggers a new ADC reading.
|
||||
- **bool ready()** returns true if sample is complete
|
||||
- **int value()** returns the value
|
||||
- **bool ready()** returns true if sample is complete.
|
||||
- **int value()** returns the value.
|
||||
|
||||
|
||||
## Operation
|
||||
|
||||
The example **asyncAnalogTest2.ino** shows a loop of 1000 analogReads and prints
|
||||
over Serial at 115200 baud. The async test does this in less time. Note that faster
|
||||
baud rates shows an even bigger difference.
|
||||
|
||||
During the printing, the sampling continues.
|
||||
over Serial at 115200 baud.
|
||||
|
||||
|
||||
## Future
|
||||
|
||||
- improve documentation.
|
||||
- investigate the performance gain.
|
||||
- asyncAnalogTest2.ino is no good test.
|
||||
- create examples
|
||||
- real world examples preferred.
|
||||
- investigate other platforms
|
||||
- fall back to normal analogRead for non AVR platforms ?
|
||||
-
|
||||
|
@ -14,6 +14,7 @@ uint32_t start = 0;
|
||||
uint32_t duration = 0;
|
||||
uint16_t count = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -53,3 +54,4 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/AsyncAnalog.git"
|
||||
},
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*"
|
||||
"platforms": "*",
|
||||
"headers": "AsyncAnalog.h"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=AsyncAnalog
|
||||
version=0.1.4
|
||||
version=0.1.5
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino Library for async reading of an analog pin
|
||||
|
Loading…
Reference in New Issue
Block a user