File evaSlider.h¶
File List > src > evaSlider.h
Go to the documentation of this file
#pragma once
#include "evaStdReaders.h"
#include <Arduino.h>
namespace eva
{
template <class TReader, signed short tMinPos = 0, signed short tMaxPos = 1024>
class Slider : public TReader
{
public:
template <typename... Args>
Slider(Args... args) : TReader(args...)
{
}
signed short getValue(signed short aMinPos, signed short aMaxPos)
{
return constrain(map(TReader::getValue(), aMinPos, aMaxPos, 0, 1000), 0, 1000);
}
signed short getValue()
{
return getValue(tMinPos, tMaxPos);
}
};
template <signed short tPin, int tPinMode, signed short tMinPos, signed short tMaxPos>
using PinSlider = Slider<AnalogPinReader<tPin, tPinMode>, tMinPos, tMaxPos>;
};