Implementation
Generation of PWM signal
After initializing the time constants (
initTime()
) and setting the port pin P02.1 as
push-pull output (
IfxPort_setPinMode()
), a simple PWM signal is generated by
toggling a pin with the function
generate_PWM_signal()
.
The state of the output port pin P02.1 is toggled by calling the function
IfxPort_setPinState()
with the parameters
IfxPort_State_high and
IfxPort_State_low.
For changing the frequency and duty cycle of the generated PWM signal the global
parameter
g_generatedPwmFreq_Hz
and
g_generatedDutyCycle
can be modified.
Depending on the frequency and duty cycle (set to 50%), two timeout values are
calculated by software and passed to the
wait()
function. The two wait() function calls
are succeeding the two calls of the function
IfxPort_setPinState()
.
The parameters and functions used for the port pin control and timing are provided by
the two iLLD headers
IfxPort.h
and
Bsp.h
.
14
2020-01-17
Copyright © Infineon Technologies AG 2020. All rights reserved.