libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
PwmssUdt Class Reference

Structure for PWMSS subsystem features, containing all variables to handle the subsystems. More...

Public Member Functions

 PwmssUdt (BYVAL_AS_Pruio__PTR)
 Constructor for the PWMSS subsystem configuration. More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR initialize ()
 Initialize the register context after running the pasm_init.p instructions (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR pwm_pwm_set (BYVAL_AS_UInt8, BYVAL_AS_Float_t, BYVAL_AS_Float_t, BYVAL_AS_Float_t)
 Configure PWM output at a eHRPWM module (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR cap_pwm_set (BYVAL_AS_UInt8, BYVAL_AS_Float_t, BYVAL_AS_Float_t)
 Configure PWM output at an eCAP module (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR pwm_pwm_get (BYVAL_AS_UInt8, BYVAL_AS_Float_t_PTR, BYVAL_AS_Float_t_PTR, BYVAL_AS_UInt8)
 Compute PWM output configuration from an eHRPWM module (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR cap_pwm_get (BYVAL_AS_UInt8, BYVAL_AS_Float_t_PTR, BYVAL_AS_Float_t_PTR)
 Compute PWM output configuration from an eCAP module (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR cap_tim_set (BYVAL_AS_UInt8, BYVAL_AS_Float_t, BYVAL_AS_Float_t, BYVAL_AS_SHORT)
 Configure Timer output from an eCAP module (private). More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR cap_tim_get (BYVAL_AS_UInt8, BYVAL_AS_Float_t_PTR, BYVAL_AS_Float_t_PTR)
 Compute current values of eCAP Timer output (private). More...
 

Public Attributes

Pruio__PTR Top
 Pointer to the calling PruIo instance.
 
PwmssSet_PTR Init [PRUIO_AZ_PWMSS+1]
 Initial subsystem configuration, used in the destructor PruIo::~PruIo().
 
PwmssSet_PTR Conf [PRUIO_AZ_PWMSS+1]
 Current subsystem configuration, used in PruIo::config().
 
PwmssArr_PTR Raw [PRUIO_AZ_PWMSS+1]
 Pointer to current raw subsystem data (IO).
 
UInt32 InitParA
 Initial parameters offset.
 
CONST_UInt16 PwmMode = &b01000010000
 Value for ECCTL2 in PWM mode.
 
CONST_UInt16 CapMode = &b00011010110
 Value for ECCTL2 in CAP mode.
 
ZSTRING_PTR E0 = "PWMSS not enabled"
 Common error message.
 
ZSTRING_PTR E1 = "set frequency in first call"
 Common error message.
 
ZSTRING_PTR E2 = "frequency not supported"
 Common error message.
 
ZSTRING_PTR E3 = "pin not in PWM mode"
 Common error message.
 
ZSTRING_PTR E4 = "pin has no PWM capability"
 Common error message.
 
ZSTRING_PTR E5 = "pin not in CAP mode"
 Common error message.
 
ZSTRING_PTR E6 = "pin has no CAP capability"
 Common error message.
 
ZSTRING_PTR E7 = "pin not in QEP mode"
 Common error message.
 
ZSTRING_PTR E8 = "pin has no QEP capability"
 Common error message.
 
ZSTRING_PTR E9 = "eCAP module not in output mode"
 Common error message.
 

Detailed Description

Structure for PWMSS subsystem features, containing all variables to handle the subsystems.

This UDT contains (only) the configuration of the three PWMSS subsystems in the CPU. The functions to drive the hardware are in separate UDTs, to make the API more easy to understand. See UDTs PwmMod, CapMod and QepMod for details.

Since
0.2

Definition at line 164 of file pruio_pwmss.bi.

Constructor & Destructor Documentation

◆ PwmssUdt()

PwmssUdt::PwmssUdt ( BYVAL_AS_Pruio__PTR  T)

Constructor for the PWMSS subsystem configuration.

Parameters
TA pointer of the calling PruIo structure.

The constructor prepares the DRam parameters to run the pasm_init.p instructions. The adresses of the subsystems and the adresses of the clock registers get prepared, and the index of the last parameter gets stored to compute the offset in the Init and Conf data blocks.

Since
0.2

Definition at line 36 of file pruio_pwmss.bas.

Here is the caller graph for this function:

Member Function Documentation

◆ cap_pwm_get()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::cap_pwm_get ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t_PTR  Freq = 0,
BYVAL_AS_Float_t_PTR  Duty = 0 
)

Compute PWM output configuration from an eCAP module (private).

Parameters
NrThe PWMSS subsystem index.
FreqA pointer to output the frequency value (or 0 for no output).
DutyA pointer to output the duty value (or 0 for no output).
Returns
Zero on success, an error string otherwise.

This private functions computes the real PWM configuration of an eCAP module. It's designed to get called from function PwmMod::Value().

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.2

Definition at line 117 of file pruio_pwmss.bas.

◆ cap_pwm_set()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::cap_pwm_set ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t  F,
BYVAL_AS_Float_t  D = 0. 
)

Configure PWM output at an eCAP module (private).

Parameters
NrThe PWMSS subsystem index.
FThe frequency to set (or -1 for no change).
DThe duty cycle for output A (0.0 to 1.0, or -1 for no change).
Returns
Zero on success, an error string otherwise.

This functions configures an eCAP module for PWM output. It sets the frequency and the duty cycle. Only positive values in these parameters force a change. Pass a negative value to stay with the current setting. A duty parameters greater than 1.0 gets limited to 1.0 (= 100%).

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.2

Definition at line 148 of file pruio_pwmss.bas.

◆ cap_tim_get()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::cap_tim_get ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t_PTR  Dur1,
BYVAL_AS_Float_t_PTR  Dur2 
)

Compute current values of eCAP Timer output (private).

Parameters
NrThe PWMSS subsystem index.
Dur1The variable to store the duration of initial state.
Dur2The variable to store the duration of the pulse.
Returns
Zero on success, an error string otherwise.

This private functions computes the real PWM configuration of an eCAP module. It's designed to get called from function PwmMod::Value().

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.4

Definition at line 206 of file pruio_pwmss.bas.

◆ cap_tim_set()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::cap_tim_set ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t  Dur1,
BYVAL_AS_Float_t  Dur2,
BYVAL_AS_SHORT  Mode 
)

Configure Timer output from an eCAP module (private).

Parameters
NrThe PWMSS subsystem index.
Dur1The duration of initial state.
Dur2The duration of the pulse (0 (zero) for minimal.
ModeThe mode of the timer output.
Returns
Zero on success, an error string otherwise.

This functions configures an eCAP module for TIMER output. It sets the durations for the initial state period and the pulse.

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.4

Definition at line 257 of file pruio_pwmss.bas.

◆ initialize()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::initialize ( )

Initialize the register context after running the pasm_init.p instructions (private).

Returns
Zero on success (may return an error string in future versions).

This is a private function, designed to be called from the main constructor PruIo::PruIo(). It sets the pointers to the Init and Conf structures in the data blocks. And it initializes some register context, if the subsystem woke up and is enabled.

Since
0.2

Definition at line 65 of file pruio_pwmss.bas.

Here is the caller graph for this function:

◆ pwm_pwm_get()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::pwm_pwm_get ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t_PTR  F = 0,
BYVAL_AS_Float_t_PTR  Du = 0,
BYVAL_AS_UInt8  Mo = 0 
)

Compute PWM output configuration from an eHRPWM module (private).

Parameters
NrThe PWMSS subsystem index.
FA pointer to output the frequency value (or 0 for no output).
DuA pointer to output the duty value (or 0 for no output).
MoThe output channel (0 = A, otherwise B).
Returns
Zero on success, an error string otherwise.

This private functions computes the real configuration of an eHRPWM module. It's designed to get called from function PwmMod::Value().

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.2

Definition at line 323 of file pruio_pwmss.bas.

◆ pwm_pwm_set()

FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::pwm_pwm_set ( BYVAL_AS_UInt8  Nr,
BYVAL_AS_Float_t  F,
BYVAL_AS_Float_t  Da = 0.,
BYVAL_AS_Float_t  Db = 0. 
)

Configure PWM output at a eHRPWM module (private).

Parameters
NrThe PWMSS subsystem index.
FThe frequency to set (or -1 for no change).
DaThe duty cycle for output A (0.0 to 1.0, or -1 for no change).
DbThe duty cycle for output B (0.0 to 1.0, or -1 for no change).
Returns
Zero on success, an error string otherwise.

This private function configures an eHRPWM module. It sets the common frequency and both output duties A and B. Only positive values in these parameters force a change. Pass a negative value to stay with the current setting. Duty parameters (Da and Db) greater than 1.0 get limited to 1.0 (= 100%).

Note
This is a private function designed for internal use. It doesn't check the validity of the Nr parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.
Since
0.2

Definition at line 369 of file pruio_pwmss.bas.


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