ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
c7222_pico_w_board.hpp
Go to the documentation of this file.
1#ifndef C7222_PICO_W_BOARD_HPP
2#define C7222_PICO_W_BOARD_HPP
3
26#include <array>
27#include <memory>
28
29#include "button.hpp"
30#include "led.hpp"
31
32namespace c7222 {
33
43 public:
45 static constexpr size_t kLedCount = 6;
47 static constexpr size_t kButtonCount = 4;
48
52 enum class LedId : uint8_t {
53 LED1_RED = 21,
54 LED1_GREEN = 20,
55 LED2_RED = 19,
56 LED2_GREEN = 18,
57 LED3_RED = 17,
58 LED3_GREEN = 16
59 };
60
64 enum class ButtonId : uint8_t { BUTTON_B1 = 2, BUTTON_B2 = 3, BUTTON_B3 = 4, BUTTON_B4 = 5 };
65
70
74 bool IsInitialized() const {
75 return initialized_;
76 }
77
86
87 private:
94 PicoWBoard();
98 static std::unique_ptr<PicoWBoard> instance_;
99
103 bool initialized_;
109 std::array<Led, kLedCount> leds_;
115 std::array<Button, kButtonCount> buttons_;
116};
117} // namespace c7222
118
119#endif // C7222_PICO_W_BOARD_HPP
Input-only GPIO abstraction for push-buttons.
Input-only GPIO wrapper intended for push-buttons.
Definition button.hpp:43
Output-only GPIO wrapper intended for LEDs.
Definition led.hpp:39
Disable both copy and move operations.
Definition non_copyable.hpp:75
Board-level convenience wrapper for the C7222 Pico W board.
Definition c7222_pico_w_board.hpp:42
static PicoWBoard * GetInstance()
Access the singleton instance (if used).
static constexpr size_t kLedCount
Number of board LEDs exposed by this API.
Definition c7222_pico_w_board.hpp:45
Led & GetLed(LedId id)
Retrieve a board LED by logical ID.
LedId
Logical LED identifiers mapped to GPIO pins.
Definition c7222_pico_w_board.hpp:52
ButtonId
Logical button identifiers mapped to GPIO pins.
Definition c7222_pico_w_board.hpp:64
bool IsInitialized() const
Return true if construction-time initialization has completed.
Definition c7222_pico_w_board.hpp:74
Button & GetButton(ButtonId id)
Retrieve a board button by logical ID.
static constexpr size_t kButtonCount
Number of board buttons exposed by this API.
Definition c7222_pico_w_board.hpp:47
Output-only GPIO abstraction for LEDs.
C7222 course abstractions namespace.
Definition ble.hpp:20