It is required to process the text. I will not refuse help :)
The library implements a simple interface for changing the value of the variables. Allows you to work with any type of number indicated in the designer template. The library allows you to control:
The class is template and uses 2 parameters: typename T, uint8_t _id = 0 . The first parameter indicates the type of variable with which we work. For example, uint16_t . The second non -compulsory parameter transparently conveys uint8_t value to the called flask, which allows you to identify the number when using several copies of the class per one flask. For example, Pin's number transfer:
CrossInteger < uint8_t , 3 > ColorR ;
CrossInteger < uint8_t , 5 > ColorG ;
CrossInteger < uint8_t , 6 > ColorB ;
//...
ColorR . SetCallback ( OnFading );
ColorG . SetCallback ( OnFading );
ColorB . SetCallback ( OnFading );
//...
void OnFading ( uint8_t id , uint8_t value , bool complete )
{
analogWrite ( id , value );
}For convenience, the class has two designers.
CrossInteger (); Class designer without parameters. When used, it is required to convey the settings through Set methods.
CrossInteger ( callback_t callback , T val , T min , T max , T step , uint32_t interval );Class designer indicating all the settings. Parameters: Kolbeck, the current value of the number, the minimum value of the number, the maximum value of the number, the step of changing the number, the interval of the renewal of the number.
void onFading ( uint8_t id , T value , bool complete )In case of any change in the number, the flask is caused in which you must determine the actions you need. Parameters: transmitted ID, current value, the end of the end change.
T onConversion ( uint8_t id , T min , T max , T from , T to , T current ) If a more complex function of changing the number is required, then it can be determined by SetConversion() method, and processed in this flask. Parameters: transmitted ID, minimal value, maximum value, initial value, final value, current value. Return: The function should return a new value for the number.
void SetCallback ( callback_t callback )The method indicates a Kolek, which will be called with any change in the number. It is important to note that if the number changes itself, then the function of the function will not occur.
void SetConversion ( conversion_t conversion )The method indicates a flask that can be reduced to a linear change in the number.
void SetVal ( T val )The method sets the value of the number. Parameters: The value of the number.
void SetMin ( T min )The method sets the minimum value of the number. Parameters: The value of the number.
void SetMax ( T max )The method sets the maximum value of the number. Parameters: The value of the number.
void SetStep ( T step )The method establishes the size of the change in the number. Parameters: The value of the number.
void SetInterval ( uint32_t interval )The method establishes the interval for a change in the number. Parameters: The value of the number.
void GoMin ()The method instantly changes the number to minimum.
void GoMax ()The method instantly changes the number to maximum.
void GoCenter ()The method instantly changes the number to the mean arithmetic, with rounding in the smaller direction.
void FadeTo ( T val_to )The method smoothly changes the number to the specified. Parameters: The value of the number.
void FadeMin ()The method smoothly changes the number to the minimum.
void FadeMax ()The method smoothly changes the number to maximum.
void FadeCenter ()The method smoothly changes the number to the mean arithmetic, with rounding in the smaller way.
T GetVal ()The method returns the instant current value of the number.
void GetCallback ()The method forcibly causes a flask.
void Processing ( uint32_t currentTime = millis ()) Number processing method. In the event that your loop has a definition of the current time, it is more advisable to pass this time as a parameter. Parameters: current time mark.