Embedded Artistry Framework
Embedded Systems C++ Framework
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
NRF52DKHWPlatform Class Reference

#include <nrf52dk_fwdemo_hw_platform.hpp>

Inheritance diagram for NRF52DKHWPlatform:
Inheritance graph

Public Member Functions

 NRF52DKHWPlatform () noexcept
 Default constructor. More...
 
 ~NRF52DKHWPlatform () noexcept
 Default destructor. More...
 
void init_ () noexcept
 
void initProcessor_ () noexcept
 
void soft_reset_ () noexcept
 
void hard_reset_ () noexcept
 
void leds_off () noexcept
 
void startBlink () noexcept
 
 NRF52DKHWPlatform () noexcept
 Default constructor. More...
 
 ~NRF52DKHWPlatform () noexcept
 Default destructor. More...
 
void init_ () noexcept
 
void initProcessor_ () noexcept
 
void soft_reset_ () noexcept
 
void hard_reset_ () noexcept
 
void leds_off () noexcept
 
std::array< embvm::led::base *, 4 > getLEDInstances () noexcept
 
embvm::tof::sensortof0_inst () noexcept
 
embvm::basicDisplayscreen0_inst () noexcept
 
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
 
static void earlyInitHook () noexcept
 Perform any special initialization steps. More...
 

Private Types

using PlatformBase = embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >
 
using PlatformBase = embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >
 
using i2c0_t = nRFi2cMaster< NordicTWIM0, nRFPinID< 0, 27 >, nRFPinID< 0, 26 > >
 

Private Attributes

nRF52840 processor
 
nRFGPIOOutput< 0, 13 > led1_pin {}
 
nRFGPIOOutput< 0, 14 > led2_pin {}
 
nRFGPIOOutput< 0, 15 > led3_pin {}
 
nRFGPIOOutput< 0, 16 > led4_pin {}
 
embvm::led::gpioActiveLow led1 {led1_pin, "led1"}
 
embvm::led::gpioActiveLow led2 {led2_pin, "led2"}
 
embvm::led::gpioActiveLow led3 {led3_pin, "led3"}
 
embvm::led::gpioActiveLow led4 {led4_pin, "led4"}
 
nRF52840 processor_
 
embutil::InterruptQueue< ThumbInterruptLock, 156 > irq_bottom_half_
 
i2c0_t i2c0_private_
 
embvm::i2c::activeMaster< 128 > i2c0 {i2c0_private_}
 
embdrv::vl53l1x tof0 {i2c0, SPARKFUN_VL53L1X_ADDR}
 
embdrv::ssd1306 screen0 {i2c0, SPARKFUN_SSD1306_ADDR}
 

Member Typedef Documentation

◆ i2c0_t

◆ PlatformBase [1/2]

◆ PlatformBase [2/2]

Constructor & Destructor Documentation

◆ NRF52DKHWPlatform() [1/2]

NRF52DKHWPlatform::NRF52DKHWPlatform ( )
inlinenoexcept

Default constructor.

◆ ~NRF52DKHWPlatform() [1/2]

NRF52DKHWPlatform::~NRF52DKHWPlatform ( )
noexcept

Default destructor.

◆ NRF52DKHWPlatform() [2/2]

NRF52DKHWPlatform::NRF52DKHWPlatform ( )
inlinenoexcept

Default constructor.

◆ ~NRF52DKHWPlatform() [2/2]

NRF52DKHWPlatform::~NRF52DKHWPlatform ( )
noexcept

Default destructor.

Member Function Documentation

◆ earlyInitHook()

static void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::earlyInitHook ( )
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

◆ earlyInitHook_() [1/2]

void NRF52DKHWPlatform::earlyInitHook_ ( )
staticnoexcept

◆ earlyInitHook_() [2/2]

static void NRF52DKHWPlatform::earlyInitHook_ ( )
staticnoexcept

◆ getLEDInstances()

std::array<embvm::led::base*, 4> NRF52DKHWPlatform::getLEDInstances ( )
inlinenoexcept

◆ hard_reset()

void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::hard_reset ( )
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().

◆ hard_reset_() [1/2]

void NRF52DKHWPlatform::hard_reset_ ( )
noexcept

References soft_reset_().

