File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,17 @@ class PwmOut {
118
118
*/
119
119
void pulsewidth_us (int us);
120
120
121
+ /* * Enable or disable PWM
122
+ *
123
+ * Control enabling of device's PWM. This is primarily intended
124
+ * for temporary power-saving; This call can
125
+ * allow pwm to be temporarily disabled to permit power saving without
126
+ * losing device state.
127
+ *
128
+ * @param enabled true to enable, false to disable.
129
+ */
130
+ void enable_pwm (bool enabled = true );
131
+
121
132
/* * A operator shorthand for write()
122
133
* \sa PwmOut::write()
123
134
*/
Original file line number Diff line number Diff line change @@ -98,6 +98,19 @@ void PwmOut::pulsewidth_us(int us)
98
98
core_util_critical_section_exit ();
99
99
}
100
100
101
+ void PwmOut::enable_pwm (bool enabled)
102
+ {
103
+ core_util_critical_section_enter ();
104
+ if (_deep_sleep_locked == enabled) {
105
+ if (enabled) {
106
+ PwmOut::unlock_deep_sleep ();
107
+ } else {
108
+ PwmOut::lock_deep_sleep ();
109
+ }
110
+ }
111
+ core_util_critical_section_exit ();
112
+ }
113
+
101
114
void PwmOut::lock_deep_sleep ()
102
115
{
103
116
if (_deep_sleep_locked == false ) {
You can’t perform that action at this time.
0 commit comments