Mbed OS Reference
Loading...
Searching...
No Matches
Pwmout hal functions

Modules

 GPIO IRQ HAL tests
 The Pwmout HAL tests ensure driver conformance to defined behaviour.
 

Functions

void pwmout_init_direct (pwmout_t *obj, const PinMap *pinmap)
 Initialize the pwm out peripheral and configure the pin. More...
 
void pwmout_init (pwmout_t *obj, PinName pin)
 Initialize the pwm out peripheral and configure the pin. More...
 
void pwmout_free (pwmout_t *obj)
 Deinitialize the pwmout object. More...
 
void pwmout_write (pwmout_t *obj, float percent)
 Set the output duty-cycle in range <0.0f, 1.0f> More...
 
float pwmout_read (pwmout_t *obj)
 Read the current float-point output duty-cycle. More...
 
void pwmout_period (pwmout_t *obj, float seconds)
 Set the PWM period specified in seconds, keeping the duty cycle the same. More...
 
void pwmout_period_ms (pwmout_t *obj, int ms)
 Set the PWM period specified in miliseconds, keeping the duty cycle the same. More...
 
void pwmout_period_us (pwmout_t *obj, int us)
 Set the PWM period specified in microseconds, keeping the duty cycle the same. More...
 
int pwmout_read_period_us (pwmout_t *obj)
 Read the PWM period specified in microseconds. More...
 
void pwmout_pulsewidth (pwmout_t *obj, float seconds)
 Set the PWM pulsewidth specified in seconds, keeping the period the same. More...
 
void pwmout_pulsewidth_ms (pwmout_t *obj, int ms)
 Set the PWM pulsewidth specified in miliseconds, keeping the period the same. More...
 
void pwmout_pulsewidth_us (pwmout_t *obj, int us)
 Set the PWM pulsewidth specified in microseconds, keeping the period the same. More...
 
int pwmout_read_pulsewidth_us (pwmout_t *obj)
 Read the PWM pulsewidth specified in microseconds. More...
 
const PinMappwmout_pinmap (void)
 Get the pins that support PWM. More...
 

Detailed Description

Defined behavior

Undefined behavior

Function Documentation

◆ pwmout_init_direct()

void pwmout_init_direct ( pwmout_t obj,
const PinMap pinmap 
)

Initialize the pwm out peripheral and configure the pin.

Parameters
objThe pwmout object to initialize
pinmappointer to structure which holds static pinmap

◆ pwmout_init()

void pwmout_init ( pwmout_t obj,
PinName  pin 
)

Initialize the pwm out peripheral and configure the pin.

Parameters
objThe pwmout object to initialize
pinThe pwmout pin to initialize

◆ pwmout_free()

void pwmout_free ( pwmout_t obj)

Deinitialize the pwmout object.

Parameters
objThe pwmout object

◆ pwmout_write()

void pwmout_write ( pwmout_t obj,
float  percent 
)

Set the output duty-cycle in range <0.0f, 1.0f>

Value 0.0f represents 0 percentage, 1.0f represents 100 percent.

Parameters
objThe pwmout object
percentThe floating-point percentage number

◆ pwmout_read()

float pwmout_read ( pwmout_t obj)

Read the current float-point output duty-cycle.

Parameters
objThe pwmout object
Returns
A floating-point output duty-cycle

◆ pwmout_period()

void pwmout_period ( pwmout_t obj,
float  seconds 
)

Set the PWM period specified in seconds, keeping the duty cycle the same.

Periods smaller than microseconds (the lowest resolution) are set to zero.

Parameters
objThe pwmout object
secondsThe floating-point seconds period

◆ pwmout_period_ms()

void pwmout_period_ms ( pwmout_t obj,
int  ms 
)

Set the PWM period specified in miliseconds, keeping the duty cycle the same.

Parameters
objThe pwmout object
msThe milisecond period

◆ pwmout_period_us()

void pwmout_period_us ( pwmout_t obj,
int  us 
)

Set the PWM period specified in microseconds, keeping the duty cycle the same.

Parameters
objThe pwmout object
usThe microsecond period

◆ pwmout_read_period_us()

int pwmout_read_period_us ( pwmout_t obj)

Read the PWM period specified in microseconds.

Parameters
objThe pwmout object
Returns
A int output period

◆ pwmout_pulsewidth()

void pwmout_pulsewidth ( pwmout_t obj,
float  seconds 
)

Set the PWM pulsewidth specified in seconds, keeping the period the same.

Parameters
objThe pwmout object
secondsThe floating-point pulsewidth in seconds

◆ pwmout_pulsewidth_ms()

void pwmout_pulsewidth_ms ( pwmout_t obj,
int  ms 
)

Set the PWM pulsewidth specified in miliseconds, keeping the period the same.

Parameters
objThe pwmout object
msThe floating-point pulsewidth in miliseconds

◆ pwmout_pulsewidth_us()

void pwmout_pulsewidth_us ( pwmout_t obj,
int  us 
)

Set the PWM pulsewidth specified in microseconds, keeping the period the same.

Parameters
objThe pwmout object
usThe floating-point pulsewidth in microseconds

◆ pwmout_read_pulsewidth_us()

int pwmout_read_pulsewidth_us ( pwmout_t obj)

Read the PWM pulsewidth specified in microseconds.

Parameters
objThe pwmout object
Returns
A int output pulsewidth

◆ pwmout_pinmap()

const PinMap * pwmout_pinmap ( void  )

Get the pins that support PWM.

Return a PinMap array of pins that support PWM. The array is terminated with {NC, NC, 0}.

Returns
PinMap array