Dataflow Runtime API  3.0.3.0
Public Member Functions | Protected Member Functions | List of all members
imt::base::bsp::driver::SpiDriver Class Reference

Driver for a single serial peripheral in the system. More...

#include <Imt.Base.BSP/Driver/SpiDriver.h>

Inheritance diagram for imt::base::bsp::driver::SpiDriver:
imt::base::bsp::driver::ConfigurableDriverAbs< imt::base::bsp::type::DriverType::SPI, SpiDriverConfiguration > imt::base::bsp::module::DriverAbs< TypeId >

Public Member Functions

 SpiDriver (const size_t indexModule, const size_t indexPort)
 Constructor. More...
 
virtual ~SpiDriver (void)
 Destructor. More...
 
imt::base::bsp::type::ErrorCode::Id read (uint8_t *pData, const size_t size, uint8_t *const pBytesRead)
 Reads up to the given number of bytes from the SPI interface. More...
 
imt::base::bsp::type::ErrorCode::Id write (const uint8_t pData[], const uint32_t size, uint8_t *const pBytesWritten)
 Writes the given number of bytes to the SPI interface. More...
 
- Public Member Functions inherited from imt::base::bsp::driver::ConfigurableDriverAbs< imt::base::bsp::type::DriverType::SPI, SpiDriverConfiguration >
 ConfigurableDriverAbs (const size_t indexModule, const size_t indexPin)
 Constructor. More...
 
virtual ~ConfigurableDriverAbs (void)
 Destructor. More...
 
imt::base::bsp::type::ErrorCode::Id configure (const SpiDriverConfiguration &configuration)
 Configures the driver. More...
 
const SpiDriverConfigurationgetConfiguration (void) const
 Gets the last accepted configuration. More...
 
- Public Member Functions inherited from imt::base::bsp::module::DriverAbs< TypeId >
 DriverAbs (const size_t indexModule, const size_t indexDriver)
 Constructor. More...
 
virtual ~DriverAbs (void)
 Destructor. More...
 
void initialize (void)
 Initialize the driver. More...
 
void enable (void)
 Enable the driver. More...
 
imt::base::bsp::type::ErrorCode::Id start (void)
 Starts the driver. More...
 
imt::base::bsp::type::ErrorCode::Id stop (void)
 Stops the driver. More...
 
size_t getIndexDriver (void) const
 Gets the index of the driver inisde the module. More...
 
size_t getIndexModule (void) const
 Gets the index of the module the driver is part of. More...
 
imt::base::bsp::type::DriverType::Id getType (void) const
 Gets the type of the driver. More...
 
bool isInitialized (void) const
 Gets if the driver has been initialzied. More...
 
bool isEnabled (void) const
 Gets if the driver has been enabled. More...
 
bool isStarted (void) const
 Gets if the driver has been started. More...
 

Protected Member Functions

virtual void onInitialize (void)
 
virtual void onEnable (void)
 
virtual imt::base::bsp::type::ErrorCode::Id onStart (void)
 
virtual imt::base::bsp::type::ErrorCode::Id onStop (void)
 
virtual imt::base::bsp::type::ErrorCode::Id onReconfigure (const Configuration &configuration)
 

Additional Inherited Members

- Public Types inherited from imt::base::bsp::driver::ConfigurableDriverAbs< imt::base::bsp::type::DriverType::SPI, SpiDriverConfiguration >
typedef SpiDriverConfiguration Configuration
 The type of the driver configuration. More...
 
- Static Public Attributes inherited from imt::base::bsp::module::DriverAbs< TypeId >
static const imt::base::bsp::type::DriverType::Id Type = TypeId
 Constant holding the driver type. More...
 

Detailed Description

Driver for a single serial peripheral in the system.

Constructor & Destructor Documentation

◆ SpiDriver()

imt::base::bsp::driver::SpiDriver::SpiDriver ( const size_t  indexModule,
const size_t  indexPort 
)
explicit

Constructor.

Parameters
indexModuleIndex of the module (starting at 0).
indexPortIndex of the port (starting at 0).

◆ ~SpiDriver()

virtual imt::base::bsp::driver::SpiDriver::~SpiDriver ( void  )
virtual

Destructor.

Member Function Documentation

◆ onEnable()

virtual void imt::base::bsp::driver::SpiDriver::onEnable ( void  )
protectedvirtual

◆ onInitialize()

virtual void imt::base::bsp::driver::SpiDriver::onInitialize ( void  )
protectedvirtual

◆ onReconfigure()

virtual imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::SpiDriver::onReconfigure ( const Configuration configuration)
protectedvirtual

◆ onStart()

virtual imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::SpiDriver::onStart ( void  )
protectedvirtual

◆ onStop()

virtual imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::SpiDriver::onStop ( void  )
protectedvirtual

◆ read()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::SpiDriver::read ( uint8_t pData,
const size_t  size,
uint8_t *const  pBytesRead 
)

Reads up to the given number of bytes from the SPI interface.

Parameters
pDataThe array the bytes will be written to.
sizeThe maximal number of bytes to read (array size).
pBytesReadThe actual number of bytes read.
Returns
OK Read was sucessfull. INVALID_ARGUMENT Null pointer passed. UNINITIALIZED Driver is not a valid SPI. NO_DATA No data to read. INVALID_STATE Driver is not started. READ_ERROR Any other read error.

◆ write()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::SpiDriver::write ( const uint8_t  pData[],
const uint32_t  size,
uint8_t *const  pBytesWritten 
)

Writes the given number of bytes to the SPI interface.

Parameters
pDataThe array of bytes to write.
sizeThe number of bytes to write.
pBytesWrittenThe actual number of bytes written.
Returns
OK Write was sucessfull. INVALID_ARGUMENT Null pointer passed. UNINITIALIZED Driver is not a valid SPI. OUT_OF_MEMORY Data does not fit into send buffer. INVALID_STATE Driver is not started. WRITE_ERROR Any other write error.

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