PWM_CCU4: Methods

PWM CCU4

PWM_CCU4
Methods
DAVE_APP_VERSION_t PWM_CCU4_GetAppVersion (void)
 Retrieves the version of the PWM_CCU4 APP. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_Init (PWM_CCU4_t *const handle_ptr)
 Initializes the PWM_CCU4 APP. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_Start (PWM_CCU4_t *const handle_ptr)
 Start the selected CCU4 slice. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_Stop (PWM_CCU4_t *const handle_ptr)
 Stop the selected CCU4 slice. More...
 
uint32_t PWM_CCU4_GetTimerValue (PWM_CCU4_t *const handle_ptr)
 Returns the timer value. More...
 
bool PWM_CCU4_GetTimerStatus (PWM_CCU4_t *const handle_ptr)
 Returns the timer status. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_SetFreq (PWM_CCU4_t *const handle_ptr, uint32_t pwm_freq_hz)
 Sets the PWM frequency. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_SetDutyCycle (PWM_CCU4_t *const handle_ptr, uint32_t duty_cycle)
 Sets the duty cycle of PWM. More...
 
PWM_CCU4_STATUS_t PWM_CCU4_SetFreqAndDutyCycle (PWM_CCU4_t *const handle_ptr, uint32_t pwm_freq_hz, uint32_t duty)
 Sets the frequency duty cycle of PWM. More...
 
void PWM_CCU4_SetDither (PWM_CCU4_t *const handle_ptr, bool dither_period, bool dither_comp, uint8_t dither_value)
 Sets the dither value for period , duty or both. More...
 
void PWM_CCU4_ClearTrap (PWM_CCU4_t *const handle_ptr)
 Clears the trap event. More...
 
bool PWM_CCU4_GetInterruptStatus (PWM_CCU4_t *const handle_ptr, XMC_CCU4_SLICE_IRQ_ID_t pwm_interrupt)
 Returns the interrupt status. More...
 
void PWM_CCU4_ClearEvent (PWM_CCU4_t *const handle_ptr, XMC_CCU4_SLICE_IRQ_ID_t pwm_interrupt)
 Acknowledges the interrupt. More...
 

Detailed Description

Methods

Function Documentation

void PWM_CCU4_ClearEvent ( PWM_CCU4_t *const  handle_ptr,
XMC_CCU4_SLICE_IRQ_ID_t  pwm_interrupt 
)

Acknowledges the interrupt.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
pwm_interruptinterrupt ID
Returns
Description:
Clears the interrupt status flag, provided the interrupt condition no longer exists.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
PWM_CCU4_ClearEvent(&PWM_CCU4_0,XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH);
PWM_CCU4_ClearEvent(&PWM_CCU4_0,XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP);
while(1);
return 0;
}

Definition at line 586 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr.

void PWM_CCU4_ClearTrap ( PWM_CCU4_t *const  handle_ptr)

Clears the trap event.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
Returns
void
Description:
Clears the trap event provided the trap condition no longer exists.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
PWM_CCU4_ClearTrap(&PWM_CCU4_0);
while(1);
return 0;
}

Definition at line 563 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr.

DAVE_APP_VERSION_t PWM_CCU4_GetAppVersion ( void  )

Retrieves the version of the PWM_CCU4 APP.

Parameters
None
Returns
DAVE_APP_VERSION_t APP version information (major, minor and patch number)
Description:
The function can be used to check application software compatibility with a specific version of the APP.

*Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_APP_VERSION_t version;
while(1);
return 0;
}

Definition at line 93 of file PWM_CCU4.c.

bool PWM_CCU4_GetInterruptStatus ( PWM_CCU4_t *const  handle_ptr,
XMC_CCU4_SLICE_IRQ_ID_t  pwm_interrupt 
)

Returns the interrupt status.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
pwm_interruptinterrupt ID
Returns
bool
Description:
Returns true if the interrupt flag is set, else returns false.

Example Usage:

#include <DAVE.h>
int main(void)
{
bool status;
DAVE_Init();
// Returns period match interrupt status.
status = PWM_CCU4_GetInterruptStatus(&PWM_CCU4_0,XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH);
// Returns channel compare match interrupt status.
status = PWM_CCU4_GetInterruptStatus(&PWM_CCU4_0,XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP);
while(1);
return 0;
}

Definition at line 575 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr.

bool PWM_CCU4_GetTimerStatus ( PWM_CCU4_t *const  handle_ptr)

Returns the timer status.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
Returns
XMC_CCU4_STATUS_t
Description:
Returns true is the timer is running else returns false.

Example Usage:

#include <DAVE.h>
int main(void)
{
bool status;
DAVE_Init();
status = PWM_CCU4_GetTimerStatus(&PWM_CCU4_0);
while(1);
return 0;
}

Definition at line 393 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr.

uint32_t PWM_CCU4_GetTimerValue ( PWM_CCU4_t *const  handle_ptr)

Returns the timer value.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
Returns
uint32_t
Description:
Returns the timer value if the APP is initialized.

Example Usage:

#include <DAVE.h>
int main(void)
{
uint32_t timer ;
DAVE_Init();
timer = PWM_CCU4_GetTimerValue(&PWM_CCU4_0);
while(1);
return 0;
}

Definition at line 383 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr.

PWM_CCU4_STATUS_t PWM_CCU4_Init ( PWM_CCU4_t *const  handle_ptr)
void PWM_CCU4_SetDither ( PWM_CCU4_t *const  handle_ptr,
bool  dither_period,
bool  dither_comp,
uint8_t  dither_value 
)

Sets the dither value for period , duty or both.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
dither_periodapply dither to period
dither_compapply dither to compare
dither_valuedither value
Returns
void
Description:
Sets the dither value for period , duty or both.
dither_value: is the dither value.
dither_period: when true, dither is applied to period.
dither_comp: when true, dither is applied to compare.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
PWM_CCU4_SetDither(&PWM_CCU4_0,(bool) true, (bool)true, 10);
while(1);
return 0;
}

Definition at line 550 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_module_ptr, PWM_CCU4_HandleType::ccu4_slice_ptr, and PWM_CCU4_HandleType::dither_shadow_txfr_msk.

PWM_CCU4_STATUS_t PWM_CCU4_SetDutyCycle ( PWM_CCU4_t *const  handle_ptr,
uint32_t  duty_cycle 
)

Sets the duty cycle of PWM.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
duty_cyclechannel duty cycle uint32_t
Returns
PWM_CCU4_STATUS_t
Description:
Sets the PWM duty. The APP should not be in "PWM_CCU4_UNINITIALIZED" state. Duty is scaled by 100.
The condition [duty < 100%] should be met.
Returns PWM_CCU4_STATUS_SUCCESS if operation update is success.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
// sets the channel duty to 40%.
status = PWM_CCU4_SetDutyCycle(&PWM_CCU4_0, 4000);
while(1);
return 0;
}

Definition at line 458 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_module_ptr, PWM_CCU4_HandleType::ccu4_slice_ptr, PWM_CCU4_STATE_UNINITIALIZED, PWM_CCU4_STATUS_FAILURE, PWM_CCU4_STATUS_SUCCESS, PWM_CCU4_HandleType::shadow_txfr_msk, PWM_CCU4_HandleType::state, and PWM_CCU4_HandleType::sym_duty.

PWM_CCU4_STATUS_t PWM_CCU4_SetFreq ( PWM_CCU4_t *const  handle_ptr,
uint32_t  pwm_freq_hz 
)

Sets the PWM frequency.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
pwm_freq_hzvalue in Hz (uint32_t)
Returns
PWM_CCU4_STATUS_t
Description:
Sets the PWM frequency of PWM generation. The APP should not be in "PWM_CCU4_UNINITIALIZED" state. Returns PWM_CCU4_STATUS_SUCCESS if frequency update is success.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
status = PWM_CCU4_SetFreq(&PWM_CCU4_0, 100000);
while(1);
return 0;
}

Definition at line 405 of file PWM_CCU4.c.

References PWM_CCU4_ConfigType::ccu4_cc4_slice_timer_ptr, PWM_CCU4_HandleType::ccu4_module_ptr, PWM_CCU4_HandleType::ccu4_slice_ptr, PWM_CCU4_HandleType::config_ptr, PWM_CCU4_HandleType::frequency_tclk, PWM_CCU4_STATE_UNINITIALIZED, PWM_CCU4_STATUS_FAILURE, PWM_CCU4_STATUS_SUCCESS, PWM_CCU4_HandleType::shadow_txfr_msk, PWM_CCU4_HandleType::state, and PWM_CCU4_HandleType::sym_duty.

