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. | |
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.
Definition at line 164 of file pruio_pwmss.bi.
PwmssUdt::PwmssUdt | ( | BYVAL_AS_Pruio__PTR | T | ) |
Constructor for the PWMSS subsystem configuration.
T | A 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.
Definition at line 36 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
Freq | A pointer to output the frequency value (or 0 for no output). |
Duty | A pointer to output the duty value (or 0 for no output). |
This private functions computes the real PWM configuration of an eCAP module. It's designed to get called from function PwmMod::Value().
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 117 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
F | The frequency to set (or -1 for no change). |
D | The duty cycle for output A (0.0 to 1.0, or -1 for no change). |
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%).
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 148 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
Dur1 | The variable to store the duration of initial state. |
Dur2 | The variable to store the duration of the pulse. |
This private functions computes the real PWM configuration of an eCAP module. It's designed to get called from function PwmMod::Value().
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 206 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
Dur1 | The duration of initial state. |
Dur2 | The duration of the pulse (0 (zero) for minimal. |
Mode | The mode of the timer output. |
This functions configures an eCAP module for TIMER output. It sets the durations for the initial state period and the pulse.
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 257 of file pruio_pwmss.bas.
FUNCTION_CDECL_AS_ZSTRING_PTR PwmssUdt::initialize | ( | ) |
Initialize the register context after running the pasm_init.p instructions (private).
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.
Definition at line 65 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
F | A pointer to output the frequency value (or 0 for no output). |
Du | A pointer to output the duty value (or 0 for no output). |
Mo | The output channel (0 = A, otherwise B). |
This private functions computes the real configuration of an eHRPWM module. It's designed to get called from function PwmMod::Value().
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 323 of file pruio_pwmss.bas.
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).
Nr | The PWMSS subsystem index. |
F | The frequency to set (or -1 for no change). |
Da | The duty cycle for output A (0.0 to 1.0, or -1 for no change). |
Db | The duty cycle for output B (0.0 to 1.0, or -1 for no change). |
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%).
Nr
parameter. Values greater than PRUIO_AZ_GPIO may result in wired behaviour.Definition at line 369 of file pruio_pwmss.bas.