◆ hard_reset_() [2/2]

void NRF52DKHWPlatform::hard_reset_ ( )
noexcept

◆ init()

void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::init ( )
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.

◆ init_() [1/2]

void NRF52DKHWPlatform::init_ ( )
noexcept

◆ init_() [2/2]

void NRF52DKHWPlatform::init_ ( )
noexcept

◆ initProcessor()

void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::initProcessor ( )
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.

◆ initProcessor_() [1/2]

void NRF52DKHWPlatform::initProcessor_ ( )
noexcept

◆ initProcessor_() [2/2]

void NRF52DKHWPlatform::initProcessor_ ( )
noexcept

◆ leds_off() [1/2]

void NRF52DKHWPlatform::leds_off ( )
noexcept

◆ leds_off() [2/2]

void NRF52DKHWPlatform::leds_off ( )
noexcept

◆ name()

constexpr const std::string_view& embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::name ( ) const
inlinenoexceptinherited

Returns the Virtual HW Platform's name.

◆ name_cstr()

constexpr const char* embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::name_cstr ( ) const
inlinenoexceptinherited

Returns the platform name as a cstring for C API compatibility.

◆ screen0_inst()

embvm::basicDisplay& NRF52DKHWPlatform::screen0_inst ( )
inlinenoexcept

◆ shutdown()

void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::shutdown ( )
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.

◆ soft_reset()

void embvm::VirtualHwPlatformBase< NRF52DKHWPlatform >::soft_reset ( )
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.

◆ soft_reset_() [1/2]

void NRF52DKHWPlatform::soft_reset_ ( )
noexcept

Referenced by hard_reset_().

◆ soft_reset_() [2/2]

void NRF52DKHWPlatform::soft_reset_ ( )
noexcept

◆ startBlink()

void NRF52DKHWPlatform::startBlink ( )
noexcept

References led1, led2, led3, led4, processor, and nRF52840::spin().

◆ tof0_inst()

embvm::tof::sensor& NRF52DKHWPlatform::tof0_inst ( )
inlinenoexcept

Member Data Documentation

◆ i2c0

embvm::i2c::activeMaster<128> NRF52DKHWPlatform::i2c0 {i2c0_private_}
private

◆ i2c0_private_

i2c0_t NRF52DKHWPlatform::i2c0_private_
private

◆ irq_bottom_half_

embutil::InterruptQueue<ThumbInterruptLock, 156> NRF52DKHWPlatform::irq_bottom_half_
private

◆ led1

embvm::led::gpioActiveLow NRF52DKHWPlatform::led1 {led1_pin, "led1"}
private

◆ led1_pin

nRFGPIOOutput< 0, 13 > NRF52DKHWPlatform::led1_pin {}
private

◆ led2

embvm::led::gpioActiveLow NRF52DKHWPlatform::led2 {led2_pin, "led2"}
private

◆ led2_pin

nRFGPIOOutput< 0, 14 > NRF52DKHWPlatform::led2_pin {}
private

◆ led3

embvm::led::gpioActiveLow NRF52DKHWPlatform::led3 {led3_pin, "led3"}
private

Referenced by getLEDInstances(), init_(), and startBlink().

◆ led3_pin

nRFGPIOOutput< 0, 15 > NRF52DKHWPlatform::led3_pin {}
private

◆ led4

embvm::led::gpioActiveLow NRF52DKHWPlatform::led4 {led4_pin, "led4"}
private

Referenced by getLEDInstances(), init_(), and startBlink().

◆ led4_pin

nRFGPIOOutput< 0, 16 > NRF52DKHWPlatform::led4_pin {}
private

◆ processor

nRF52840 NRF52DKHWPlatform::processor
private

Referenced by startBlink().

◆ processor_

nRF52840 NRF52DKHWPlatform::processor_
private

◆ screen0

embdrv::ssd1306 NRF52DKHWPlatform::screen0 {i2c0, SPARKFUN_SSD1306_ADDR}
private

Referenced by screen0_inst().

◆ tof0

embdrv::vl53l1x NRF52DKHWPlatform::tof0 {i2c0, SPARKFUN_VL53L1X_ADDR}
private

Referenced by tof0_inst().


The documentation for this class was generated from the following files: