Exemple #1
0
void SkaarhojAnalog::uniDirectionalSlider_disableUnidirectionality(bool disable) {
  _uniDirectionalSlider_disableUnidirectionality = disable;
  _uniDirectionalSlider_previousSliderValue = -1;
  _uniDirectionalSlider_previousTransitionPosition = -1;
  _uniDirectionalSlider_sliderDirectionUp = false;

  uniDirectionalSlider_hasMoved(); // Make sure the _uniDirectionalSlider_previousSliderValue is set correctly.
}
Exemple #2
0
void SkaarhojUtils::uniDirectionalSlider_init(int sliderTolerance, int sliderLowEndOffset, int sliderHighEndOffset, uint8_t analogInputPin)	{

		// Configuration constants, should have setter-methods:
	_uniDirectionalSlider_analogInputPin = analogInputPin;
	_uniDirectionalSlider_sliderTolerance = sliderTolerance;  // >0. How much it should be moved before it counts as a change.
    _uniDirectionalSlider_sliderLowEndOffset = sliderLowEndOffset;  // >0. How far the slider is moved in the low end before we start registering the value range: The starting position.
    _uniDirectionalSlider_sliderHighEndOffset = sliderHighEndOffset;  // >0. How far the slider is moved in the high end before we start registering the value range: The ending position.

	pinMode(analogInputPin, INPUT);
	
		// Internal variables during operation:
	_uniDirectionalSlider_previousSliderValue=-1;
	_uniDirectionalSlider_previousTransitionPosition=-1;
	_uniDirectionalSlider_sliderDirectionUp = false;
	_uniDirectionalSlider_disableUnidirectionality = false;
	
	uniDirectionalSlider_hasMoved();	// Make sure the _uniDirectionalSlider_previousSliderValue is set correctly.
}
/**
 * Slider functions:
 */
void SkaarhojAnalog::uniDirectionalSlider_init(int sliderTolerance, int sliderLowEndOffset, int sliderHighEndOffset, uint8_t i2cAddress, uint8_t pinIndex)	{

	ADS7828 analogConv; // Address
	_analogConv = analogConv;
	_analogConv.init(i2cAddress);
	
		// Configuration constants, should have setter-methods:
	_uniDirectionalSlider_pinIndex = pinIndex;
	_uniDirectionalSlider_sliderTolerance = sliderTolerance;  // >0. How much it should be moved before it counts as a change.
    _uniDirectionalSlider_sliderLowEndOffset = sliderLowEndOffset;  // >0. How far the slider is moved in the low end before we start registering the value range: The starting position.
    _uniDirectionalSlider_sliderHighEndOffset = sliderHighEndOffset;  // >0. How far the slider is moved in the high end before we start registering the value range: The ending position.
	
		// Internal variables during operation:
	_uniDirectionalSlider_previousSliderValue=-1;
	_uniDirectionalSlider_previousTransitionPosition=-1;
	_uniDirectionalSlider_sliderDirectionUp = false;
	_uniDirectionalSlider_disableUnidirectionality = false;
	
	uniDirectionalSlider_hasMoved();	// Make sure the _uniDirectionalSlider_previousSliderValue is set correctly.
}