Zephyr C++ Toolkit
Loading...
Searching...
No Matches
GpioMock.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IGpio.hpp"
4
5namespace zct {
6
10class GpioMock : public IGpio {
11public:
12
20
24 ~GpioMock();
25
33 void setPhysical(bool value) override;
34
42 bool getPhysical() const override;
43
54 void configureInterrupt(InterruptMode interruptMode, std::function<void()> callback) override;
55
68 void setLogicMode(LogicMode logicMode) override;
69
81 void mockSetInput(bool logicalValue);
82
95
96protected:
103 void configurePinBasedOnSettings() override;
104
115 bool oldLogicalValue,
116 bool oldPhysicalValue,
117 bool newLogicalValue,
118 bool newPhysicalValue);
119
124};
125
126} // namespace zct
Definition GpioMock.hpp:10
void mockSetInputPhysical(bool physicalValue)
Use this to pretend to be an external signal changing the state of an input GPIO. This sets the physi...
Definition GpioMock.cpp:72
void configurePinBasedOnSettings() override
Configure the pin based on the current settings.
Definition GpioMock.cpp:55
void setLogicMode(LogicMode logicMode) override
Set the logic mode of the GPIO.
Definition GpioMock.cpp:47
void callInterruptHandlerIfNeeded(bool oldLogicalValue, bool oldPhysicalValue, bool newLogicalValue, bool newPhysicalValue)
Helper function to determine and call the interrupt handler if needed. Calculates if it needs to be c...
Definition GpioMock.cpp:92
void mockSetInput(bool logicalValue)
Use this to pretend to be an external signal changing the state of an input GPIO. This sets the logic...
Definition GpioMock.cpp:59
bool getPhysical() const override
Get the physical value of the GPIO.
Definition GpioMock.cpp:30
~GpioMock()
Destroy the GPIO. Does nothing.
Definition GpioMock.cpp:15
void configureInterrupt(InterruptMode interruptMode, std::function< void()> callback) override
Configure an interrupt on the GPIO.
Definition GpioMock.cpp:41
void setPhysical(bool value) override
Set the physical value of the GPIO.
Definition GpioMock.cpp:17
bool m_logicalValue
Definition GpioMock.hpp:123
Definition IGpio.hpp:7
LogicMode
Definition IGpio.hpp:20
virtual bool get() const
Definition IGpio.cpp:31
InterruptMode
Definition IGpio.hpp:34
Direction
Definition IGpio.hpp:10
Definition Mutex.hpp:6