PWM_CCU4_STATUS_t PWM_CCU4_SetFreqAndDutyCycle ( PWM_CCU4_t *const  handle_ptr,
uint32_t  pwm_freq_hz,
uint32_t  duty 
)

Sets the frequency duty cycle of PWM.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
pwm_freq_hzvalue in Hz (uint32_t)
dutychannel duty
Returns
PWM_CCU4_STATUS_t
Description:
Sets the frequency and duty of PWM. The APP should not be in "PWM_CCU4_UNINITIALIZED" state. Duty is scaled by 100.
The condition [duty < 100%] should be met.
Returns PWM_CCU4_STATUS_SUCCESS if operation update is success.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
// Sets freq = 100000, channel duty = 40%
status = PWM_CCU4_SetFreqAndDutyCycle(&PWM_CCU4_0, 100000, 4000);
while(1);
return 0;
}

Definition at line 495 of file PWM_CCU4.c.

References PWM_CCU4_ConfigType::ccu4_cc4_slice_timer_ptr, PWM_CCU4_HandleType::ccu4_module_ptr, PWM_CCU4_HandleType::ccu4_slice_ptr, PWM_CCU4_HandleType::config_ptr, PWM_CCU4_HandleType::frequency_tclk, PWM_CCU4_STATE_UNINITIALIZED, PWM_CCU4_STATUS_FAILURE, PWM_CCU4_STATUS_SUCCESS, PWM_CCU4_HandleType::shadow_txfr_msk, PWM_CCU4_HandleType::state, and PWM_CCU4_HandleType::sym_duty.

PWM_CCU4_STATUS_t PWM_CCU4_Start ( PWM_CCU4_t *const  handle_ptr)

Start the selected CCU4 slice.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
Returns
PWM_CCU4_STATUS_t
Description:
Starts the selected CCU4 slice for PWM generation. Returns PWM_CCU4_STATUS_SUCCESS if the PWM_CCU4 APP state is in "PWM_CCU4_STATE_INITIALIZED" or "PWM_CCU4_STOPPED" else returns PWM_CCU4_STATUS_FAILURE.
PWM_CCU4_Start() is needed to be called if "Start during initialization" is unchecked to start PWM generation, else its called by DAVE_Init();

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
//This API needs to be called if "Start during initialization" is unchecked
PWM_CCU4_Start(&PWM_CCU4_0);
while(1);
return 0;
}

Definition at line 339 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_module_ptr, PWM_CCU4_HandleType::ccu4_slice_ptr, PWM_CCU4_HandleType::config_ptr, PWM_CCU4_ConfigType::ext_start_event, PWM_CCU4_STATE_INITIALIZED, PWM_CCU4_STATE_RUNNING, PWM_CCU4_STATE_STOPPED, PWM_CCU4_STATUS_FAILURE, PWM_CCU4_STATUS_SUCCESS, PWM_CCU4_HandleType::slice_number, and PWM_CCU4_HandleType::state.

Referenced by PWM_CCU4_Init().

PWM_CCU4_STATUS_t PWM_CCU4_Stop ( PWM_CCU4_t *const  handle_ptr)

Stop the selected CCU4 slice.

Parameters
handle_ptrPointer to PWM_CCU4_t structure containing APP parameters.
Returns
PWM_CCU4_STATUS_t
Description:
Stops the selected CCU4 slice form PWM generation. Returns PWM_CCU4_STATUS_SUCCESS if the PWM_CCU4 APP state is not "PWM_CCU4_STATE_UNINITIALIZED" else returns PWM_CCU4_STATUS_FAILURE.

Example Usage:

#include <DAVE.h>
int main(void)
{
DAVE_Init();
PWM_CCU4_Stop(&PWM_CCU4_0);
while(1);
return 0;
}

Definition at line 363 of file PWM_CCU4.c.

References PWM_CCU4_HandleType::ccu4_slice_ptr, PWM_CCU4_STATE_STOPPED, PWM_CCU4_STATE_UNINITIALIZED, PWM_CCU4_STATUS_FAILURE, PWM_CCU4_STATUS_SUCCESS, and PWM_CCU4_HandleType::state.