PwmOut: Add explicit pinmap support

pull/11892/head
Przemyslaw Stekiel 2019-08-26 11:28:54 +02:00
parent ce4a943350
commit db5c5b5fb0
2 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,12 @@ public:
*/
PwmOut(PinName pin);
/** Create a PwmOut connected to the specified pin
*
* @param pinmap reference to strucure which holds static pinmap.
*/
PwmOut(const PinMap &pinmap);
~PwmOut();
/** Set the output duty-cycle, specified as a percentage (float)

View File

@ -35,6 +35,13 @@ PwmOut::PwmOut(PinName pin) :
PwmOut::init();
}
PwmOut::PwmOut(const PinMap &pinmap) : _deep_sleep_locked(false)
{
core_util_critical_section_enter();
pwmout_init_direct(&_pwm, &pinmap);
core_util_critical_section_exit();
}
PwmOut::~PwmOut()
{
PwmOut::deinit();