| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <functional> | ||
| 4 | |||
| 5 | /** | ||
| 6 | * @brief Interface for GPIO input abstraction | ||
| 7 | * | ||
| 8 | * Provides hardware abstraction for GPIO inputs with interrupt support. | ||
| 9 | * Enables testability through mock implementations. | ||
| 10 | */ | ||
| 11 | class IGpioInput { | ||
| 12 | public: | ||
| 13 | 12 | virtual ~IGpioInput() = default; | |
| 14 | |||
| 15 | /** | ||
| 16 | * @brief Get current logic level of GPIO input | ||
| 17 | * @return true if HIGH, false if LOW | ||
| 18 | */ | ||
| 19 | [[nodiscard]] virtual bool getLevel() const = 0; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @brief Set interrupt handler callback | ||
| 23 | * @param handler Function called when interrupt triggers (parameter: current level) | ||
| 24 | */ | ||
| 25 | virtual void setInterruptHandler(std::function<void(bool level)> handler) = 0; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * @brief Enable interrupt for this GPIO | ||
| 29 | */ | ||
| 30 | virtual void enableInterrupt() = 0; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * @brief Disable interrupt for this GPIO | ||
| 34 | */ | ||
| 35 | virtual void disableInterrupt() = 0; | ||
| 36 | }; | ||
| 37 |