|
1 | 1 | #pragma once |
2 | | -#include <memory> |
3 | | -#include <array> |
4 | | -#include "send.h" |
5 | 2 | #include "i_led_controller.h" |
| 3 | +#include "send.h" |
| 4 | +#include <array> |
| 5 | +#include <memory> |
6 | 6 |
|
7 | 7 | /** |
8 | 8 | * @class BankManager |
9 | 9 | * @brief Manages multiple banks of button configurations with LED feedback |
10 | | - * |
| 10 | + * |
11 | 11 | * This class handles the three configurable button banks, allowing different |
12 | 12 | * actions to be assigned to each button in each bank. It also manages the |
13 | 13 | * visual feedback through LED indicators to show the currently active bank. |
14 | 14 | */ |
15 | | -class BankManager { |
| 15 | +class BankManager |
| 16 | +{ |
16 | 17 | public: |
17 | | - static constexpr uint8_t NUM_BANKS = 3; /**< Number of available button banks */ |
| 18 | + static constexpr uint8_t NUM_BANKS = 3; /**< Number of available button banks */ |
18 | 19 | static constexpr uint8_t NUM_BUTTONS = 4; /**< Number of buttons per bank */ |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * @brief Constructs a BankManager with LED controllers |
22 | | - * |
| 23 | + * |
23 | 24 | * @param led1 LED controller for bank 1 indicator |
24 | | - * @param led2 LED controller for bank 2 indicator |
| 25 | + * @param led2 LED controller for bank 2 indicator |
25 | 26 | * @param led3 LED controller for bank 3 indicator |
26 | 27 | */ |
27 | 28 | BankManager(ILEDController& led1, ILEDController& led2, ILEDController& led3); |
28 | 29 |
|
29 | 30 | /** |
30 | 31 | * @brief Adds an action to a specific bank and button |
31 | | - * |
| 32 | + * |
32 | 33 | * @param bank Bank index (0-2) |
33 | 34 | * @param button Button index (0-3) |
34 | 35 | * @param action Unique pointer to the action to be executed |
35 | 36 | */ |
36 | 37 | void addAction(uint8_t bank, uint8_t button, std::unique_ptr<Send> action); |
37 | | - |
| 38 | + |
38 | 39 | /** |
39 | 40 | * @brief Gets the action associated with a bank and button |
40 | | - * |
| 41 | + * |
41 | 42 | * @param bank Bank index (0-2) |
42 | 43 | * @param button Button index (0-3) |
43 | 44 | * @return Pointer to the Send action, or nullptr if none assigned |
44 | 45 | */ |
45 | 46 | Send* getAction(uint8_t bank, uint8_t button); |
46 | | - |
| 47 | + |
47 | 48 | /** |
48 | 49 | * @brief Switches to the next bank and updates LED indicators |
49 | | - * |
| 50 | + * |
50 | 51 | * @return Index of the new current bank (0-2) |
51 | 52 | */ |
52 | 53 | uint8_t switchBank(); |
53 | | - |
| 54 | + |
54 | 55 | /** |
55 | 56 | * @brief Gets the currently active bank index |
56 | | - * |
| 57 | + * |
57 | 58 | * @return Current bank index (0-2) |
58 | 59 | */ |
59 | 60 | uint8_t getCurrentBank() const; |
60 | 61 |
|
61 | 62 | private: |
62 | 63 | /** |
63 | 64 | * @brief Updates LED indicators to reflect current bank |
64 | | - * |
| 65 | + * |
65 | 66 | * Turns on the LED corresponding to the current bank and |
66 | 67 | * turns off the LEDs for other banks. |
67 | 68 | */ |
68 | 69 | void updateLEDs(); |
69 | | - |
70 | | - std::array<std::array<std::unique_ptr<Send>, NUM_BUTTONS>, NUM_BANKS> banks; /**< 2D array storing actions for all banks/buttons */ |
| 70 | + |
| 71 | + std::array<std::array<std::unique_ptr<Send>, NUM_BUTTONS>, NUM_BANKS> |
| 72 | + banks; /**< 2D array storing actions for all banks/buttons */ |
71 | 73 | uint8_t currentBank = 0; /**< Currently active bank index */ |
72 | | - ILEDController& led1; /**< Reference to bank 1 LED controller */ |
73 | | - ILEDController& led2; /**< Reference to bank 2 LED controller */ |
74 | | - ILEDController& led3; /**< Reference to bank 3 LED controller */ |
| 74 | + ILEDController& led1; /**< Reference to bank 1 LED controller */ |
| 75 | + ILEDController& led2; /**< Reference to bank 2 LED controller */ |
| 76 | + ILEDController& led3; /**< Reference to bank 3 LED controller */ |
75 | 77 | }; |
0 commit comments