|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
Driver base classes & definitions. More...
|
Namespaces | |
| embvm::clk | |
| Definitions, functions, and classes related to clock devices. | |
| embvm::comm | |
| Definitions, functions, and classes related to communication busses. | |
| embvm::gpio | |
| Definitions, functions, and classes related to GPIO devices. | |
| embvm | |
| Embedded framework core interfaces, classes, and definitions. | |
| embvm::i2c | |
| Definitions, functions, and classes related to I2C communication bus devices. | |
| embvm::led | |
| Definitions, functions, and classes related to LED devices. | |
| embvm::spi | |
| Definitions, functions, and classes related to SPI communication bus devices. | |
| embvm::tof | |
| Definitions, functions, and classes related to Time-of-Flight sensors. | |
| embvm::timer | |
| Definitions, functions, and classes related to Timer devices. | |
Classes | |
| class | embvm::basicDisplay |
| This class provides an interface for a basic 2-color display device. More... | |
| class | embvm::commBus< TOperation, TBaudrate, TDispatchFunctorSize, TStatus > |
| Base class interface for communication bus driver types (SPI, I2C, etc.). More... | |
| class | embvm::DriverBase |
| Virtual base class for framework drivers. More... | |
| class | embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType > |
| DriverRegistry base class. More... | |
Typedefs | |
| template<typename TLockType = embutil::nop_lock> | |
| using | embvm::DynamicDriverRegistry = DriverRegistry< 0, 0, TLockType > |
| Declare a DriverRegistry that uses dynamic memory allocation. More... | |
| template<const size_t TMaxSize = 32, const size_t TReturnSize = 4, typename TLockType = embutil::nop_lock> | |
| using | embvm::StaticDriverRegistry = DriverRegistry< TMaxSize, TReturnSize, TLockType > |
| Declare a DriverRegistry that uses static memory allocation. More... | |
| using | embvm::DriverType_t = uint32_t |
| Driver type used by framework interfaces. More... | |
Enumerations | |
| enum | embvm::DriverType { embvm::Undefined = 0, embvm::GPIO, embvm::HARDWARE_TIMER, embvm::I2C, embvm::LED, embvm::SPI, embvm::SYSTEM_CLOCK, embvm::TIME_OF_FLIGHT, embvm::SOFTWARE_TIMER, embvm::TIMER, embvm::BASIC_DISPLAY, embvm::DRIVER_EXTENSION_START } |
| Default framework driver type definitions. More... | |
Driver base classes & definitions.
| class embvm::basicDisplay |
This class provides an interface for a basic 2-color display device.
The basicDisplay class defines common interfaces for basic 2-color display drivers, which can be LED or OLED.
To create a basic display driver, derive from the basicDisplay object:
Derived classes must implement the following functions:
Derived classes must also implement pure virtual embvm::DriverBase functions:
Turning on a dispay should be handled in the start_() function, and turning off the display should be handled in the stop_() function.
The display is turned on by calling start(), and turned off by calling stop().
Most display functions update the screen buffer, which is the representation of the display buffer contents in local memory.
Changes to the screen buffer are not written to the display's hardware buffer until the display() function is called.
The screen buffer can be updated incrementally. If clearing the entire buffer is desired, call the clear() function.

