main_control_knob.c

Functions

mainControlKnob

Implementation: Main Control Knob's main function SWIMPL_MCK-001 ../../../../../../_images/arrow-right-circle.svg
19void mainControlKnob(void)
20{
21    percentage_t currentValue = RteGetMainKnobValue();
22    if (RteIsKeyPressed(CONTROL_KEY_UP))
23    {
24        // Increase knob's percentage value by 5 with a maximum of 100.
25        if (currentValue < (100 - KNOB_UPDATE_INCREMENT))
26        {
27            currentValue += KNOB_UPDATE_INCREMENT;
28        }
29        else
30        {
31            currentValue = 100;
32        }
33    }
34    else if (RteIsKeyPressed(CONTROL_KEY_DOWN))
35    {
36        // Decrease knob's percentage value by 5 with a minimum of 0.
37        if (currentValue > KNOB_UPDATE_INCREMENT)
38        {
39            currentValue -= KNOB_UPDATE_INCREMENT;
40        }
41        else
42        {
43            currentValue = 0;
44        }
45    }
46    RteSetMainKnobValue(currentValue);
47}