STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
Loading...
Searching...
No Matches
Pwm_Types.h File Reference

Pwm Driver Types More...

#include "Registers.h"

Go to the source code of this file.

Data Structures

struct  _Pwm_ConfigType
 Hardware unit configuration structure More...
 
struct  _Pwm_HwUnit
 Hardware control unit structure More...
 

Macros

#define PWM_ID_INIT   0x00u
 
#define PWM_ID_DE_INIT   0x01u
 
#define PWM_ID_SET_DUTY_CYCLE   0x02u
 
#define PWM_ID_SET_PERIOD_AND_DUTY   0x03u
 
#define PWM_ID_SET_OUTPUT_TO_IDLE   0x04u
 
#define PWM_ID_GET_OUTPUT_STATE   0x05u
 
#define PWM_ID_DISABLE_NOTIFICATION   0x06u
 
#define PWM_ID_ENABLE_NOTIFICATION   0x07u
 
#define PWM_ID_SET_POWER_STATE   0x09u
 
#define PWM_ID_GET_CURRENT_POWER_STATE   0x0au
 
#define PWM_ID_GET_TARGET_POWER_STATE   0x0bu
 
#define PWM_ID_PREPARE_POWER_STATE   0x0cu
 
#define PWM_ID_GET_VERSION_INFO   0x08u
 
#define PWM_E_INIT_FAILED   0x10u
 
#define PWM_E_UNINIT   0x11u
 
#define PWM_E_PARAM_CHANNEL   0x12u
 
#define PWM_E_PERIOD_UNCHANGEABLE   0x13u
 
#define PWM_E_ALREADY_INITIALIZED   0x14u
 
#define PWM_E_PARAM_POINTER   0x15u
 
#define PWM_E_POWER_STATE_NOT_SUPPORTED   0x17u
 
#define PWM_E_TRANSITION_NOT_POSSIBLE   0x18u
 
#define PWM_E_PERIPHERAL_NOT_PREPARED   0x19u
 
#define PWM_E_NOT_DISENGAGED   0x16u
 
#define PWM_STATIC   static
 

Typedefs

typedef uint32 Pwm_ChannelType
 Numeric identifier of a PWM channel.
 
typedef uint32 Pwm_PeriodType
 Definition of the period of a PWM channel.
 
typedef enum _Pwm_OutputStateType Pwm_OutputStateType
 Output state of a PWM channel.
 
typedef enum _Pwm_EdgeNotificationType Pwm_EdgeNotificationType
 Definition of the type of edge notification of a PWM channel.
 
typedef enum _Pwm_ChannelClassType Pwm_ChannelClassType
 Defines the class of a PWM channel.
 
typedef enum _Pwm_PowerStateRequestResultType Pwm_PowerStateRequestResultType
 Result of the requests related to power state transitions.
 
typedef enum _Pwm_PowerStateType Pwm_PowerStateType
 Power state currently active or set as target power state.
 
typedef struct _Pwm_ConfigType Pwm_ConfigType
 Hardware unit configuration structure
 
typedef struct _Pwm_HwUnit Pwm_HwUnit
 Hardware control unit structure
 

Enumerations

enum  _Pwm_OutputStateType { PWM_HIGH = 0x00 , PWM_LOW }
 Output state of a PWM channel. More...
 
enum  _Pwm_EdgeNotificationType { PWM_RISING_EDGE = 0x00 , PWM_FALLING_EDGE , PWM_BOTH_EDGES }
 Definition of the type of edge notification of a PWM channel. More...
 
enum  _Pwm_ChannelClassType { PWM_VARIABLE_PERIOD = 0x00 , PWM_FIXED_PERIOD , PWM_FIXED_PERIOD_SHIFTED }
 Defines the class of a PWM channel. More...
 
enum  _Pwm_PowerStateRequestResultType {
  PWM_SERVICE_ACCEPTED = 0x00 , PWM_NOT_INIT , PWM_SEQUENCE_ERROR , PWM_HW_FAILURE ,
  PWM_POWER_STATE_NOT_SUPP , PWM_TRANS_NOT_POSSIBLE
}
 Result of the requests related to power state transitions. More...
 
