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, unsigned short tMinPos = 0, unsigned short tMaxPos = 1024>
class Slider : public TReader
{
public:
template <typename... Args>
Slider(Args... args) : TReader(args...)
{
}
signed short getValue(unsigned short aMinPos, unsigned short aMaxPos)
{
return constrain(map(TReader::getValue(), aMinPos, aMaxPos, 0, 1000), 0, 1000);
}
signed short getValue()
{
return getValue(tMinPos, tMaxPos);
}
};
template <unsigned short tPin, int tPinMode, unsigned short tMinPos, unsigned short tMaxPos>
using PinSlider = Slider<AnalogPinReader<tPin, tPinMode>, tMinPos, tMaxPos>;
};