InPlay API
PWM device driver

HAL_PWM. More...

Functions

void * hal_pwm_open (int id, int prio, void *arg, void(*callback)(void *))
 Open PWM driver. More...
 
int hal_pwm_close (void *hdl)
 Close PWM driver. More...
 
uint32_t hal_pwm_us_to_ticks (uint32_t us)
 Convert us to PWM ticks. More...
 
int hal_pwm_start (void *hdl, uint32_t period_ticks, uint32_t high_ticks)
 Start PWM
More...
 
int hal_pwm_stop (void *hdl)
 Stop PWM. More...
 
int hal_pwm_pause (void *hdl)
 Pause PWM. When PWM is paused, can't go to deep sleep. More...
 
int hal_pwm_resume (void *hdl)
 Resume PWM. More...
 
int hal_pwm_update (void *hdl, uint32_t period_ticks, uint32_t high_ticks)
 Update PWM period and high time. More...
 
int hal_pwm_update_high_duration (void *hdl, uint32_t high_ticks)
 Update PWM high time. More...
 

Detailed Description

HAL_PWM.

Function Documentation

◆ hal_pwm_close()

int hal_pwm_close ( void *  hdl)

Close PWM driver.

Parameters
[in]hdlPWM handle from the open API
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_open()

void* hal_pwm_open ( int  id,
int  prio,
void *  arg,
void(*)(void *)  callback 
)

Open PWM driver.

Parameters
[in]idPWM Id,
See also
enum pwm_id.
Parameters
[in]prioInterrupt Priority
[in]argPWM call back function argument
[in]callbackPWM call back function for period done interrupt
Returns
PWM driver handle if successful; NULL otherwise

◆ hal_pwm_pause()

int hal_pwm_pause ( void *  hdl)

Pause PWM. When PWM is paused, can't go to deep sleep.

Parameters
[in]hdlPWM handle from the open API
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_resume()

int hal_pwm_resume ( void *  hdl)

Resume PWM.

Parameters
[in]hdlPWM handle from the open API
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_start()

int hal_pwm_start ( void *  hdl,
uint32_t  period_ticks,
uint32_t  high_ticks 
)

Start PWM

Note
This function can generate interrupt if "callback" function is not NULL.
Parameters
[in]hdlPWM handle from the open API
[in]period_ticksPWM period ticks
[in]high_ticksPWM high ticks
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_stop()

int hal_pwm_stop ( void *  hdl)

Stop PWM.

Parameters
[in]hdlPWM handle from the open API
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_update()

int hal_pwm_update ( void *  hdl,
uint32_t  period_ticks,
uint32_t  high_ticks 
)

Update PWM period and high time.

Parameters
[in]hdlPWM handle from the open API
[in]period_ticksPWM period ticks
[in]high_ticksPWM high ticks
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_update_high_duration()

int hal_pwm_update_high_duration ( void *  hdl,
uint32_t  high_ticks 
)

Update PWM high time.

Parameters
[in]hdlPWM handle from the open API
[in]high_ticksPWM high ticks
Returns
Driver error return code,
See also
enum pwm_err

◆ hal_pwm_us_to_ticks()

uint32_t hal_pwm_us_to_ticks ( uint32_t  us)

Convert us to PWM ticks.

Parameters
[in]usmicrosecond
Returns
PWM ticks