|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
Framework Demo Simulator Hardware Platform. More...
#include <fwdemo_simulator_hw_platform.hpp>

Public Types | |
| using | TimerHandle_t = TimerManager_t::TimerHandle |
Public Member Functions | |
| FWDemoSimulatorHWPlatform () noexcept | |
| Default constructor. More... | |
| ~FWDemoSimulatorHWPlatform () noexcept | |
| Default destructor. More... | |
| void | init_ () noexcept |
| void | initProcessor_ () noexcept |
| void | soft_reset_ () noexcept |
| void | hard_reset_ () noexcept |
| void | startLEDTimer () noexcept |
| Start the LED timer. More... | |
| TimerHandle_t | allocateTimer () noexcept |
| Allocate a software timer. More... | |
| embvm::tof::sensor & | tof0_inst () noexcept |
| Get the tof0 Instance. More... | |
| embvm::led::base & | led0_inst () noexcept |
| Get the led0 Instance. More... | |
| embvm::basicDisplay & | screen0_inst () noexcept |
| Get the screen0 Instance. More... | |
| embvm::tof::mode | readAndSetToFMode () noexcept |
| Sets the ToF mode based on GPIO input. More... | |
| constexpr const std::string_view & | name () const noexcept |
| Returns the Virtual HW Platform's name. More... | |
| constexpr const char * | name_cstr () const noexcept |
| Returns the platform name as a cstring for C API compatibility. More... | |
| void | initProcessor () noexcept |
| Initialize the processor. More... | |
| void | init () noexcept |
| Initialize the hardware platform. More... | |
| void | soft_reset () noexcept |
| Perform a soft reset of the system (chip reset) More... | |
| void | hard_reset () noexcept |
| Perform a hard reset of the system (power cycle) More... | |
| void | shutdown () noexcept |
| Shutdown the system. More... | |
Static Public Member Functions | |
| static void | earlyInitHook_ () noexcept |
| static void | earlyInitHook () noexcept |
| Perform any special initialization steps. More... | |
Private Types | |
| using | PlatformBase = embvm::VirtualHwPlatformBase< FWDemoSimulatorHWPlatform > |
| using | TimerManager_t = embvm::TimerManager< 0, std::mutex > |
Framework Demo Simulator Hardware Platform.
This implements an OSX-based hardware platform which provides the functionality needed for our framework demo.
I2C support is provided using an aardvark adapter. Higher-level device drivers utilize the Aardvark I2C interface, enabling them to work on a host machine.
To the application layer, this hardware is just as good as embedded hardware!
Our configuration sports:
The hardware platform also provides a timer manager (using timer1), which provides any number of software timers to be derived from it.
|
private |
| using FWDemoSimulatorHWPlatform::TimerHandle_t = TimerManager_t::TimerHandle |
|
private |
|
inlinenoexcept |
Default constructor.
|
noexcept |
Default destructor.
Turn off the screen & led before exiting the program
References screen0, and embvm::DriverBase::stop().
|
inlinenoexcept |
Allocate a software timer.
Allocates a software timer from the underlying timer manager. A handle is returned, which the user can use to configure the timer according to their wishes.
References embvm::TimerManager< TMaxTimers, TLock, TTimeUnit, TTimeoutCallback, TTimerDevice >::allocate(), and tm_.
Referenced by FrameworkDemoSimPlatform::startBlink().
|
inlinestaticnoexceptinherited |
Perform any special initialization steps.
The earlyInitHook_() function must be implemented by the derived class as a static function.
These functions run before the C Run-time setup functions are called, and normal functionality (e.g. OS concepts) are not available.
Early initialization steps represent any super early code that needs to execute. For example, DRAM might need to be initialized before the boot process can relocate memory to its proper location in memory.
These functions are declared static to prevent you from easily using drivers within their confines
|
inlinestaticnoexcept |
|
inlinenoexceptinherited |
Perform a hard reset of the system (power cycle)
The hard_reset_() function must be implemented by the derived class.
A hard reset is intended to perform a full power cycle of the system.
Platforms which do not support a hard reset should default to calling soft_reset().
|
noexcept |
References soft_reset_().
|
inlinenoexceptinherited |
Initialize the hardware platform.
The init_() function must be implemented by the derived class.
Perform any hardware platform initialization steps, such as preparing peripherals for use, setting up callbacks, etc.
|
noexcept |
|
inlinenoexceptinherited |
Initialize the processor.
The initProcessor_() function must be implemented by the derived class.
Perform any steps necessary for initializing the processor & processor peripheral devices for use.
Note that this is only intended to be processor initialization. Platform initialization nis handled by the init() function.
This function will likely invoke the VirtualProcessor::init() function, but the order and actual initialization process is left to the derived class.
|
noexcept |
References embvm::VirtualProcessorBase< TProcessor >::init(), and processor.
|
inlinenoexcept |
Get the led0 Instance.
You don't always need find_driver() in the DriverRegistry. You can directly return a base-class reference from the hardware platform. This saves time from doing a lookup.
It is important to return the base class, since that is how we keep our applications decoupled from the underlying hardware. Returning the actual ToF sensor class will enable coupling to the underlying harware.
References led0.
Referenced by FrameworkDemoSimPlatform::startBlink().
|
inlinenoexceptinherited |
Returns the Virtual HW Platform's name.
|
inlinenoexceptinherited |
Returns the platform name as a cstring for C API compatibility.
|
noexcept |
Sets the ToF mode based on GPIO input.
Reads the mode GPIO and updates the ToF mode based on the setting.
References embdrv::aardvarkGPIOInput< TPinID, TPull >::get(), gpio3, gpio4, logdebug, embdrv::vl53l1x::mode(), and tof0.
Referenced by FrameworkDemoSimPlatform::updateToFMode().
|
inlinenoexcept |
Get the screen0 Instance.
You don't always need find_driver() in the DriverRegistry. You can directly return a base-class reference from the hardware platform. This saves time from doing a lookup.
It is important to return the base class, since that is how we keep our applications decoupled from the underlying hardware. Returning the actual ToF sensor class will enable coupling to the underlying harware.
References screen0.
Referenced by FrameworkDemoSimPlatform::initHWPlatform_().
|
inlinenoexceptinherited |
Shutdown the system.
The shutdown_() function must be implemented by the derived class.
If your platform supports shutdown capability, take the proper steps to initiate a shutdown.
If the platform does not support shutdown capability, implement your shutdown_() function as an assert to notify users trying to call this API. You could also leave the shutdown_() function undefined. Anyone who calls the shutdown() function on a platform with an undefined shutdown_() function will encounter a compiler error.
The shutdown function is not expected to return.
|
inlinenoexceptinherited |
Perform a soft reset of the system (chip reset)
The soft_reset_() function must be implemnted by the derived class.
A soft reset is intended to reset the program to the beginning without performing a full power cycle.
A good strategy is to just call virtual processor's reset() function, if one is provided.
|
inlinenoexcept |
Referenced by hard_reset_().
|
inlinenoexcept |
Start the LED timer.
References embvm::DriverBase::start(), and timer0.
Referenced by FrameworkDemoSimPlatform::startBlink().
|
inlinenoexcept |
Get the tof0 Instance.
You don't always need find_driver() in the DriverRegistry. You can directly return a base-class reference from the hardware platform. This saves time from doing a lookup.
It is important to return the base class, since that is how we keep our applications decoupled from the underlying hardware. Returning the actual ToF sensor class will enable coupling to the underlying harware.
References tof0.
Referenced by FrameworkDemoSimPlatform::init_(), and FrameworkDemoSimPlatform::initHWPlatform_().
|
private |
|
private |
Referenced by init_(), and readAndSetToFMode().
|
private |
Referenced by init_(), and readAndSetToFMode().
|
private |
|
private |
Referenced by init_().
|
private |
Referenced by init_().
|
private |
Referenced by init_(), and led0_inst().
|
private |
|
private |
Referenced by initProcessor_().
|
private |
Referenced by init_(), screen0_inst(), and ~FWDemoSimulatorHWPlatform().
|
private |
|
private |
Referenced by init_(), and startLEDTimer().
|
private |
Referenced by allocateTimer().
|
private |
Referenced by readAndSetToFMode(), and tof0_inst().
1.8.15