STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Pwm Architecture Driver More...
Pwm Architecture Driver
Pwm driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the Pwm driver. The file is implemented as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available only for the inmediate upper layer.
void Pwm_Arch_DeInit | ( | Pwm_HwUnit * | HwUnit | ) |
Pwm low level Deinitialization
This function de-initializes the Pwm module.
HwUnit | Pointer to the hardware unit configuration |
void Pwm_Arch_DisableNotification | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber ) |
Pwm low level Disable Notification
Function to disable the PWM signal edge notification.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
void Pwm_Arch_EnableNotification | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber, | ||
Pwm_EdgeNotificationType | Notification ) |
Pwm low level Enable Notification
Function to enable the PWM signal edge notification according to notification parameter.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
Notification | Type of notification PWM_RISING_EDGE or PWM_FALLING_EDGE or PWM_BOTH_EDGES. |
Std_ReturnType Pwm_Arch_GetCurrentPowerState | ( | Pwm_HwUnit * | HwUnit, |
Pwm_PowerStateType * | CurrentPowerState, | ||
Pwm_PowerStateRequestResultType * | Result ) |
Pwm low level Get Current Power State
This function provides the current power state of a specified PWM hardware unit.
HwUnit | Pointer to the hardware unit configuration |
CurrentPowerState | The current power mode of the PWM HW Unit is returned in this parameter |
Result | If the API returns E_OK: PWM_SERVICE_ACCEPTED: Current power mode was returned. If the API returns E_NOT_OK: PWM_NOT_INIT: PWM Module not initialized. |
E_OK | Mode could be read E_NOT_OK: Service is rejected |
Pwm_OutputStateType Pwm_Arch_GetOutputState | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber ) |
Pwm low level Get Output State
Function to read the internal state of the PWM output signal.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
PWM_HIGH | The PWM output state is high PWM_LOW: The PWM output state is low |
Std_ReturnType Pwm_Arch_GetTargetPowerState | ( | Pwm_HwUnit * | HwUnit, |
Pwm_PowerStateType * | TargetPowerState, | ||
Pwm_PowerStateRequestResultType * | Result ) |
Pwm low level Get Target Power State
The API returns the requested power state of the HW unit. This shall coincide with the current power state if no transition is ongoing.
HwUnit | Pointer to the hardware unit configuration |
TargetPowerState | The Target power mode of the PWM HW Unit is returned in this parameter. |
Result | If the API returns E_OK: PWM_SERVICE_ACCEPTED:Target power mode was returned. If the API returns E_NOT_OK: PWM_NOT_INIT: PWM Module not initialized. |
E_OK | Mode could be read E_NOT_OK: Service is rejected |
void Pwm_Arch_Init | ( | Pwm_HwUnit * | HwUnit, |
const Pwm_ConfigType * | Config ) |
Pwm low level Initialization
This function initialize all internals variables and the used PWM structure of the microcontroller according to the parameters specified in ConfigPtr and HwUnit. Furthermore disable all notifications.
HwUnit | Pointer to the hardware unit configuration |
Config | Pointer to driver configuration |
Std_ReturnType Pwm_Arch_PreparePowerState | ( | Pwm_HwUnit * | HwUnit, |
Pwm_PowerStateType | PowerState, | ||
Pwm_PowerStateRequestResultType * | Result ) |
Pwm low level Prepare Power State
This API starts the needed process to allow the PWM HW module to enter the requested power state. Initiates all actions needed to enable a HW module to enter the target power state.
HwUnit | Pointer to the hardware unit configuration. |
PowerState | The Target power mode of the PWM HW Unit is returned in this parameter. |
Result | If the API returns E_OK: PWM_SERVICE_ACCEPTED: PWM Module power state preparation was started. If the API returns E_NOT_OK: PWM_NOT_INIT: PWM Module not initialized. PWM_SEQUENCE_ERROR: wrong API call sequence (Current Power State = Target Power State). PWM_POWER_STATE_NOT_SUPP: PWM Module does not support the requested power state. PWM_TRANS_NOT_POSSIBLE: PWM Module cannot transition directly from the current power state to the requested power state or the HW peripheral is still busy |
E_OK | Preparation process started E_NOT_OK: Service is rejected |
void Pwm_Arch_SetDutyCycle | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber, | ||
uint16 | DutyCycle ) |
Pwm low level Set Duty Cycle
This function sets the duty cycle of the PWM channel.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
DutyCycle | Min=0x0000 Max=0x8000 |
void Pwm_Arch_SetOutputToIdle | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber ) |
Pwm low level Set Output To Idle
This function sets the PWM output to the configured Idle state.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
void Pwm_Arch_SetPeriodAndDuty | ( | Pwm_HwUnit * | HwUnit, |
Pwm_ChannelType | ChannelNumber, | ||
Pwm_PeriodType | Period, | ||
uint16 | DutyCycle ) |
Pwm low level Set Period and Duty
This function sets the period and the duty cycle of a PWM channel.
HwUnit | Pointer to the hardware unit configuration |
ChannelNumber | Numeric identifier of the PWM |
Period | Period of the PWM signal |
DutyCycle | Min=0x0000 Max=0x8000 |
Std_ReturnType Pwm_Arch_SetPowerState | ( | Pwm_HwUnit * | HwUnit, |
Pwm_PowerStateRequestResultType * | Result ) |
Pwm low level Set Power State
This function configures the Pwm module so that it enters the already prepared power state, chosen between a predefined set of configured ones.
HwUnit | Pointer to the hardware unit configuration |
Result | If the API returns E_OK: PWM_SERVICE_ACCEPTED:Power state change executed. If the API returns E_NOT_OK: PWM_NOT_INIT: PWM Module not initialized. PWM_SEQUENCE_ERROR: wrong API call sequence. PWM_HW_FAILURE: the HW module has a failure which prevents it to enter the required power state |
E_OK | Power Mode changed E_NOT_OK: request rejected |