Skip to content

Commit fe1d458

Browse files
committed
2 parents e548c43 + 411b292 commit fe1d458

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

include/pwm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef enum
7373
////////////////////////////
7474
void pwm_configure(uint8_t pwm_config_options);
7575
void pwm_start(pwm_channel_t pwm_channel, uint8_t pwm_duty_cycle);
76+
void pwm_stop(pwm_channel_t pwm_channel);
7677

7778

7879
#endif /* PWM_H_ */

src/pwm/src/pwm_start.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
// void pwm_start(pwm_channel_t pwm_channel, uint8_t pwm_duty_cycle)
3535
//
3636
// Description:
37-
// Starts an ADC conversion on the specified ADC channel
37+
// Starts a PWM conversion on the specified PWM channel
3838
//
3939
// Parameters:
40-
// adc_channel_t adc_channel - ADC channel with which to run the acquisition
40+
// pwm_channel_t pwm_channel - PWM channel with which to run the acquisition
4141
// uint8_t pwm_duty_cycle - duty cycle at which the PWM should run
4242
//
4343
// Return value:

src/pwm/src/pwm_stop.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/////////////////////////////////////////////////////////////////////////////
2+
//
3+
// File: pwm_stop.c
4+
//
5+
// Copyright Aleksandr Svalov (Alarus), 2014
6+
//
7+
// The author provides no guarantees, warantees, or promises, implied or
8+
// otherwise. By using this software you agree to indemnify the author
9+
// of any damages incurred by using it.
10+
//
11+
/////////////////////////////////////////////////////////////////////////////
12+
13+
/////////////////////////////////////////////////////////////////////////////
14+
// This library is free software; you can redistribute it and/or
15+
// modify it under the terms of the GNU Lesser General Public
16+
// License as published by the Free Software Foundation; either
17+
// version 2.1 of the License, or (at your option) any later version.
18+
//
19+
// This library is distributed in the hope that it will be useful,
20+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22+
// Lesser General Public License for more details.
23+
//
24+
// You should have received a copy of the GNU Lesser General Public
25+
// License along with this library; if not, write to the Free Software
26+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27+
/////////////////////////////////////////////////////////////////////////////
28+
29+
#include "pwm.h"
30+
31+
32+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
33+
//
34+
// void pwm_stop(pwm_channel_t pwm_channel)
35+
//
36+
// Description:
37+
// Stop a PWM conversion on the specified PWM channel
38+
//
39+
// Parameters:
40+
// pwm_channel_t pwm_channel - PWM channel with which to stop the acquisition
41+
//
42+
// Return value:
43+
// None
44+
//
45+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46+
void pwm_stop(pwm_channel_t pwm_channel)
47+
{
48+
//Disable the PWM for the requested channel
49+
if(pwm_channel == PWM_CHANNEL_0)
50+
{
51+
reg_bits_clear(PWMCON, PWMCON_PWM0_ENABLE);
52+
}
53+
else
54+
{
55+
reg_bits_clear(PWMCON, PWMCON_PWM1_ENABLE);
56+
}
57+
}

0 commit comments

Comments
 (0)