Call external drivers
Koheron SDK 0.x documentation.
Use the master branch with the V0 image supplied with your board. This version uses
CONFIG=.../config.yml. For new instrument development, follow the V1 documentation.
For example the driver Laser defined by the file laser.hpp uses the driver Xadc defined by the file xadc.hpp:
Usage
To call the driver Xadc from the driver Laser:
- include
xadc.hppfile - use
ctx.getin the driver Laser constructor - return
Xadcobject
Example
#include <xadc.hpp>
public:
Laser(Context& ctx)
: ctl(ctx.mm.get<mem::control>())
, sts(ctx.mm.get<mem::status>())
, xadc(ctx.get<Xadc>())
private:
Memory<mem::control>& ctl;
Memory<mem::status>& sts;
Xadc& xadc;
Important note
Be careful not to introduce circular dependencies in the constructors.