Public Types | |
| enum | invert : uint8_t { invert::normal = 0, invert::invert } |
| Display color inversion options. More... | |
| enum | mode : uint8_t { mode::normal = 0, mode::XOR } |
| Set the drawing mode, if supported by the driver. More... | |
| enum | color : uint8_t { color::black = 0, color::white } |
| Basic displays have two pixel colors: black and white. More... | |
| using | coord_t = uint8_t |
| Coordinate representation type. More... | |
Public Member Functions | |
| virtual void | clear () noexcept=0 |
| Clear the screen contents. More... | |
| virtual void | display () noexcept=0 |
| Flush the screen buffer contents to the hardware display buffer. More... | |
| virtual void | invert (invert inv) noexcept=0 |
| Invert the display color. More... | |
| virtual void | contrast (uint8_t contrast) noexcept=0 |
| Set contrast. More... | |
| virtual void | cursor (coord_t x, coord_t y) noexcept=0 |
| Set the cusor within the screen buffer. More... | |
| void | pixel (coord_t x, coord_t y) noexcept |
| Draw a pixel in the screen buffer. More... | |
| virtual void | pixel (coord_t x, coord_t y, color c, mode m) noexcept=0 |
| Draw a pixel with a specific color and mode. More... | |
| void | line (coord_t x0, coord_t y0, coord_t x1, coord_t y1) noexcept |
| Draw a line. More... | |
| virtual void | line (coord_t x0, coord_t y0, coord_t x1, coord_t y1, color c, mode m) noexcept=0 |
| Draw a line with a specific color and mode. More... | |
| void | lineH (coord_t x, coord_t y, uint8_t width) noexcept |
| Draw a horizontal line. More... | |
| void | lineH (coord_t x, coord_t y, uint8_t width, color c, mode m) noexcept |
| Draw a horizontal line with a specific color and mode. More... | |
| void | lineV (coord_t x, coord_t y, uint8_t height) noexcept |
| Draw a vertical line. More... | |
| void | lineV (coord_t x, coord_t y, uint8_t height, color c, mode m) noexcept |
| Draw a vertical line with a specific color and mode. More... | |
| void | rect (coord_t x, coord_t y, uint8_t width, uint8_t height) noexcept |
| Draw a rectangle. More... | |
| virtual void | rect (coord_t x, coord_t y, uint8_t width, uint8_t height, color c, mode m) noexcept=0 |
| Draw a rectangle with a specific color and mode. More... | |
| void | rectFill (coord_t x, coord_t y, uint8_t width, uint8_t height) noexcept |
| Draw a filled rectangle. More... | |
| virtual void | rectFill (coord_t x, coord_t y, uint8_t width, uint8_t height, color c, mode m) noexcept=0 |
| Draw a filled rectangle with a specific color and mode. More... | |
| void | circle (coord_t x, coord_t y, uint8_t radius) noexcept |
| Draw a circle. More... | |
| virtual void | circle (coord_t x, coord_t y, uint8_t radius, color c, mode m) noexcept=0 |
| Draw a circle with a specific color and mode. More... | |
| void | circleFill (coord_t x, coord_t y, uint8_t radius) noexcept |
| Draw a filled circle. More... | |
| virtual void | circleFill (coord_t x, coord_t y, uint8_t radius, color c, mode m) noexcept=0 |
| Draw a filled circle with a specific color and mode. More... | |
| void | drawChar (coord_t x, coord_t y, uint8_t character) noexcept |
| Draw an ASCII character. More... | |
| virtual void | putchar (uint8_t c) noexcept=0 |
| Print a character on the display. More... | |
| virtual void | drawChar (coord_t x, coord_t y, uint8_t character, color c, mode m) noexcept=0 |
| Draw an ASCII character with a specific color and mode. More... | |
| void | printString (coord_t x, coord_t y, const char *str) noexcept |
| Print a string on the display. More... | |
| void | printString (coord_t x, coord_t y, const char *str, size_t length) noexcept |
| Print a string on the display. More... | |
| virtual void | drawBitmap (uint8_t *bitmap) noexcept=0 |
| Replace the screen buffer with a bitmap. More... | |
| virtual uint8_t | screenWidth () const noexcept=0 |
| Check the screen width. More... | |
| virtual uint8_t | screenHeight () const noexcept=0 |
| Check the screen height. More... | |
| void | drawColor (color c) noexcept |
| Set color. More... | |
| virtual void | drawMode (mode m) noexcept |
| Set draw mode. More... | |
| virtual void | scrollRight (coord_t start, coord_t stop) noexcept=0 |
| Enable right scrolling. More... | |
| virtual void | scrollLeft (coord_t start, coord_t stop) noexcept=0 |
| Enable left scrolling. More... | |
| virtual void | scrollVertRight (coord_t start, coord_t stop) noexcept=0 |
| virtual void | scrollVertLeft (coord_t start, coord_t stop) noexcept=0 |
| virtual void | scrollStop () noexcept=0 |
| Stop scrolling. More... | |
| virtual void | flipVertical (bool flip) noexcept=0 |
| Vertical flip. More... | |
| virtual void | flipHorizontal (bool flip) noexcept=0 |
| Horizontal flip. 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 |
| Basic Display Driver Type ID. More... | |
Protected Member Functions | |
| basicDisplay () noexcept | |
| Default constructor. More... | |
| basicDisplay (const char *name) noexcept | |
| Construct an basicDisplay with a name. More... | |
| basicDisplay (const std::string &name) noexcept | |
| Construct an basicDisplay with a std::string name. More... | |
| basicDisplay (const std::string_view &name) noexcept | |
| Construct an basicDisplay with a std::string_view name. 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... | |
| ~basicDisplay () noexcept override | |
| Default destructor. More... | |
Protected Attributes | |
| mode | mode_ = mode::normal |
| The current display mode setting. More... | |
| color | color_ = color::black |
| The current display color setting. More... | |
| 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... | |
| using embvm::basicDisplay::coord_t = uint8_t |
Coordinate representation type.
|
strong |
|
strong |
|
strong |
|
inlineprotectednoexcept |
Default constructor.
Initializes the basicDisplay instance with a generic name.
|
inlineprotectednoexcept |
Construct an basicDisplay with a name.
Initializes the basicDisplay instance with a name.
| name | The name of the display instance. basicDisplay() uses a std::string_view, so a std::string must remain valid |
|
inlineprotectednoexcept |
Construct an basicDisplay with a std::string name.
Initializes the basicDisplay instance with a name.
| name | The name of the display instance. basicDisplay() uses a std::string_view, so the std::string must remain valid |
|
inlineprotectednoexcept |
Construct an basicDisplay with a std::string_view name.
Initializes the basicDisplay instance with a name.
| name | The name of the display instance. |
|
overrideprotecteddefaultnoexcept |
Default destructor.
Draw a circle.
Draw a circle with center (x,y) and the specified radius using the configured color setting and draw mode in the screen buffer. Only the boundary of the circle will be drawn.
| x | X-coorindate for the center of the circle. |
| y | Y-coordinate for the center of the circle. |
| radius | The radius of the circle. |
|
pure virtualnoexcept |
Draw a circle with a specific color and mode.
Draw a circle with center (x,y) and the specified radius using a specific color setting and draw mode in the screen buffer. Only the boundary of the circle will be drawn.
| x | X-coorindate for the center of the circle. |
| y | Y-coordinate for the center of the circle. |
| radius | The radius of the circle. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
Draw a filled circle.
Draw a filled circle with center (x,y) and the specified radius using the configured color setting and draw mode in the screen buffer. The interior of the circle will be filled with the specified color setting.
| x | X-coorindate for the center of the circle. |
| y | Y-coordinate for the center of the circle. |
| radius | The radius of the circle. |
|
pure virtualnoexcept |
Draw a filled circle with a specific color and mode.
Draw a filled circle with center (x,y) and the specified radius using a specific color setting and draw mode in the screen buffer. The interior of the circle will be filled with the specified color setting.
| x | X-coorindate for the center of the circle. |
| y | Y-coordinate for the center of the circle. |
| radius | The radius of the circle. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Clear the screen contents.
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Set contrast.
| contrast | Target display contrast value, ranging from 0 to 255. |
Implemented in embdrv::ssd1306.
Set the cusor within the screen buffer.
Contents in the screen buffer are not modified by setting the cursor position.
| x | X-coordinate of the cursor. |
| y | Y-coordinate of the cursor. |
Implemented in embdrv::ssd1306.
Referenced by printString().
|
pure virtualnoexcept |
Flush the screen buffer contents to the hardware display buffer.
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Replace the screen buffer with a bitmap.
Supply a bitmap to write to the screen buffer. If the size of the bitmap is less than the size of the screen buffer, the remainder of the screen buffer will not be modified.
| bitmap | Bitmap array which will be used to overwrite the screen buffer. |
Implemented in embdrv::ssd1306.
Draw an ASCII character.
Draw an ASCII character using the configured color and draw mode with the upper left corner of the character located at (x,y).
| x | X-coordinate representing the top-left of the character. |
| y | Y-coordinate representing the top-left of the character. |
| character | the ASCII character to draw. Must be present in the font file. If the requested character is not present, nothing will be drawn on the screen buffer. |
|
pure virtualnoexcept |
Draw an ASCII character with a specific color and mode.
Draw an ASCII character using a specific color and draw mode with the upper left corner of the character located at (x,y).
| x | X-coordinate representing the top-left of the character. |
| y | Y-coordinate representing the top-left of the character. |
| character | the ASCII character to draw. Must be present in the font file. If the requested character is not present, nothing will be drawn on the screen buffer. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
|
inlinenoexcept |
Set color.
Set the current draw's color. Only WHITE and BLACK available.
| c | The desired draw color setting. |
References assert, black, color_, and white.
Referenced by embdrv::ssd1306::start_().
|
inlinevirtualnoexcept |
Set draw mode.
| m | Desired draw mode: NORM or XOR. |
References assert, mode_, normal, and XOR.
Referenced by embdrv::ssd1306::start_().
|
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_.
|
pure virtualnoexcept |
Horizontal flip.
Flip the graphics on the display horizontally.
| flip | True enables horizontal flip, false disables horizontal flip. |
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Vertical flip.
Flip the graphics on the display vertically.
| flip | True enables vertical flip, false disables vertical flip. |
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Invert the display color.
The WHITE color of the display will turn to BLACK and the BLACK will turn to WHITE.
| inv | invert::invert uses color inversion, invert::normal uses the display standard. |
Implemented in embdrv::ssd1306.
Draw a line.
Draw a line using the configured color setting and draw mode from (x0,y0) to (x1,y1) of the screen buffer.
| x0 | X-coordinate where the line originates. |
| y0 | Y-coordinate where the line originates. |
| x1 | X-coordinate where the line terminates. |
| y1 | Y-coordinate where the line terminates. |
|
pure virtualnoexcept |
Draw a line with a specific color and mode.
Draw line with a specific color setting and draw mode from (x0,y0) to (x1,y1) of the screen buffer.
| x0 | X-coordinate where the line originates. |
| y0 | Y-coordinate where the line originates. |
| x1 | X-coordinate where the line terminates. |
| y1 | Y-coordinate where the line terminates. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
Draw a horizontal line.
Draw a horizontal line using the configured color setting and draw mode from (x,y) to (x+width,y) in the screen buffer.
| x | X-coordinate where the line originates. |
| y | Y-coordinate where the line originates. |
| width | Length of the line, in pixels. The line will terminate at coordinate (x+width, y). |
|
inlinenoexcept |
Draw a horizontal line with a specific color and mode.
Draw a horizontal line with a specific color setting and draw mode from (x,y) to (x+width,y) in the screen buffer.
| x | X-coordinate where the line originates. |
| y | Y-coordinate where the line originates. |
| width | Length of the line, in pixels. The line will terminate at coordinate (x+width, y). |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
References line().
Draw a vertical line.
Draw a vertical line using the configured color setting and draw mode from (x,y) to (x,y+height) in the screen buffer.
| x | X-coordinate where the line originates. |
| y | Y-coordinate where the line originates. |
| height | Length of the line, in pixels. The line will terminate at coordinate (x, y+height). |
|
inlinenoexcept |
Draw a vertical line with a specific color and mode.
Draw a vertical line using a specific color setting and draw mode from (x,y) to (x,y+height) in the screen buffer.
| x | X-coordinate where the line originates. |
| y | Y-coordinate where the line originates. |
| height | Length of the line, in pixels. The line will terminate at coordinate (x, y+height). |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
References line().
|
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.
|
pure virtualnoexcept |
Draw a pixel with a specific color and mode.
Draw a pixel at position (x,y) with a specific color setting and draw mode.
| x | X-coordinate of the pixel. |
| y | Y-coordinate of the pixel. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
Print a string on the display.
| x | The x-coordinate to start the string. |
| y | The y-coordinate to start the string. |
| str | The string to print to the display. |
References strlen().
|
pure virtualnoexcept |
Print a character on the display.
| c | the character to print to the display |
Implemented in embdrv::ssd1306.
Referenced by printString().
|
inlinenoexcept |
Draw a rectangle.
Draw a rectangle using the configured color setting and draw mode from (x,y) to (x+width,y+height) in the screen buffer. Only the boundary of the rectangle will be drawn.
| x | X-coordinate where the rectangle originates. |
| y | Y-coordinate where the rectangle originates. |
| width | Width of the rectangle, in pixels. The rectangle width spans from x to x+width. |
| height | Height of the rectangle, in pixels. The rectangle height spans from y + y+height. |
|
pure virtualnoexcept |
Draw a rectangle with a specific color and mode.
Draw a rectangle with a specific color setting and draw mode from (x,y) to (x+width,y+height) in the screen buffer. Only the boundary of the rectangle will be drawn.
| x | X-coordinate where the rectangle originates. |
| y | Y-coordinate where the rectangle originates. |
| width | Width of the rectangle, in pixels. The rectangle width spans from x to x+width. |
| height | Height of the rectangle, in pixels. The rectangle height spans from y + y+height. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
|
inlinenoexcept |
Draw a filled rectangle.
Draw a filled rectangle using the configured color setting and draw mode from (x,y) to (x+width,y+height) in the screen buffer. The interior of the rectangle will be filled with the configured color setting.
| x | X-coordinate where the rectangle originates. |
| y | Y-coordinate where the rectangle originates. |
| width | Width of the rectangle, in pixels. The rectangle width spans from x to x+width. |
| height | Height of the rectangle, in pixels. The rectangle height spans from y + y+height. |
|
pure virtualnoexcept |
Draw a filled rectangle with a specific color and mode.
Draw a filled rectangle using a specific color setting and draw mode from (x,y) to (x+width,y+height) in the screen buffer. The interior of the rectangle will be filled with the specified color setting.
| x | X-coordinate where the rectangle originates. |
| y | Y-coordinate where the rectangle originates. |
| width | Width of the rectangle, in pixels. The rectangle width spans from x to x+width. |
| height | Height of the rectangle, in pixels. The rectangle height spans from y + y+height. |
| c | Pixel color. |
| m | Mode used to update the screen buffer. |
Implemented in embdrv::ssd1306.
|
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().
|
pure virtualnoexcept |
Check the screen height.
The drived class must implement this function.
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Check the screen width.
The drived class must implement this function.
Implemented in embdrv::ssd1306.
Enable left scrolling.
Set row start to row stop on the display to scroll left.
| start | The start row index. |
| stop | The stop row index. |
Implemented in embdrv::ssd1306.
Enable right scrolling.
Set row start to row stop on the display to scroll right.
| start | The start row index. |
| stop | The stop row index. |
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Implemented in embdrv::ssd1306.
|
pure virtualnoexcept |
Implemented in embdrv::ssd1306.
|
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 embdrv::ssd1306.
|
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 embdrv::ssd1306.
|
inlinestaticnoexcept |
|
protected |
The current display color setting.
Referenced by circle(), circleFill(), drawChar(), drawColor(), line(), lineH(), lineV(), pixel(), rect(), and rectFill().
|
protected |
The current display mode setting.
Referenced by circle(), circleFill(), drawChar(), drawMode(), line(), lineH(), lineV(), pixel(), rect(), and rectFill().
|
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().
| class embvm::commBus |
Base class interface for communication bus driver types (SPI, I2C, etc.).
This class defines common interfaces and types for communication bus drivers, such as SPI, I2C, I2S.
To implement your own communication bus driver, derive from this class using template parameters that represent the implementation of your bus type. For example:
Derived classes must implement the following pure virtual functions to complete comm bus behavior:
Derived classes may implement additional functionality, especially related to initialization and configuration of the bus. However, all exchange of data should be handled within the transfer() function.
Note: Derived classes are responsible for calling callback() once a transfer is completed.
Communication busses are based around the concept of a transfer(). A transfer operation is defined using the TOperation type.
To initiate a transfer, you need to define a TOperation object. Because the framework uses asynchronous transfers, a callback function (cb_t) is also needed so the completion and result of the transfer can be reported. The callback can be any functor.
The TOperation object and the callback function are passed into transfer(). When the operation completes, the derived driver will invoke callback() with a copy of the TOperation object and th resulting status.
Communication bus drivers are non-copyable and non-moveable.
| TOperation | Defines the operation type for the bus. This type represents the data that will be enqueued by the driver and used to carry out a transfer. The operation is also passed to a callback upon completion of a transfer. The operation type is often a structure, for example: ``` struct op_t { uint8_t* tx_buffer; uint8_t* rx_buffer; size_t length; comm::status status; }; ``` |
| TBaudrate | The baudrate storage type. The baudrate type defaults to uint32_t. Baudrate can be set to another type, such as embvm::i2c::baud, which is an enum class. |
| TDispatchFunctorSize | The storage space for statically-allocated functor objects. This template parameter is used in the TDispatchFunctor declaration. This can be made larger if required by the storage needs for your status/callback type. |
| TStatus | The comm bus status type. Defaults to comm::status, but can be overridden to support custom bus statuses. |
Public Types | |
| using | cb_t = stdext::inplace_function< void(TOperation, TStatus)> |
| Represents the type of the callback operation. More... | |
| using | DispatcherFunc = stdext::inplace_function< void(TDispatchFunctor &&)> |
| Alias for the dispatcher function's storage type. More... | |
Public Member Functions | |
| commBus () noexcept | |
| Default constructor. More... | |
| commBus (TBaudrate baud) noexcept | |
| Construct the bus with a baudrate. More... | |
| commBus (TBaudrate baud, DispatcherFunc dispatcher) noexcept | |
| Construct the bus with a baudrate and dispatcher. More... | |
| commBus (const commBus &)=delete | |
| Deleted copy constructor. More... | |
| const commBus & | operator= (const commBus &)=delete |
| Deleted copy assignment operator. More... | |
| commBus (commBus &&)=delete | |
| Deleted move constructor. More... | |
| commBus & | operator= (commBus &&)=delete |
| Deleted move assignment operator. More... | |
| virtual TStatus | transfer (TOperation &op, const cb_t &cb=nullptr) noexcept |
| Initiate a bus transfer. More... | |
| TStatus | busStatus () const noexcept |
| Get the current bus status. More... | |
| TBaudrate | baudrate () const noexcept |
| Get the current baudrate. More... | |
| TBaudrate | baudrate (TBaudrate baud) noexcept |
| Set a new baudrate. More... | |
Protected Member Functions | |
| virtual | ~commBus ()=default |
| Default destructor. More... | |
| void | callback (const TOperation &op, TStatus status, const cb_t &cb) noexcept |
| Handle callbacks. More... | |
| virtual TStatus | transfer_ (const TOperation &op, const cb_t &callback) noexcept=0 |
| The derived comm class's transfer implementation. More... | |
| virtual TBaudrate | baudrate_ (TBaudrate baud) noexcept=0 |
| The drived comm class's baudrate update implementation. More... | |
Protected Attributes | |
| TStatus | bus_status_ |
| Stores the current bus status. More... | |
| TBaudrate | baud_ |
| Stores the currently configured baudrate. More... | |
| const DispatcherFunc | dispatcher_ |
| Stores a function which callbacks will be dispatched to. More... | |
Private Types | |
| using | TDispatchFunctor = stdext::inplace_function< void(), TDispatchFunctorSize > |
| The functor declaration which will be used in declaring a DispatcherFunc. More... | |
| using embvm::commBus< TOperation, TBaudrate, TDispatchFunctorSize, TStatus >::cb_t = stdext::inplace_function<void(TOperation, TStatus)> |
Represents the type of the callback operation.
| using embvm::commBus< TOperation, TBaudrate, TDispatchFunctorSize, TStatus >::DispatcherFunc = stdext::inplace_function<void(TDispatchFunctor&&)> |
Alias for the dispatcher function's storage type.
|
private |
The functor declaration which will be used in declaring a DispatcherFunc.
This represents the statucally-allocated functor that stores a std::bind of the callback, operation, and status.
|
inlinenoexcept |
|
inlineexplicitnoexcept |
Construct the bus with a baudrate.
Initializes the comm bus status and sets the baudrate to a default value.
| baud | The default baudrate for the bus. |
|
inlineexplicitnoexcept |
Construct the bus with a baudrate and dispatcher.
Initializes the comm bus status and sets the baudrate to a default value. Also sets the dispatcher function, which will forward callbacks to a different thread of control.
| baud | The default baudrate for the bus. |
| dispatcher | The functor which callbacks will be dispatched to. This will often be paired with a dispatch queue. Example: |
|
delete |
Deleted copy constructor.
|
delete |
Deleted move constructor.
|
protectedvirtualdefault |
Default destructor.
|
inlinenoexcept |
Get the current baudrate.
|
inlinenoexcept |
Set a new baudrate.
Since each comm bus driver is different, the baudrate update request is forwarded to the derived class, which must implement the pure virtual function baudrate_().
TODO: tolerance check
| baud | The new baudrate for the bus. |
|
protectedpure virtualnoexcept |
The drived comm class's baudrate update implementation.
Derived classes override this baudrate function to handle baudrate change requests.
| baud | The new baudrate for the bus. |
|
inlinenoexcept |
Get the current bus status.
|
inlineprotectednoexcept |
Handle callbacks.
Invokes callback functions, either by pushing to a dispatch thread or by directly invoking the callback on the same thread of control.
| op | The operation which was completed. This will be passed to the callback. |
| status | The result of the operation. |
| cb | The callback function to invoke. |
|
delete |
Deleted copy assignment operator.
|
delete |
Deleted move assignment operator.
|
inlinevirtualnoexcept |
Initiate a bus transfer.
Initiates a transfer of information across a comm bus. The transfer function should handle read, write, and read-write operations. Other operations may also be supported by derived classes.
The transfer request is forwarded the derived class, which must implement the pure virtual function transfer_().
This call should not block. Transfer requests are asynchronous and are not guaranteed to return immediately with a result.
If the derived driver class returns a status code other than TStatus::enqueued or TStatus::busy, the callback will be immediately invoked. If the operation was enqueued, the final status will be reported when the callback is called.
| op | A bus transfer is defined by an operation (op). The derived class will use the data supplied in the op to configure the bus and transfer the data. |
| cb | Optional callback parameter. When set, the callback will be invoked upon completion of the transfer. |
|
protectedpure virtualnoexcept |
The derived comm class's transfer implementation.
Derived classes override this transfer function to handle specific transfer operations for each device.
Callback is passed in for drivers which enqueue operations or use AO model. The base class handles the callback, so there is no need to worry about invoking the callback from a client driver.
Just mark your callback (void)callback if you aren't using it.
To indicate that a transfer has been enqueued for later processing, return TStatus::enqueued
|
protected |
Stores the currently configured baudrate.
|
protected |
Stores the current bus status.
|
protected |
Stores a function which callbacks will be dispatched to.
The dispatcher function receives callbacks and ops and executes them on a separate thread of control from the caller of callback().
If no dispatcher is configured by the user, the callback will be executed in the same thread of control.
| class embvm::DriverBase |
Virtual base class for framework drivers.
All framework drivers should include this class in their inheritance tree. The DriverBase provides common interfaces which apply to all drivers. Use of the DriverBase class also handles automatic registration/unregistration with the platform's DriverRegistry. Registration/unregistration occurs during construction/destruction.
Derived classes must override the following functions:

