brazos-trapezoidal
Macros | Functions | Variables
PWMDriver.c File Reference

Basic description of file contents. More...

#include "includes.h"
Include dependency graph for PWMDriver.c:

Go to the source code of this file.

Macros

#define BILLION   1000000000
 

Functions

void PWMDriver__Initialize (uint32_t pwm_frequency, uint32_t dead_time_ns, CB_TYPE cb)
 It Initializes the module PWMDriver and its variables. More...
 
void PWMDriver__ConfigOutput (void)
 Configures the PWM output pins. More...
 
void PWMDriver__ConfigPwm (uint16_t pwm_deadtime, uint16_t ADC_Advance_Delay_Syslks)
 Configures the PWM output peripheral. More...
 
void PWMDriver__SetPTIM (void *input)
 
void PWMDriver__StartTIM (void)
 Turn All PWM Off. More...
 
void PWMDriver__StopTIM (void)
 Turn All PWM Off. More...
 
void PWMDriver__AllOff (void)
 
void PWMDriver__LowersOn (void)
 Turn Lowers ON. More...
 
void PWMDriver__LoadAllPwmValues (unsigned short int pwm_a, unsigned short int pwm_b, unsigned short int pwm_c)
 Load All Pwm. More...
 
void PWMDriver__ConfigShutdown (void)
 Configures the Shutdown feature of PWM. More...
 
uint16_t PWMDriver__GetMaxPwm (void)
 Get the max PWM counts configured in the peripheral. More...
 
void PWMDriver__StopGD (void)
 

Variables

CB_TYPE CallBackFcnAtPwm = NULL
 
void * pTim
 
void * pTim0
 
void * pPwm0
 
void * pPwm1
 
void * pPwm2
 
void * pPwm3
 
const PWM_INIT_TYPE PWM_INIT [NUMBER_OF_MOTORS] = PWM_INITIALIZE_FUNCTIONS
 
const PWM_VOID_VOID_TYPE PWM_TURNONLOWSIDES [NUMBER_OF_MOTORS] = PWM_LOWERON_FUNCTIONS
 
const PWM_LOAD_ALL_TYPE PWM_LOADPWM [NUMBER_OF_MOTORS] = PWM_LOADALL_FUNCTIONS
 
const PWM_DISABLE_ENABLE_TYPE PWM_DISABLEPWM [NUMBER_OF_MOTORS] = PWM_DISABLE_FUNCTIONS
 
const PWM_DISABLE_ENABLE_TYPE PWM_ENABLEPWM [NUMBER_OF_MOTORS] = PWM_ENABLE_FUNCTIONS
 
const PWM_GET_MAX_TYPE PWM_GETMAXPWM [NUMBER_OF_MOTORS] = PWM_GETMAXPWM_FUNCTIONS
 
volatile uint32_t AllOffCnter
 Turn All PWM Off. More...
 

Detailed Description

Basic description of file contents.

Detailed description of the file contents

Version
Jun 8, 2020

Definition in file PWMDriver.c.

Macro Definition Documentation

◆ BILLION

#define BILLION   1000000000

Definition at line 29 of file PWMDriver.c.

Function Documentation

◆ PWMDriver__AllOff()

void PWMDriver__AllOff ( void  )

Definition at line 228 of file PWMDriver.c.

◆ PWMDriver__ConfigOutput()

void PWMDriver__ConfigOutput ( void  )

Configures the PWM output pins.

Definition at line 88 of file PWMDriver.c.

◆ PWMDriver__ConfigPwm()

void PWMDriver__ConfigPwm ( uint16_t  pwm_deadtime,
uint16_t  ADC_Advance_Delay_Syslks 
)

Configures the PWM output peripheral.

Definition at line 152 of file PWMDriver.c.

◆ PWMDriver__ConfigShutdown()

void PWMDriver__ConfigShutdown ( void  )

Configures the Shutdown feature of PWM.

Definition at line 304 of file PWMDriver.c.

◆ PWMDriver__GetMaxPwm()

uint16_t PWMDriver__GetMaxPwm ( void  )

Get the max PWM counts configured in the peripheral.

Note that this method uses a shadowed variable, which was set during the initialization of this module.

Returns
unsigned short int MaxPwm: Max PWM in timer counts.

Definition at line 347 of file PWMDriver.c.

◆ PWMDriver__Initialize()

