GCC Code Coverage Report


Directory: components/
File: main_control_knob/src/main_control_knob.c
Date: 2025-10-25 23:11:20
Coverage Exec Excl Total
Lines: 100.0% 12 0 12
Functions: 100.0% 1 0 1
Branches: 100.0% 8 0 8

Line Branch Exec Source
1 /**
2 * @file
3 * @brief Implementation of the main control knob module
4 */
5
6 #include "main_control_knob.h"
7 #include "rte.h"
8
9 #define CONTROL_KEY_UP KEY_UP
10 #define CONTROL_KEY_DOWN KEY_DOWN
11 #define KNOB_UPDATE_INCREMENT 2u
12
13 /**
14 * ```{impl} Main Control Knob's main function
15 * :id: SWIMPL_MCK-001
16 * :implements: SWDD_MCK-100, SWDD_MCK-101, SWDD_MCK-200, SWDD_MCK-201, SWDD_MCK-202, SWDD_MCK-203
17 * ```
18 */
19 17 void mainControlKnob(void)
20 {
21 17 percentage_t currentValue = RteGetMainKnobValue();
22
2/2
✓ Branch 4 → 5 taken 13 times.
✓ Branch 4 → 8 taken 4 times.
17 if (RteIsKeyPressed(CONTROL_KEY_UP))
23 {
24 // Increase knob's percentage value by 5 with a maximum of 100.
25
2/2
✓ Branch 5 → 6 taken 11 times.
✓ Branch 5 → 7 taken 2 times.
13 if (currentValue < (100 - KNOB_UPDATE_INCREMENT))
26 {
27 11 currentValue += KNOB_UPDATE_INCREMENT;
28 }
29 else
30 {
31 2 currentValue = 100;
32 }
33 }
34
2/2
✓ Branch 9 → 10 taken 3 times.
✓ Branch 9 → 13 taken 1 time.
4 else if (RteIsKeyPressed(CONTROL_KEY_DOWN))
35 {
36 // Decrease knob's percentage value by 5 with a minimum of 0.
37
2/2
✓ Branch 10 → 11 taken 1 time.
✓ Branch 10 → 12 taken 2 times.
3 if (currentValue > KNOB_UPDATE_INCREMENT)
38 {
39 1 currentValue -= KNOB_UPDATE_INCREMENT;
40 }
41 else
42 {
43 2 currentValue = 0;
44 }
45 }
46 17 RteSetMainKnobValue(currentValue);
47 17 }
48