enum  _Pwm_PowerStateType { PWM_FULL_POWER = 0x00 }
 Power state currently active or set as target power state. More...
 
enum  Pwm_StatusType { PWM_STATE_UNINIT , PWM_STATE_INIT }
 PWM driver Status More...
 

Detailed Description

Pwm Driver Types

Author
Jazmin Melendrez

The header contains the type definitions that are used by the Pwm module. The file is implemented as a means of abstraction from the hardware, making the low level interfaces available for upper layers.

Typedef Documentation

◆ Pwm_ChannelClassType

Defines the class of a PWM channel.

Requirement
SWS_Pwm_00110

◆ Pwm_ChannelType

Numeric identifier of a PWM channel.

Requirement
SWS_Pwm_00106

◆ Pwm_ConfigType

Hardware unit configuration structure

This is the type of data structure containing the initialization data for the PWM driver. The contents of the initialization data structure are hardware specific.

Requirement
SWS_Pwm_00111

◆ Pwm_EdgeNotificationType

Definition of the type of edge notification of a PWM channel.

Requirement
SWS_Pwm_00109

◆ Pwm_HwUnit

typedef struct _Pwm_HwUnit Pwm_HwUnit

Hardware control unit structure

This structure contains the hardware unit configuration and the state of the hardware unit pointers to controller structures.

◆ Pwm_OutputStateType

Output state of a PWM channel.

Requirement
SWS_Pwm_00108

◆ Pwm_PeriodType

Definition of the period of a PWM channel.

Requirement
SWS_Pwm_00107

◆ Pwm_PowerStateRequestResultType

Result of the requests related to power state transitions.

Requirement
SWS_Pwm_00165

◆ Pwm_PowerStateType

Power state currently active or set as target power state.

Requirement
SWS_Pwm_00197

Enumeration Type Documentation

◆ _Pwm_ChannelClassType

Defines the class of a PWM channel.

Requirement
SWS_Pwm_00110
Enumerator
PWM_VARIABLE_PERIOD 

Variable Period. The duty cycle and the period can be changed.

PWM_FIXED_PERIOD 

Fixed Period. Only the duty cycle can be changed.

PWM_FIXED_PERIOD_SHIFTED 

TFixed Shifted Period. Impossible to change it

◆ _Pwm_EdgeNotificationType

Definition of the type of edge notification of a PWM channel.

Requirement
SWS_Pwm_00109
Enumerator
PWM_RISING_EDGE 

Notification will be called when a rising edge occurs on the PWM output signal.

PWM_FALLING_EDGE 

Notification will be called when a falling edge occurs on the PWM output signal.

PWM_BOTH_EDGES 

Notification will be called when either a rising edge or falling edge occur on the PWM output signal.

◆ _Pwm_OutputStateType

Output state of a PWM channel.

Requirement
SWS_Pwm_00108
Enumerator
PWM_HIGH 

The PWM channel is in high state

PWM_LOW 

The PWM channel is in low state

◆ _Pwm_PowerStateRequestResultType

Result of the requests related to power state transitions.

Requirement
SWS_Pwm_00165
Enumerator
PWM_SERVICE_ACCEPTED 

Power state change executed.

PWM_NOT_INIT 

PWM Module not initialized.

PWM_SEQUENCE_ERROR 

Wrong API call sequence.

PWM_HW_FAILURE 

Hardware failure prevents state change.

PWM_POWER_STATE_NOT_SUPP 

Power State not supported.

PWM_TRANS_NOT_POSSIBLE 

Transition not possible or HW busy.

◆ _Pwm_PowerStateType

Power state currently active or set as target power state.

Requirement
SWS_Pwm_00197
Enumerator
PWM_FULL_POWER 

Full Power

◆ Pwm_StatusType

PWM driver Status

This is the type of data structure containing the module state for the PWM driver.

Enumerator
PWM_STATE_UNINIT 

Pwm State Uninitialized

PWM_STATE_INIT 

Pwm State Initialized