62 current_value += step_size;
87 void set(T targetvalue, T num_steps)
90 T numerator = targetvalue-current_value;
91 step_size= numerator/num_steps;
94 current_value = targetvalue;
104 void set(T startvalue, T targetvalue, T num_steps)
107 set(targetvalue, num_steps);
117 unsigned char current_value;
137 current_value += step_size;
138 return current_value;
149 void set(
unsigned char value)
161 void set(
unsigned char targetvalue,
unsigned char num_steps)
163 step_size=(char)((((
float)targetvalue-current_value)/num_steps));
172 void set(
unsigned char startvalue,
unsigned char targetvalue,
unsigned char num_steps)
175 set(targetvalue, num_steps);
186 unsigned int current_value;
206 current_value += step_size;
207 return current_value;
218 void set(
unsigned int value)
230 void set(
unsigned int targetvalue,
unsigned int num_steps)
232 step_size=(int)((((
float)targetvalue-current_value)/num_steps));
242 void set(
unsigned int startvalue,
unsigned int targetvalue,
unsigned int num_steps)
245 set(targetvalue, num_steps);
258 unsigned long current_value;
278 current_value += step_size;
279 return current_value;
290 void set(
unsigned long value)
302 void set(
unsigned long targetvalue,
unsigned long num_steps)
304 step_size=(long)((((
float)targetvalue-current_value)/num_steps));
313 void set(
unsigned long startvalue,
unsigned long targetvalue,
unsigned long num_steps)
316 set(targetvalue, num_steps);
322 template<
int8_t NI,
int8_t NF>
326 typedef UFix<NI, NF> internal_type;
327 internal_type current_value;
328 SFix<NI,NF> step_size;
342 current_value = current_value + step_size;
343 return current_value;
352 void set(internal_type value)
362 void set(internal_type targetvalue, UFix<_NI,0> num_steps)
364 if(num_steps.asRaw()) {
365 auto numerator = targetvalue-current_value;
366 step_size = numerator*num_steps.invAccurate();
369 current_value = targetvalue;
379 void set(internal_type targetvalue, T num_steps)
382 auto numerator = targetvalue-current_value;
383 step_size = internal_type(numerator.asRaw()/num_steps,
true);
386 current_value = targetvalue;
396 void set(internal_type startvalue, internal_type targetvalue, T num_steps)
399 set(targetvalue, num_steps);
405 template<
int8_t NI,
int8_t NF>
409 typedef SFix<NI, NF> internal_type;
410 internal_type current_value;
411 SFix<NI+1, NF> step_size;
425 current_value = current_value + step_size;
426 return current_value;
435 void set(internal_type value)
445 void set(internal_type targetvalue, UFix<_NI,0> num_steps)
447 if(num_steps.asRaw()) {
448 auto numerator = targetvalue-current_value;
449 step_size = numerator*num_steps.invAccurate();
452 current_value = targetvalue;
462 void set(internal_type targetvalue, T num_steps)
465 auto numerator = targetvalue-current_value;
466 step_size = internal_type(numerator.asRaw()/num_steps,
true);
469 current_value = targetvalue;
479 void set(internal_type startvalue, internal_type targetvalue, T num_steps)
482 set(targetvalue, num_steps);
internal_type next()
Increments one step along the line.
void set(internal_type value)
Set the current value of the line.
void set(internal_type targetvalue, T num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(internal_type targetvalue, UFix< _NI, 0 > num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(internal_type startvalue, internal_type targetvalue, T num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
internal_type next()
Increments one step along the line.
void set(internal_type targetvalue, T num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(internal_type targetvalue, UFix< _NI, 0 > num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(internal_type value)
Set the current value of the line.
void set(internal_type startvalue, internal_type targetvalue, T num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
void set(unsigned char targetvalue, unsigned char num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(unsigned char value)
Set the current value of the line.
void set(unsigned char startvalue, unsigned char targetvalue, unsigned char num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
unsigned char next()
Increments one step along the line.
void set(unsigned int targetvalue, unsigned int num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
void set(unsigned int value)
Set the current value of the line.
void set(unsigned int startvalue, unsigned int targetvalue, unsigned int num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
unsigned int next()
Increments one step along the line.
void set(unsigned long startvalue, unsigned long targetvalue, unsigned long num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
unsigned long next()
Increments one step along the line.
void set(unsigned long value)
Set the current value of the line.
void set(unsigned long targetvalue, unsigned long num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...
For linear changes with a minimum of calculation at each step.
void set(T startvalue, T targetvalue, T num_steps)
Given a new starting value, target value and the number of steps to take on the way,...
T next()
Increments one step along the line.
void set(T value)
Set the current value of the line.
void set(T targetvalue, T num_steps)
Given a target value and the number of steps to take on the way, this calculates the step size needed...