Skip to content

Commit 1aa566b

Browse files
committed
ran make format
1 parent 521df88 commit 1aa566b

47 files changed

Lines changed: 711 additions & 578 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
* Each hardware package provides its own config.cpp with the concrete
1111
* pin assignments for that board.
1212
*/
13-
struct HardwareConfig {
13+
struct HardwareConfig
14+
{
1415
// LED pins
1516
uint8_t ledBluetooth; /**< Bluetooth status LED pin */
1617
uint8_t ledPower; /**< Power indicator LED pin */
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,77 @@
11
#pragma once
2-
#include <memory>
3-
#include <array>
4-
#include "send.h"
52
#include "i_led_controller.h"
3+
#include "send.h"
4+
#include <array>
5+
#include <memory>
66

77
/**
88
* @class BankManager
99
* @brief Manages multiple banks of button configurations with LED feedback
10-
*
10+
*
1111
* This class handles the three configurable button banks, allowing different
1212
* actions to be assigned to each button in each bank. It also manages the
1313
* visual feedback through LED indicators to show the currently active bank.
1414
*/
15-
class BankManager {
15+
class BankManager
16+
{
1617
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 */
1819
static constexpr uint8_t NUM_BUTTONS = 4; /**< Number of buttons per bank */
1920

2021
/**
2122
* @brief Constructs a BankManager with LED controllers
22-
*
23+
*
2324
* @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
2526
* @param led3 LED controller for bank 3 indicator
2627
*/
2728
BankManager(ILEDController& led1, ILEDController& led2, ILEDController& led3);
2829

2930
/**
3031
* @brief Adds an action to a specific bank and button
31-
*
32+
*
3233
* @param bank Bank index (0-2)
3334
* @param button Button index (0-3)
3435
* @param action Unique pointer to the action to be executed
3536
*/
3637
void addAction(uint8_t bank, uint8_t button, std::unique_ptr<Send> action);
37-
38+
3839
/**
3940
* @brief Gets the action associated with a bank and button
40-
*
41+
*
4142
* @param bank Bank index (0-2)
4243
* @param button Button index (0-3)
4344
* @return Pointer to the Send action, or nullptr if none assigned
4445
*/
4546
Send* getAction(uint8_t bank, uint8_t button);
46-
47+
4748
/**
4849
* @brief Switches to the next bank and updates LED indicators
49-
*
50+
*
5051
* @return Index of the new current bank (0-2)
5152
*/
5253
uint8_t switchBank();
53-
54+
5455
/**
5556
* @brief Gets the currently active bank index
56-
*
57+
*
5758
* @return Current bank index (0-2)
5859
*/
5960
uint8_t getCurrentBank() const;
6061

6162
private:
6263
/**
6364
* @brief Updates LED indicators to reflect current bank
64-
*
65+
*
6566
* Turns on the LED corresponding to the current bank and
6667
* turns off the LEDs for other banks.
6768
*/
6869
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 */
7173
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 */
7577
};
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
#pragma once
2-
#include <functional>
32
#include <array>
43
#include <cstdint>
4+
#include <functional>
55

66
/**
77
* @class EventDispatcher
88
* @brief Manages event callbacks for button presses
9-
*
9+
*
1010
* This class provides a simple event dispatching system that maps
1111
* button indices to callback functions. It supports 5 buttons:
1212
* - 0-3: Action buttons A-D
1313
* - 4: Bank selection button
1414
*/
15-
class EventDispatcher {
15+
class EventDispatcher
16+
{
1617
public:
1718
/**
1819
* @brief Callback function type for button events
19-
*
20+
*
2021
* Function signature for event handlers (no parameters, void return)
2122
*/
2223
using EventCallback = std::function<void()>;
23-
24+
2425
/**
2526
* @brief Registers a callback function for a button
26-
*
27+
*
2728
* @param button Button index (0-4)
2829
* @param callback Function to call when button is pressed
2930
*/
3031
void registerHandler(uint8_t button, EventCallback callback);
31-
32+
3233
/**
3334
* @brief Executes the callback for the specified button
34-
*
35+
*
3536
* @param button Button index (0-4) to dispatch
3637
*/
3738
void dispatch(uint8_t button);
38-
39+
3940
/**
4041
* @brief Clears all registered event handlers
41-
*
42+
*
4243
* Resets all callbacks to empty functions.
4344
*/
4445
void clearHandlers();
45-
46+
4647
private:
4748
std::array<EventCallback, 5> handlers{}; /**< Array of callbacks for buttons 0-4 */
4849
};

lib/PedalLogic/include/i_ble_keyboard.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,65 @@
33

44
/**
55
* @brief Type alias for media key reports
6-
*
6+
*
77
* Represents a 2-byte media key report for BLE keyboard
88
*/
99
using MediaKeyReport = uint8_t[2];
1010

1111
// Key constants: define only when BleKeyboard.h has not been included,
1212
// so that firmware TUs that include both headers don't get redefinitions.
1313
#ifndef ESP32_BLE_KEYBOARD_H
14-
const uint8_t KEY_UP_ARROW = 0xDA; /**< USB HID key code for up arrow */
15-
const uint8_t KEY_DOWN_ARROW = 0xD9; /**< USB HID key code for down arrow */
16-
const uint8_t KEY_LEFT_ARROW = 0xD8; /**< USB HID key code for left arrow */
17-
const uint8_t KEY_RIGHT_ARROW = 0xD7; /**< USB HID key code for right arrow */
14+
const uint8_t KEY_UP_ARROW = 0xDA; /**< USB HID key code for up arrow */
15+
const uint8_t KEY_DOWN_ARROW = 0xD9; /**< USB HID key code for down arrow */
16+
const uint8_t KEY_LEFT_ARROW = 0xD8; /**< USB HID key code for left arrow */
17+
const uint8_t KEY_RIGHT_ARROW = 0xD7; /**< USB HID key code for right arrow */
1818

1919
static constexpr uint8_t KEY_MEDIA_STOP[2] = {4, 0}; /**< Media key report for stop */
2020
#endif
2121

2222
/**
2323
* @class IBleKeyboard
2424
* @brief Interface for Bluetooth LE keyboard functionality
25-
*
25+
*
2626
* Abstract interface that defines the contract for BLE keyboard operations.
2727
* Allows for dependency injection and mocking in tests.
2828
*/
29-
class IBleKeyboard {
29+
class IBleKeyboard
30+
{
3031
public:
3132
virtual ~IBleKeyboard() = default;
32-
33+
3334
/**
3435
* @brief Initializes the BLE keyboard
35-
*
36+
*
3637
* Starts BLE advertising and sets up the keyboard service.
3738
*/
3839
virtual void begin() = 0;
39-
40+
4041
/**
4142
* @brief Checks if BLE keyboard is connected to a host
42-
*
43+
*
4344
* @return true if connected, false otherwise
4445
*/
4546
virtual bool isConnected() = 0;
46-
47+
4748
/**
4849
* @brief Sends a single key press
49-
*
50+
*
5051
* @param key USB HID key code to send
5152
*/
5253
virtual void write(uint8_t key) = 0;
53-
54+
5455
/**
5556
* @brief Sends a media key report
56-
*
57+
*
5758
* @param key Media key report (2-byte array)
5859
*/
5960
virtual void write(const MediaKeyReport key) = 0;
60-
61+
6162
/**
6263
* @brief Sends a text string
63-
*
64+
*
6465
* @param text Null-terminated string to send as keyboard input
6566
*/
6667
virtual void print(const char* text) = 0;

lib/PedalLogic/include/i_button.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* of the concrete hardware ISR mechanism. Implementations live in the
99
* platform-specific hardware packages.
1010
*/
11-
class IButton {
11+
class IButton
12+
{
1213
public:
1314
virtual ~IButton() = default;
1415

lib/PedalLogic/include/i_button_controller.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@
33
/**
44
* @class IButtonController
55
* @brief Interface for button input functionality
6-
*
6+
*
77
* Abstract interface that defines the contract for button operations.
88
* Allows for hardware abstraction and dependency injection.
99
*/
10-
class IButtonController {
10+
class IButtonController
11+
{
1112
public:
1213
virtual ~IButtonController() = default;
13-
14+
1415
/**
1516
* @brief Initializes the button hardware
16-
*
17+
*
1718
* Configures GPIO pins and any necessary hardware resources.
1819
*/
1920
virtual void setup() = 0;
20-
21+
2122
/**
2223
* @brief Reads the current button state
23-
*
24+
*
2425
* @return true if button is pressed, false otherwise
2526
*/
2627
virtual bool read() = 0;

lib/PedalLogic/include/i_led_controller.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,32 @@
44
/**
55
* @class ILEDController
66
* @brief Interface for LED control functionality
7-
*
7+
*
88
* Abstract interface that defines the contract for LED operations.
99
* Allows for hardware abstraction and dependency injection.
1010
*/
11-
class ILEDController {
11+
class ILEDController
12+
{
1213
public:
1314
virtual ~ILEDController() = default;
14-
15+
1516
/**
1617
* @brief Initializes the LED with optional initial state
17-
*
18+
*
1819
* @param initialState Initial state (0 = off, non-zero = on)
1920
*/
2021
virtual void setup(uint32_t initialState = 0) = 0;
21-
22+
2223
/**
2324
* @brief Sets the LED state
24-
*
25+
*
2526
* @param state true to turn on, false to turn off
2627
*/
2728
virtual void setState(bool state) = 0;
28-
29+
2930
/**
3031
* @brief Toggles the LED state
31-
*
32+
*
3233
* If LED is on, turns it off. If off, turns it on.
3334
*/
3435
virtual void toggle() = 0;

lib/PedalLogic/include/pedal_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
/**
66
* @brief Configures the button banks with default actions
7-
*
7+
*
88
* Sets up the three button banks with predefined actions for the guitar pedal.
99
* This function defines what each button does in each bank.
10-
*
10+
*
1111
* @param bankManager Reference to the BankManager instance
1212
* @param keyboard Pointer to the BLE keyboard interface
1313
*/

0 commit comments

Comments
 (0)