Public Member Functions | |
| DriverBase (const DriverBase &)=delete | |
| Deleted copy constructor. More... | |
| const DriverBase & | operator= (const DriverBase &)=delete |
| Deleted copy assignment operator. More... | |
| DriverBase (DriverBase &&)=delete | |
| Deleted move constructor. More... | |
| DriverBase & | operator= (DriverBase &&)=delete |
| Deleted move assignment operator. 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... | |
Protected Member Functions | |
| DriverBase (const char *name, embvm::DriverType_t c=embvm::DriverType::Undefined) noexcept | |
| Construct a DriverBase with a C-string name. More... | |
| DriverBase (const std::string &name, embvm::DriverType_t c=embvm::DriverType::Undefined) noexcept | |
| Construct a DriverBase with a std::string name. More... | |
| DriverBase (const std::string_view &name, embvm::DriverType_t c=embvm::DriverType::Undefined) noexcept | |
| Construct a DriverBase with a std::string_view name. More... | |
| virtual | ~DriverBase () noexcept |
| Destructor. More... | |
| virtual void | start_ () noexcept=0 |
| Derived classes override the start_ method to control driver-specific startup behavior. More... | |
| virtual void | stop_ () noexcept=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... | |
|
protectednoexcept |
Construct a DriverBase with a C-string name.
The DriverBase constructor handles automatic registration with the DriverRegistry.
| name | The name of the device driver instance |
| c | The device type |
|
protectednoexcept |
Construct a DriverBase with a std::string name.
The DriverBase constructor handles automatic registration with the DriverRegistry
| name | The name of the device driver instance. Note: DriverBase() uses a std::string_view, so the std::string must remain valid |
| c | The device type |
|
protectednoexcept |
Construct a DriverBase with a std::string_view name.
The DriverBase constructor handles automatic registration with the DriverRegistry
| name | The name of the device driver instance. Note: DriverBase() uses a std::string_view, so the std::string_view must remain valid |
| c | The device type |
|
delete |
Deleted copy constructor.
|
delete |
Deleted move constructor.
|
protectedvirtualnoexcept |
Destructor.
When DriverBase is destructed, the driver is unregistered from the DriverRegistry.
|
inlinenoexcept |
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 type_.
|
inlinenoexcept |
Provides a string_view reference of the driver name.
std::string_view ref containing the driver name. References name_.
|
inlinenoexcept |
Provides a c-string version of the driver name.
References name_.
|
inlinevirtualnoexcept |
Increment operator is a no-op, but is used for iterator compatibility.
|
delete |
Deleted copy assignment operator.
|
delete |
Deleted move assignment operator.
|
inlinenoexcept |
|
inlinenoexcept |
Start the driver.
If the driver is not started, call the start_() function defined by the derived class. (Template Method Pattern)
References start_(), and started_.
Referenced by NRF52DongleHWPlatform::init_(), NRF52DKHWPlatform::init_(), BlinkySimulatorHWPlatform::init_(), FWDemoSimulatorHWPlatform::init_(), FrameworkDemoSimPlatform::initHWPlatform_(), 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().
|
protectedpure virtualnoexcept |
Derived classes override the start_ method to control driver-specific startup behavior.
(Template Method Pattern)
Implemented in embvm::basicDisplay, embvm::i2c::master, embvm::gpio::inputOutput< TPull >, embvm::spi::master, embvm::gpio::output, embvm::timer::Timer, embvm::tof::sensor, embvm::gpio::input< TPull >, embvm::gpio::input< embvm::gpio::pull::pullup >, embvm::gpio::input< embvm::gpio::pull::none >, embvm::led::gpio< TActiveHigh >, embdrv::aardvarkAdapter, embdrv::aardvarkGPIOOutput< TPinID >, embdrv::aardvarkGPIOOutput< 5 >, embdrv::vl53l1x, embvm::gpio::base< TDir >, embvm::gpio::base< gpio::direction::in >, embvm::gpio::base< gpio::direction::inout >, embvm::gpio::base< gpio::direction::out >, embvm::led::base, embdrv::ssd1306, embdrv::SimulatorTimer, test::spiTestDriver, embvm::clk::SystemClock, test::i2cTestDriver, 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 >, embdrv::aardvarkI2CMaster, embdrv::aardvarkSPIMaster, nRFi2cMaster< TTWIIndex, TSclPin, TSdaPin, TBlocking >, nRFi2cMaster< NordicTWIM0, nRFPinID< 0, 27 >, nRFPinID< 0, 26 > >, embdrv::SimulatorSystemClock, embvm::i2c::activeMaster< TQueueSize, TLock, TCond >, embvm::i2c::activeMaster< 128 >, embvm::spi::activeMaster< TQueueSize, TLock, TCond >, test::TestDriverBase, test::UnitTestGPIOInputWithPullup, nRF51i2cMaster_Blocking< TTWIIndex, TSclPin, TSdaPin >, and test::UnitTestGPIOInput.
Referenced by start().
|
inlinenoexcept |
Check if the driver has been started.
true if the driver is running (started), false if not running (stopped). References started_.
Referenced by embdrv::aardvarkSPIMaster::configure_(), embdrv::aardvarkGPIOInput< 4 >::get(), embdrv::aardvarkGPIOOutput< 5 >::set(), embdrv::vl53l1x::start_(), embdrv::aardvarkAdapter::start_(), and embdrv::aardvarkAdapter::stop_().
|
inlinenoexcept |
Stop the driver.
If the driver has been started, call the stop_() function defined by the derived class. (Template Method Pattern)
References started_, and stop_().
Referenced by 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().
|
protectedpure virtualnoexcept |
Derived classes override the start_ method to control driver-specific startup behavior.
(Template Method Pattern)
Implemented in embvm::basicDisplay, embvm::i2c::master, embvm::gpio::inputOutput< TPull >, embvm::spi::master, embvm::gpio::output, embvm::timer::Timer, embvm::tof::sensor, embvm::gpio::input< TPull >, embvm::gpio::input< embvm::gpio::pull::pullup >, embvm::gpio::input< embvm::gpio::pull::none >, embvm::led::gpio< TActiveHigh >, embdrv::aardvarkGPIOOutput< TPinID >, embdrv::aardvarkGPIOOutput< 5 >, embdrv::aardvarkAdapter, embdrv::vl53l1x, embvm::gpio::base< TDir >, embvm::gpio::base< gpio::direction::in >, embvm::gpio::base< gpio::direction::inout >, embvm::gpio::base< gpio::direction::out >, embvm::led::base, embdrv::ssd1306, embdrv::SimulatorTimer, test::spiTestDriver, embvm::clk::SystemClock, test::i2cTestDriver, embdrv::aardvarkGPIOInput< TPinID, TPull >, embdrv::aardvarkGPIOInput< 3 >, embdrv::aardvarkGPIOInput< 4 >, nRFi2cMaster< TTWIIndex, TSclPin, TSdaPin, TBlocking >, nRFi2cMaster< NordicTWIM0, nRFPinID< 0, 27 >, nRFPinID< 0, 26 > >, 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 >, embdrv::aardvarkI2CMaster, embdrv::aardvarkSPIMaster, embdrv::SimulatorSystemClock, embvm::i2c::activeMaster< TQueueSize, TLock, TCond >, embvm::i2c::activeMaster< 128 >, nRF51i2cMaster_Blocking< TTWIIndex, TSclPin, TSdaPin >, embvm::spi::activeMaster< TQueueSize, TLock, TCond >, test::TestDriverBase, test::UnitTestGPIOInputWithPullup, and test::UnitTestGPIOInput.
Referenced by stop().
|
protected |
Name of the driver instance.
Referenced by name(), and name_cstr().
|
protected |
|
protected |
Type ID of the driver instance.
Referenced by DriverType().
| class embvm::DriverRegistry |
DriverRegistry base class.
DriverRegistry provides a common DriverRegistry interface that supports both static and dynamic memory allocation styles. Whether dynamic or static memory is used is determined at compile-time by the template arguments.
Two convenience definitions are supplied below: DynamicDriverRegistry and StaticDriverRegistry<> These types should be used to declare DriverRegistry instances for your platform rather than directly using DriverRegistry. They are more expressive and will be easier for readers to understand.
Only one DriverRegistry should be defined for each platform & program.
| TMaxSize | specifies the maximum number of drivers that can be stored. A value of '0' indicates that dynamic memory should be used. |
| TReturnSize | specifies the maximum number of drivers that can be returned by find_all() A value of '0' indicates no limit (dynamic memory) |
| TLockType | The type of lock to use with DriverRegistry. Defaults to embutil::nop_lock, which does not perform any actual locking. If you are using this DriverRegistry in a multi-threaded program and are worried about locking, you can change this to another type such as std::mutex or an interrupt_lock. |
Public Member Functions | |
| DriverRegistry ()=default | |
| Default constructor. More... | |
| ~DriverRegistry () noexcept=default | |
| Default destructor. More... | |
| DriverRegistry (const DriverRegistry &)=delete | |
| Deleted copy constructor. More... | |
| const DriverRegistry & | operator= (const DriverRegistry &)=delete |
| Deleted copy assignment operator. More... | |
| DriverRegistry (DriverRegistry &&)=delete | |
| Deleted move constructor. More... | |
| DriverRegistry & | operator= (DriverRegistry &&)=delete |
| Deleted move assignment operator. More... | |
| size_t | count () const noexcept |
| Get the registered driver count. More... | |
| size_t | capacity () const noexcept |
| Get the capacity of the registry. More... | |
| void | add (const TKey name, embvm::DriverBase *driver) noexcept |
| Register a driver. More... | |
| void | remove (const TKey name, embvm::DriverBase *driver) noexcept |
| Unregister a driver. More... | |
| auto | find (const TKey name) noexcept |
| Find a driver by name. More... | |
| auto | find (DriverType_t dtype) noexcept |
| Find a driver by type. More... | |
| template<class TDriverClass > | |
| auto | find () noexcept |
| Find a driver by type and return casted interface pointer. More... | |
| template<class TDriverClass > | |
| auto | find (const TKey name) noexcept |
| Find a driver by name and return casted interface pointer. More... | |
| template<typename TReturn = std::list<embvm::DriverBase*>> | |
| auto | find_all (DriverType_t dtype) noexcept -> std::enable_if_t<!TReturnSize, TReturn > |
| Find all drivers with a given type (dynamic memory). More... | |
| template<typename TReturn = etl::list<embvm::DriverBase*, TReturnSize>> | |
| auto | find_all (DriverType_t dtype) noexcept -> std::enable_if_t<(TReturnSize > 0), TReturn > |
| Find all drivers with a given type (static memory). More... | |
| template<class TDriverClass , typename TReturn = std::list<embvm::DriverBase*>> | |
| auto | find_all () noexcept -> std::enable_if_t<!TReturnSize, TReturn > |
| Find all drivers with a given type and return casted interface pointers (dynamic memory). More... | |
| template<class TDriverClass , typename TReturn = etl::list<embvm::DriverBase*, TReturnSize>> | |
| auto | find_all () noexcept -> std::enable_if_t<(TReturnSize > 0), TReturn > |
| Find all drivers with a given type and return casted interface pointers (static memory). More... | |
Private Types | |
| using | TKey = const char * |
| using | TListType = typename std::conditional<(TMaxSize==0), embutil::DynamicInstanceList< embvm::DriverBase, TKey >, embutil::StaticInstanceList< embvm::DriverBase, TMaxSize, TKey > >::type |
Private Attributes | |
| TListType | list_ |
| TLockType | lock_ |
|
private |
|
private |
|
default |
Default constructor.
|
defaultnoexcept |
Default destructor.
|
delete |
Deleted copy constructor.
|
delete |
Deleted move constructor.
|
inlinenoexcept |
Register a driver.
Adds a driver to the DriverRegistry.
| name | The name of the driver instance being added. Name is used as a key during lookups. |
| driver | Pointer to the embvm::DriverBase object. A pointer is used because there are any number of potential derived classes which will be tracked. To prevent slicing, a pointer to the base class is stored. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, and embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::lock_.
|
inlinenoexcept |
Get the capacity of the registry.
The capacity represents the total number of drivers which may be registered.
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_.
|
inlinenoexcept |
Get the registered driver count.
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_.
|
inlinenoexcept |
Find a driver by name.
Performs a driver lookup by name. If the driver is found, the embvm::DriverBase for that object will be returned to the user. If no driver is found, an empty object will be returned.
If multiple objects are registered with the same name, the first one found will be returned.
| name | The name of the driver instance to search for. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_.
|
inlinenoexcept |
Find a driver by type.
Performs a driver lookup by type. If the driver is found, the embvm::DriverBase for that object will be returned to the user. If no driver is found, an empty object will be returned.
If multiple objects are registered with the same type, the first one found will be returned.
| dtype | The type of the driver instance to search for. |
References dtype, and embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_.
|
inlinenoexcept |
Find a driver by type and return casted interface pointer.
Performs a driver lookup by type. If the driver is found, the embvm::DriverBase will be casted to the requested driver interface. If no driver is found, an empty object will be returned.
To perform the lookup, the requested driver classes's type() static member function will be used.
If multiple objects are registered with the same type, the first one found will be returned.
| TDriverClass | The class of driver being requested (embvm::i2c::master, SystemClock). |
References type.
Referenced by embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::find().
|
inlinenoexcept |
Find a driver by name and return casted interface pointer.
Performs a driver lookup by name. If the driver is found, the embvm::DriverBase will be casted to the requested driver interface. If no driver is found, an empty object will be returned.
If multiple objects are registered with the same name, the first one found will be returned.
| TDriverClass | The class of driver being requested (embvm::i2c::master, SystemClock). |
| name | The name of the driver instance to search for. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::find().
|
inlinenoexcept |
Find all drivers with a given type (dynamic memory).
Performs a driver lookup by type and creates a list of all drivers found with the matching type. If no driver is found, an empty list will be returned.
| TReturn | The return type provided to the caller. Most users do not need to change the type. |
| dtype | The type of the driver instance to search for. |
References dtype, embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, and t.
|
inlinenoexcept |
Find all drivers with a given type (static memory).
Performs a driver lookup by type and creates a list of all drivers found with the matching type. If no driver is found, an empty list will be returned.
| TReturn | The return type provided to the caller. Most users do not need to change the type. |
| dtype | The type of the driver instance to search for. |
References dtype, embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, and t.
|
inlinenoexcept |
Find all drivers with a given type and return casted interface pointers (dynamic memory).
Performs a driver lookup by type and creates a list of all drivers found with the matching type. If no driver is found, an empty list will be returned.
To perform the lookup, the requested driver classes's type() static member function will be used.
| TDriverClass | The class of driver being requested (embvm::i2c::master, SystemClock). |
| TReturn | The return type provided to the caller. Most users do not need to change the type. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, t, and type.
|
inlinenoexcept |
Find all drivers with a given type and return casted interface pointers (static memory).
Performs a driver lookup by type and creates a list of all drivers found with the matching type. If no driver is found, an empty list will be returned.
To perform the lookup, the requested driver classes's type() static member function will be used.
| TDriverClass | The class of driver being requested (embvm::i2c::master, SystemClock). |
| TReturn | The return type provided to the caller. Most users do not need to change the type. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, t, and type.
|
delete |
Deleted copy assignment operator.
|
delete |
Deleted move assignment operator.
|
inlinenoexcept |
Unregister a driver.
Removes a driver from the DriverRegistry.
| name | The name of the driver instance being removed. |
| driver | Pointer to the embvm::DriverBase object being removed. |
References embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::list_, and embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::lock_.
|
private |
Referenced by embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::add(), embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::capacity(), embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::count(), embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::find(), embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::find_all(), and embvm::DriverRegistry< TMaxSize, TReturnSize, TLockType >::remove().
|
private |
| using embvm::DriverType_t = typedef uint32_t |
Driver type used by framework interfaces.
The driver type ID is stored as a uint32_t rather than a DriverType to work with custom user-defined types. Enforcing a DriverType return value would prevent clients from defining and using their own custom types enums and would create template headaches.
| using embvm::DynamicDriverRegistry = typedef DriverRegistry<0, 0, TLockType> |
Declare a DriverRegistry that uses dynamic memory allocation.
A DynamicDriverRegistry utilizes dynamic memory allocation and can grow to the limit that memory allows. This type is useful for host-based simulation platforms, as well as embedded platforms which allow dynamic memory allocation.
| TLockType | The type of lock to use with DynamicDriverRegistry. See DriverRegistry for more information. |
| using embvm::StaticDriverRegistry = typedef DriverRegistry<TMaxSize, TReturnSize, TLockType> |
Declare a DriverRegistry that uses static memory allocation.
The size and memory allocation of the StaticDriverRegistry is known at compile-time. No dynamic memory allocations are used.
In addition, the number of drivers returned by the find_all() function is fixed.
| TMaxSize | specifies the maximum number of drivers that can be stored |
| TReturnSize | specifies the maximum number of drivers that can be returned by find_all() |
| TLockType | The type of lock to use with StaticDriverRegistry. See DriverRegistry for more information. |
| enum embvm::DriverType |
Default framework driver type definitions.
Default framework driver type definitions. These definitions are defined because the framework provides driver interfaces for these types. Additional types can be defined by clients as needed.
To add your own driver types, create an enum in your project code and use DRIVER_EXTENSION_START as the first value
1.8.15