void PWMDriver__Initialize ( uint32_t  pwm_frequency,
uint32_t  dead_time_ns,
CB_TYPE  cb 
)

It Initializes the module PWMDriver and its variables.

  • Overflow interrupt threshold, used to set the interrupt period. Since the timer is configured as TIM_CFG_MOD_DIV_TRI, there will be 2 counts (up and down) before an interrupt.
    Parameters
    -uint32_t pwm_threshlod
    -uint32_t pwm_deadtime
    -CB_TYPE cb
    Note
    - Ex. Sysclock Clock = 40Mz, PWM_TIM_DIV = 1, PWM_TIM_PER = 1250 (1/(40MHz/1))*1250*2 = 62.5us

Definition at line 63 of file PWMDriver.c.

◆ PWMDriver__LoadAllPwmValues()

void PWMDriver__LoadAllPwmValues ( unsigned short int  pwm_a,
unsigned short int  pwm_b,
unsigned short int  pwm_c 
)

Load All Pwm.

Definition at line 292 of file PWMDriver.c.

◆ PWMDriver__LowersOn()

void PWMDriver__LowersOn ( void  )

Turn Lowers ON.

Definition at line 260 of file PWMDriver.c.

◆ PWMDriver__SetPTIM()

void PWMDriver__SetPTIM ( void *  input)

Definition at line 197 of file PWMDriver.c.

◆ PWMDriver__StartTIM()

void PWMDriver__StartTIM ( void  )

Turn All PWM Off.

Definition at line 205 of file PWMDriver.c.

◆ PWMDriver__StopGD()

void PWMDriver__StopGD ( void  )

Definition at line 352 of file PWMDriver.c.

◆ PWMDriver__StopTIM()

void PWMDriver__StopTIM ( void  )

Turn All PWM Off.

Definition at line 216 of file PWMDriver.c.

Variable Documentation

◆ AllOffCnter

volatile uint32_t AllOffCnter

Turn All PWM Off.

Definition at line 227 of file PWMDriver.c.

◆ CallBackFcnAtPwm

CB_TYPE CallBackFcnAtPwm = NULL

-----------------------------— Theta Power Systems - CONFIDENTIAL --------------------------------------—

Definition at line 19 of file PWMDriver.c.

◆ pPwm0

void* pPwm0
extern

Pwm device pointer for ADC trig

Definition at line 91 of file main.c.

◆ pPwm1

void* pPwm1
extern

Pwm device pointer for pwm on U phase

Definition at line 92 of file main.c.

◆ pPwm2

void* pPwm2
extern

Pwm device pointer for pwm on W phase

Definition at line 94 of file main.c.

◆ pPwm3

void* pPwm3
extern

Pwm device pointer for pwm on V phase

Definition at line 93 of file main.c.

◆ pTim0

void* pTim0
extern

TIM device pointer for pwm generation (pwm1:U / pwm2:V / pwm3:W)

Definition at line 88 of file main.c.

◆ PWM_DISABLEPWM

const PWM_DISABLE_ENABLE_TYPE PWM_DISABLEPWM[NUMBER_OF_MOTORS] = PWM_DISABLE_FUNCTIONS

Definition at line 39 of file PWMDriver.c.

◆ PWM_ENABLEPWM

const PWM_DISABLE_ENABLE_TYPE PWM_ENABLEPWM[NUMBER_OF_MOTORS] = PWM_ENABLE_FUNCTIONS

Definition at line 40 of file PWMDriver.c.

◆ PWM_GETMAXPWM

const PWM_GET_MAX_TYPE PWM_GETMAXPWM[NUMBER_OF_MOTORS] = PWM_GETMAXPWM_FUNCTIONS

Definition at line 41 of file PWMDriver.c.

◆ PWM_INIT

const PWM_INIT_TYPE PWM_INIT[NUMBER_OF_MOTORS] = PWM_INITIALIZE_FUNCTIONS

Definition at line 36 of file PWMDriver.c.

◆ PWM_LOADPWM

const PWM_LOAD_ALL_TYPE PWM_LOADPWM[NUMBER_OF_MOTORS] = PWM_LOADALL_FUNCTIONS

Definition at line 38 of file PWMDriver.c.

◆ PWM_TURNONLOWSIDES

const PWM_VOID_VOID_TYPE PWM_TURNONLOWSIDES[NUMBER_OF_MOTORS] = PWM_LOWERON_FUNCTIONS

Definition at line 37 of file PWMDriver.c.