2021-01-29 06:31:58 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: AsyncAnalog.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2023-10-17 13:46:28 -04:00
|
|
|
// VERSION: 0.1.6
|
2021-01-29 06:31:58 -05:00
|
|
|
// DATE: 2018-09-05
|
2023-10-17 13:46:28 -04:00
|
|
|
// PURPOSE: Async version of analogRead for AVR
|
2021-01-29 06:31:58 -05:00
|
|
|
// URL: https://github.com/RobTillaart/AsyncAnalog
|
|
|
|
|
2021-10-19 05:14:50 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#if !defined(ARDUINO_ARCH_AVR)
|
|
|
|
|
2021-12-13 13:46:42 -05:00
|
|
|
#error “AsyncAnalog library only supports boards with an AVR processor .”
|
2023-10-17 13:46:28 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#else
|
|
|
|
|
|
|
|
// (ARDUINO_ARCH_SAM) future
|
2023-10-17 13:46:28 -04:00
|
|
|
// (ARDUINO_ARCH_ESP32) future
|
|
|
|
// (ARDUINO_ARCH_ESP8266) future
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
#include "wiring_private.h"
|
|
|
|
#include "pins_arduino.h"
|
|
|
|
|
2023-10-17 13:46:28 -04:00
|
|
|
#define ASYNCANALOG_LIB_VERSION (F("0.1.6"))
|
2021-10-19 05:14:50 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
class AsyncAnalog
|
|
|
|
{
|
|
|
|
public:
|
2021-10-19 05:14:50 -04:00
|
|
|
AsyncAnalog(const uint8_t pin);
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
void start();
|
|
|
|
bool ready();
|
|
|
|
int value();
|
|
|
|
|
|
|
|
private:
|
2023-10-17 13:46:28 -04:00
|
|
|
uint8_t _pin;
|
|
|
|
// uint16_t _lastValue;
|
2021-01-29 06:31:58 -05:00
|
|
|
};
|
|
|
|
|
2023-10-17 13:46:28 -04:00
|
|
|
#endif // defined(ARDUINO_ARCH_AVR)
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2023-10-17 13:46:28 -04:00
|
|
|
// -- END OF FILE --
|