|
| GpioBasic (SdkWrapper &sdk, uint pin) |
| Initialize the given GPIO pin and setup the pins.
|
|
virtual | ~GpioBasic () |
| deinit the GPIO by SdkWrapper::gpio_deinit();
|
|
virtual void | SetDir (bool out) |
| Set a single GPIO direction.
|
|
virtual void | SetInputEnabled (bool enabled) |
| Enable GPIO input.
|
|
virtual void | Put (bool value) |
| Drive a single GPIO high/low.
|
|
virtual bool | Get () |
| Get state of a single GPIO.
|
|
virtual void | Toggle () |
| Toggle the output level of this GPIO.
|
|
virtual void | PullUp () |
| Set this GPIO to be pulled up. .
|
|
virtual void | PullDown () |
| Set this GPIO to be pulled down.
|
|
virtual void | DisablePulls () |
| Unset pulls on this GPIO.
|
|
Basic GPIO driver class.
This class provides the handy way to control GPIO. To use this class, pass a GPIO pin# through the constructor. So, this class initialize and deinitialize that pin in the constructor and destructor, respectively.
Usage of mock
In the case of the testing of the user program which uses this class, a programmer can use the pre-defined mock class ::rpp_driver::MockGpioBasic. inside gpiobasic.hpp.
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using ::testing::_;
class UserCodeTest : public ::testing::Test {
protected:
::rpp_driver::MockSdkWrapper mock_sdk_;
::rpp_driver::MockGpioBasic* mock_gpio_;
virtual void SetUp() {
EXPECT_CALL(mock_sdk_, gpio_init(_)).Times(1);
mock_gpio_ = new ::rpp_driver::MockGpioBasic(mock_sdk_);
}
virtual void TearDown() {
EXPECT_CALL(mock_sdk_, gpio_deinit(_)).Times(1);
delete (mock_gpio_);
}
};
TEST_F(UserCodeTest, foo) {
}
Wrapper for RasPi Pico SDK API.