20 #include "platform/platform.h" 22 #if DEVICE_PWMOUT || defined(DOXYGEN_ONLY) 23 #include "hal/pwmout_api.h" 24 #include "platform/mbed_critical.h" 25 #include "platform/mbed_power_mgmt.h" 61 PwmOut(PinName pin) : _deep_sleep_locked(false)
205 void lock_deep_sleep()
207 if (_deep_sleep_locked ==
false) {
208 sleep_manager_lock_deep_sleep();
209 _deep_sleep_locked =
true;
214 void unlock_deep_sleep()
216 if (_deep_sleep_locked ==
true) {
217 sleep_manager_unlock_deep_sleep();
218 _deep_sleep_locked =
false;
223 bool _deep_sleep_locked;
void pwmout_period_us(pwmout_t *obj, int us)
Set the PWM period specified in microseconds, keeping the duty cycle the same.
void write(float value)
Set the output duty-cycle, specified as a percentage (float)
void pwmout_pulsewidth_ms(pwmout_t *obj, int ms)
Set the PWM pulsewidth specified in miliseconds, keeping the period the same.
PwmOut(PinName pin)
Create a PwmOut connected to the specified pin.
void pulsewidth_us(int us)
Set the PWM pulsewidth, specified in microseconds (int), keeping the period the same.
A pulse-width modulation digital output.
void pwmout_write(pwmout_t *obj, float percent)
Set the output duty-cycle in range <0.0f, 1.0f>
float read()
Return the current output duty-cycle setting, measured as a percentage (float)
void period_us(int us)
Set the PWM period, specified in microseconds (int), keeping the duty cycle the same.
void pwmout_pulsewidth_us(pwmout_t *obj, int us)
Set the PWM pulsewidth specified in microseconds, keeping the period the same.
void pwmout_period(pwmout_t *obj, float seconds)
Set the PWM period specified in seconds, keeping the duty cycle the same.
void pwmout_init(pwmout_t *obj, PinName pin)
Initialize the pwm out peripheral and configure the pin.
void period_ms(int ms)
Set the PWM period, specified in milliseconds (int), 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 period(float seconds)
Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
void pulsewidth(float seconds)
Set the PWM pulsewidth, specified in seconds (float), keeping the period the same.
float pwmout_read(pwmout_t *obj)
Read the current float-point output duty-cycle.
struct pwmout_s pwmout_t
Pwmout hal structure.
void pwmout_pulsewidth(pwmout_t *obj, float seconds)
Set the PWM pulsewidth specified in seconds, keeping the period the same.
PwmOut & operator=(float value)
A operator shorthand for write()
void pulsewidth_ms(int ms)
Set the PWM pulsewidth, specified in milliseconds (int), keeping the period the same.
void pwmout_free(pwmout_t *obj)
Deinitialize the pwmout object.