|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
This class defines the common GPIO interfaces. More...
#include <gpio.hpp>

Public Member Functions | |
| gpio::direction | direction () const noexcept |
| Check the direction of the GPIO pin. More... | |
| void | start () noexcept |
| Start the driver. More... | |
| void | stop () noexcept |
| Stop the driver. More... | |
| void | restart () noexcept |
| Restart the driver. More... | |
| type_safe::boolean | started () const noexcept |
| Check if the driver has been started. More... | |
| constexpr embvm::DriverType_t | DriverType () const noexcept |
| Returns the registered type ID of the driver. More... | |
| constexpr const std::string_view & | name () const noexcept |
| Provides a string_view reference of the driver name. More... | |
| constexpr const char * | name_cstr () const noexcept |
| Provides a c-string version of the driver name. More... | |
| virtual DriverBase & | operator++ () noexcept |
| Increment operator is a no-op, but is used for iterator compatibility. More... | |
Static Public Member Functions | |
| static constexpr embvm::DriverType | type () noexcept |
| GPIO Driver Type ID. More... | |
Protected Member Functions | |
| base () noexcept | |
| Default constructor. More... | |
| base (const char *name) noexcept | |
| Construct an gpio::base with a C-string name. More... | |
| base (const std::string &name) noexcept | |
| Construct an gpio::base with a std::string name. More... | |
| base (const std::string_view &name) noexcept | |
| Construct an gpio::base with a std::string_view name. More... | |
| ~base () noexcept override=default | |
| Default destructor. More... | |
| void | start_ () noexcept override=0 |
| Derived classes override the start_ method to control driver-specific startup behavior. More... | |
| void | stop_ () noexcept override=0 |
| Derived classes override the start_ method to control driver-specific startup behavior. More... | |
Protected Attributes | |
| type_safe::boolean | started_ = false |
| Tracks the driver state. More... | |
| const std::string_view | name_ |
| Name of the driver instance. More... | |
| const embvm::DriverType_t | type_ |
| Type ID of the driver instance. More... | |
This class defines the common GPIO interfaces.
The gpio::base class defines interfaces which are common to all GPIO objects. This class is not intended to be used directly for implementing GPIO drivers. Instead, additional specializations are provided:
Derived classes must implement pure virtual embvm::DriverBase functions:
| TDir | The direction of the GPIO pin (e.g. input, output). |
| TPull | The pull setting for the GPIO pin. |
|
inlineprotectednoexcept |
Default constructor.
Initializes the gpio::base instance with a generic name.
|
inlineexplicitprotectednoexcept |
Construct an gpio::base with a C-string name.
Initializes the gpio::base instance with a name.
| name | The name of the GPIO instance. |
|
inlineexplicitprotectednoexcept |
Construct an gpio::base with a std::string name.
Initializes the gpio::base instance with a name.
| name | The name of the GPIO instance. gpio::base() uses a std::string_view, so the std::string must remain valid |
|
inlineexplicitprotectednoexcept |
Construct an gpio::base with a std::string_view name.
Initializes the gpio::base instance with a name.
| name | The name of the GPIO instance. |
|
overrideprotecteddefaultnoexcept |
Default destructor.
|
inlinenoexcept |
Check the direction of the GPIO pin.
|
inlinenoexceptinherited |
Returns the registered type ID of the driver.
When using DriverBase interfaces, clients can retrieve the registered driver type in order to up-cast to the correct interface.
The type is returned as a embvm::DriverType_t rather than a embvm::DriverType enum to work with custom user-defined types. Enforcing a embvm::DriverType return value would prevent clients from defining and using their own custom types.
References embvm::DriverBase::type_.
|
inlinenoexceptinherited |
Provides a string_view reference of the driver name.
std::string_view ref containing the driver name. References embvm::DriverBase::name_.
|
inlinenoexceptinherited |
Provides a c-string version of the driver name.
References embvm::DriverBase::name_.
|
inlinevirtualnoexceptinherited |
Increment operator is a no-op, but is used for iterator compatibility.
|
inlinenoexceptinherited |
Restart the driver.
Calls stop() and then start() on the driver. If the driver is not started, then it will be started after the start() function is invoked.
References embvm::DriverBase::start(), and embvm::DriverBase::stop().
|
inlinenoexceptinherited |
Start the driver.
If the driver is not started, call the start_() function defined by the derived class. (Template Method Pattern)
References embvm::DriverBase::start_(), and embvm::DriverBase::started_.
Referenced by NRF52DongleHWPlatform::init_(), NRF52DKHWPlatform::init_(), BlinkySimulatorHWPlatform::init_(), FWDemoSimulatorHWPlatform::init_(), FrameworkDemoSimPlatform::initHWPlatform_(), embvm::DriverBase::restart(), embvm::timer::Timer::restart(), embvm::spi::activeMaster< TQueueSize, TLock, TCond >::start_(), embvm::i2c::activeMaster< 128 >::start_(), embdrv::aardvarkSPIMaster::start_(), embdrv::aardvarkI2CMaster::start_(), embdrv::aardvarkGPIOInput< 4 >::start_(), embdrv::vl53l1x::start_(), embdrv::aardvarkGPIOOutput< 5 >::start_(), BlinkySimulatorHWPlatform::startBlink(), and FWDemoSimulatorHWPlatform::startLEDTimer().
|
overrideprotectedpure virtualnoexcept |
Derived classes override the start_ method to control driver-specific startup behavior.
(Template Method Pattern)
Implements embvm::DriverBase.
Implemented in embvm::gpio::inputOutput< TPull >, embvm::gpio::output, embvm::gpio::input< TPull >, embvm::gpio::input< embvm::gpio::pull::pullup >, embvm::gpio::input< embvm::gpio::pull::none >, embdrv::aardvarkGPIOOutput< TPinID >, embdrv::aardvarkGPIOOutput< 5 >, embdrv::aardvarkGPIOInput< TPinID, TPull >, embdrv::aardvarkGPIOInput< 3 >, embdrv::aardvarkGPIOInput< 4 >, nRFGPIOOutput< TPort, TPin >, nRFGPIOOutput< 1, 9 >, nRFGPIOOutput< 0, 16 >, nRFGPIOOutput< 0, 8 >, nRFGPIOOutput< 0, 14 >, nRFGPIOOutput< 0, 6 >, nRFGPIOOutput< 0, 15 >, nRFGPIOOutput< 0, 12 >, nRFGPIOOutput< 0, 13 >, test::UnitTestGPIOInputWithPullup, and test::UnitTestGPIOInput.
|
inlinenoexceptinherited |
Check if the driver has been started.
true if the driver is running (started), false if not running (stopped). References embvm::DriverBase::started_.
Referenced by embdrv::aardvarkSPIMaster::configure_(), embdrv::aardvarkGPIOInput< 4 >::get(), embdrv::aardvarkGPIOOutput< 5 >::set(), embdrv::vl53l1x::start_(), embdrv::aardvarkAdapter::start_(), and embdrv::aardvarkAdapter::stop_().
|
inlinenoexceptinherited |
Stop the driver.
If the driver has been started, call the stop_() function defined by the derived class. (Template Method Pattern)
References embvm::DriverBase::started_, and embvm::DriverBase::stop_().
Referenced by embvm::DriverBase::restart(), embvm::timer::Timer::restart(), embvm::spi::activeMaster< TQueueSize, TLock, TCond >::stop_(), embvm::i2c::activeMaster< 128 >::stop_(), embdrv::aardvarkSPIMaster::stop_(), embdrv::aardvarkI2CMaster::stop_(), embdrv::aardvarkGPIOInput< 4 >::stop_(), embdrv::aardvarkGPIOOutput< 5 >::stop_(), FWDemoSimulatorHWPlatform::~FWDemoSimulatorHWPlatform(), and embdrv::SimulatorTimer::~SimulatorTimer().
|
overrideprotectedpure virtualnoexcept |
Derived classes override the start_ method to control driver-specific startup behavior.
(Template Method Pattern)
Implements embvm::DriverBase.
Implemented in embvm::gpio::inputOutput< TPull >, embvm::gpio::output, embvm::gpio::input< TPull >, embvm::gpio::input< embvm::gpio::pull::pullup >, embvm::gpio::input< embvm::gpio::pull::none >, embdrv::aardvarkGPIOOutput< TPinID >, embdrv::aardvarkGPIOOutput< 5 >, embdrv::aardvarkGPIOInput< TPinID, TPull >, embdrv::aardvarkGPIOInput< 3 >, embdrv::aardvarkGPIOInput< 4 >, nRFGPIOOutput< TPort, TPin >, nRFGPIOOutput< 1, 9 >, nRFGPIOOutput< 0, 16 >, nRFGPIOOutput< 0, 8 >, nRFGPIOOutput< 0, 14 >, nRFGPIOOutput< 0, 6 >, nRFGPIOOutput< 0, 15 >, nRFGPIOOutput< 0, 12 >, nRFGPIOOutput< 0, 13 >, test::UnitTestGPIOInputWithPullup, and test::UnitTestGPIOInput.
|
inlinestaticnoexcept |
GPIO Driver Type ID.
|
protectedinherited |
Name of the driver instance.
Referenced by embvm::DriverBase::name(), and embvm::DriverBase::name_cstr().
|
protectedinherited |
Tracks the driver state.
True if the driver has been started, false if it has been stopped or not yet started.
Referenced by embvm::DriverBase::start(), embvm::DriverBase::started(), and embvm::DriverBase::stop().
|
protectedinherited |
Type ID of the driver instance.
Referenced by embvm::DriverBase::DriverType().
1.8.15