Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
tcPwm Class Reference

#include <Pwm.h>

Collaboration diagram for tcPwm:

Public Member Functions

 tcPwm (uint32_t anAddress, double anRefClkMhz, std::string acUioName=std::string())
 tcPwm::tcPwm Class Constructor. More...
 
virtual ~tcPwm ()
 
bool initialized ()
 
void setRefClkMhz (double anRefClkMhz)
 
uint32_t readVersion ()
 tcPwm::readVersion of the fpga core More...
 
bool readCoreEnable ()
 tcPwm::readCoreEnable More...
 
void enableCore (bool abEnable)
 tcPwm::enableCore Enable/Disable the pulse output When disabled the output will be in the inactive state. More...
 
bool readInvertPulse ()
 tcPwm::readInvertPulse True is pulse active low and inactive high. False is pulse active high and inactive low. Default is active high. More...
 
void setInvertPulse (bool abPulseLow)
 tcPwm::setInvertPulse True is pulse active low and inactive high. False is pulse active high and inactive low. Default is active high. More...
 
void setPeriodTime (std::chrono::microseconds anPeriod)
 tcPwm::setPeriodTime Configures prescalar and pulse period registers More...
 
void setPeriodFreq (uint32_t anFreqHz)
 tcPwm::setPeriodFreq Configures prescalar and pulse period registers More...
 
void setPeriodClks (uint64_t anPeriodClks)
 tcPwm::setPeriodClks Configures prescalar and pulse period registers More...
 
void setDutyTime (std::chrono::microseconds anDuty)
 tcPwm::setDutyTime Configures pulse active time register More...
 
void setDutyPercent (double anDutyPercent)
 tcPwm::setDutyPercent Configures pulse active time register More...
 
void setDutyClks (uint32_t anDutyClks)
 tcPwm::setDutyClks Configures pulse active time register More...
 
void dumpRegisters ()
 tcPwm::dumpRegisters Print various registers to console More...
 
void enableInterrupts (bool abDeAssert, bool abEnable)
 tcPwm::enableInterrupts Enables the PWM core to generate interrupts More...
 
bool interruptPending (void)
 tcPwm::interruptPending More...
 
void clearInterruptStatus (void)
 tcPwm::clearInterruptStatus Cleas the interrupt pending status. More...
 
int waitForInterrupt (std::chrono::microseconds anTimeout)
 tcPwm::waitForInterrupt Wait for the PWM to trigger and interrupt condition More...
 

Constructor & Destructor Documentation

◆ tcPwm()

tcPwm::tcPwm ( uint32_t  anAddress,
double  anRefClkMhz,
std::string  acUioName = std::string() 
)

tcPwm::tcPwm Class Constructor.

Parameters
anAddressthe phyiscal base address of the control core.
anRefClkMhzthe reference clock provided to the control core.
acUioNamethe name of the uio device tracking the interrupt of the core, can be empty.

◆ ~tcPwm()

tcPwm::~tcPwm ( )
virtual

Member Function Documentation

◆ clearInterruptStatus()

void tcPwm::clearInterruptStatus ( void  )

tcPwm::clearInterruptStatus Cleas the interrupt pending status.

◆ dumpRegisters()

void tcPwm::dumpRegisters ( )

tcPwm::dumpRegisters Print various registers to console

◆ enableCore()

void tcPwm::enableCore ( bool  abEnable)

tcPwm::enableCore Enable/Disable the pulse output When disabled the output will be in the inactive state.

Parameters
abEnable

◆ enableInterrupts()

void tcPwm::enableInterrupts ( bool  abDeAssert,
bool  abEnable 
)

tcPwm::enableInterrupts Enables the PWM core to generate interrupts

Parameters
abDeAssertwhen true, interrupts are asserted at the end of the "active" time
abEnablewhen true, the PWM core will issue interrupts

◆ initialized()

bool tcPwm::initialized ( )

◆ interruptPending()

bool tcPwm::interruptPending ( void  )

tcPwm::interruptPending

Returns
true if there is an interrupt condition pending.

◆ readCoreEnable()

bool tcPwm::readCoreEnable ( )

tcPwm::readCoreEnable

Returns
true if core is enabled

◆ readInvertPulse()

bool tcPwm::readInvertPulse ( )

tcPwm::readInvertPulse True is pulse active low and inactive high. False is pulse active high and inactive low. Default is active high.

Returns

◆ readVersion()

uint32_t tcPwm::readVersion ( )

tcPwm::readVersion of the fpga core

Returns

◆ setDutyClks()

void tcPwm::setDutyClks ( uint32_t  anDutyClks)

tcPwm::setDutyClks Configures pulse active time register

Parameters
anDutyClksDuty cycle specified in clocks
Exceptions
std::runtime_errorif duty cycle is too high

◆ setDutyPercent()

void tcPwm::setDutyPercent ( double  anDutyPercent)

tcPwm::setDutyPercent Configures pulse active time register

Parameters
anDutyPercentPercent of period that output is active. 1.0 is 100%
Exceptions
std::runtime_errorif requested duty cycle is > 1

◆ setDutyTime()

void tcPwm::setDutyTime ( std::chrono::microseconds  anDuty)

tcPwm::setDutyTime Configures pulse active time register

Parameters
anDutyDuty cycle specified in microseconds
Exceptions
std::runtime_errorif duty cycle is too high

◆ setInvertPulse()

void tcPwm::setInvertPulse ( bool  abPulseLow)

tcPwm::setInvertPulse True is pulse active low and inactive high. False is pulse active high and inactive low. Default is active high.

Parameters
abPulseLow

◆ setPeriodClks()

void tcPwm::setPeriodClks ( uint64_t  anPeriodClks)

tcPwm::setPeriodClks Configures prescalar and pulse period registers

Parameters
anPeriodClksNumber of clocks at reference clock frequency that define pwm period
Exceptions
std::runtime_errorif requested anPeriodClks is too large

◆ setPeriodFreq()

void tcPwm::setPeriodFreq ( uint32_t  anFreqHz)

tcPwm::setPeriodFreq Configures prescalar and pulse period registers

Parameters
anFreqHzPeriod specified in hz

◆ setPeriodTime()

void tcPwm::setPeriodTime ( std::chrono::microseconds  anPeriod)

tcPwm::setPeriodTime Configures prescalar and pulse period registers

Parameters
anPeriodPeriod specified in microseconds
Exceptions
std::runtime_errorif requested anPeriod is too large

◆ setRefClkMhz()

void tcPwm::setRefClkMhz ( double  anRefClkMhz)
inline

◆ waitForInterrupt()

int tcPwm::waitForInterrupt ( std::chrono::microseconds  anTimeout)

tcPwm::waitForInterrupt Wait for the PWM to trigger and interrupt condition

Parameters
anTimeoutNumber of Microseconds to wait (0 = wait forever)
Note
This routine will call clearInterruptStatus() if a valid interrupt is detected.
Returns
-1 on error (no UIO found), 0 on timeout, or number of pending interrupts since last check Typically this will be 1 because the cleanInterruptStatus() must be called to cause a new edge level interrupt to occur.

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