Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
# Defined behavior * pwmout_init initializes the pwmout_t control structure * pwmout_free deinitializes the pwmout object * pwmout_write sets the output duty-cycle in range <0.0f, 1.0f> * pwmout_read returns the current float-point output duty-cycle in range <0.0f, 1.0f> * pwmout_period sets the PWM period specified in seconds, keeping the duty cycle the same * pwmout_period_ms sets the PWM period specified in miliseconds, keeping the duty cycle the same * pwmout_period_us sets the PWM period specified in microseconds, keeping the duty cycle the same * pwmout_pulsewidth sets the PWM pulsewidth specified in seconds, keeping the period the same * pwmout_pulsewidth_ms sets the PWM pulsewidth specified in miliseconds, keeping the period the same * pwmout_pulsewidth_us sets the PWM pulsewidth specified in microseconds, keeping the period the same * The accuracy of the PWM is +/- 10% * The PWM operations pwmout_write, pwmout_read, pwmout_read, pwmout_period_ms, pwmout_period_us pwmout_pulsewidth, pwmout_pulsewidth_ms, pwmout_pulsewidth_us take less than 20us to complete More...
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. | |
void | pwmout_init (pwmout_t *obj, PinName pin) |
Initialize the pwm out peripheral and configure the pin. | |
void | pwmout_free (pwmout_t *obj) |
Deinitialize the pwmout object. | |
void | pwmout_write (pwmout_t *obj, float percent) |
Set the output duty-cycle in range <0.0f, 1.0f> | |
float | pwmout_read (pwmout_t *obj) |
Read the current float-point output duty-cycle. | |
void | pwmout_period (pwmout_t *obj, float seconds) |
Set the PWM period specified in seconds, keeping the duty cycle the same. | |
void | pwmout_period_ms (pwmout_t *obj, int ms) |
Set the PWM period specified in miliseconds, keeping the duty cycle the same. | |
void | pwmout_period_us (pwmout_t *obj, int us) |
Set the PWM period specified in microseconds, keeping the duty cycle the same. | |
void | pwmout_pulsewidth (pwmout_t *obj, float seconds) |
Set the PWM pulsewidth specified in seconds, keeping the period the same. | |
void | pwmout_pulsewidth_ms (pwmout_t *obj, int ms) |
Set the PWM pulsewidth specified in miliseconds, keeping the period the same. | |
void | pwmout_pulsewidth_us (pwmout_t *obj, int us) |
Set the PWM pulsewidth specified in microseconds, keeping the period the same. | |
const PinMap * | pwmout_pinmap (void) |
Get the pins that support PWM. |
Detailed Description
# Defined behavior * pwmout_init initializes the pwmout_t control structure * pwmout_free deinitializes the pwmout object * pwmout_write sets the output duty-cycle in range <0.0f, 1.0f> * pwmout_read returns the current float-point output duty-cycle in range <0.0f, 1.0f> * pwmout_period sets the PWM period specified in seconds, keeping the duty cycle the same * pwmout_period_ms sets the PWM period specified in miliseconds, keeping the duty cycle the same * pwmout_period_us sets the PWM period specified in microseconds, keeping the duty cycle the same * pwmout_pulsewidth sets the PWM pulsewidth specified in seconds, keeping the period the same * pwmout_pulsewidth_ms sets the PWM pulsewidth specified in miliseconds, keeping the period the same * pwmout_pulsewidth_us sets the PWM pulsewidth specified in microseconds, keeping the period the same * The accuracy of the PWM is +/- 10% * The PWM operations pwmout_write, pwmout_read, pwmout_read, pwmout_period_ms, pwmout_period_us pwmout_pulsewidth, pwmout_pulsewidth_ms, pwmout_pulsewidth_us take less than 20us to complete
# Undefined behavior * Calling other function before pwmout_init * Calling pwmout_init with NC as pwmout pin
Function Documentation
void pwmout_free | ( | pwmout_t * | obj ) |
Deinitialize the pwmout object.
- Parameters:
-
obj The pwmout object
void pwmout_init | ( | pwmout_t * | obj, |
PinName | pin | ||
) |
Initialize the pwm out peripheral and configure the pin.
- Parameters:
-
obj The pwmout object to initialize pin The pwmout pin to initialize
void pwmout_init_direct | ( | pwmout_t * | obj, |
const PinMap * | pinmap | ||
) |
Initialize the pwm out peripheral and configure the pin.
- Parameters:
-
obj The pwmout object to initialize pinmap pointer to structure which holds static pinmap
Definition at line 36 of file static_pinmap.cpp.
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:
-
obj The pwmout object seconds The floating-point seconds period
void pwmout_period_ms | ( | pwmout_t * | obj, |
int | ms | ||
) |
Set the PWM period specified in miliseconds, keeping the duty cycle the same.
- Parameters:
-
obj The pwmout object ms The milisecond period
void pwmout_period_us | ( | pwmout_t * | obj, |
int | us | ||
) |
Set the PWM period specified in microseconds, keeping the duty cycle the same.
- Parameters:
-
obj The pwmout object us The microsecond period
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
void pwmout_pulsewidth | ( | pwmout_t * | obj, |
float | seconds | ||
) |
Set the PWM pulsewidth specified in seconds, keeping the period the same.
- Parameters:
-
obj The pwmout object seconds The floating-point pulsewidth in seconds
void pwmout_pulsewidth_ms | ( | pwmout_t * | obj, |
int | ms | ||
) |
Set the PWM pulsewidth specified in miliseconds, keeping the period the same.
- Parameters:
-
obj The pwmout object ms The floating-point pulsewidth in miliseconds
void pwmout_pulsewidth_us | ( | pwmout_t * | obj, |
int | us | ||
) |
Set the PWM pulsewidth specified in microseconds, keeping the period the same.
- Parameters:
-
obj The pwmout object us The floating-point pulsewidth in microseconds
float pwmout_read | ( | pwmout_t * | obj ) |
Read the current float-point output duty-cycle.
- Parameters:
-
obj The pwmout object
- Returns:
- A floating-point output duty-cycle
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:
-
obj The pwmout object percent The floating-point percentage number
Generated on Tue Jul 12 2022 13:55:25 by
