Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 54aba46

Browse files
author
ColinA-MSFT
committed
Merge pull request #182 from ColinA-MSFT/PwmFixes
Fix PWM issues.
2 parents e496d67 + 1c76f3a commit 54aba46

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

DeviceCode/include/PWM_decl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ enum PWM_CHANNEL
2121
PWM_CHANNEL_5 = 5,
2222
PWM_CHANNEL_6 = 6,
2323
PWM_CHANNEL_7 = 7,
24+
PWM_CHANNEL_8 = 8,
25+
PWM_CHANNEL_9 = 9,
26+
PWM_CHANNEL_10 = 10,
27+
PWM_CHANNEL_11 = 11,
28+
PWM_CHANNEL_12 = 12,
29+
PWM_CHANNEL_13 = 13,
30+
PWM_CHANNEL_14 = 14,
31+
PWM_CHANNEL_15 = 15,
2432
};
2533

2634
enum PWM_SCALE_FACTOR

Framework/Core/Native_Hardware/Cpu.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public enum Pin : int
6060

6161
public enum PWMChannel : int
6262
{
63-
PWM_NONE = -1,
63+
PWM_NONE = -1,
6464
PWM_0 = 0,
6565
PWM_1 = 1,
6666
PWM_2 = 2,
@@ -69,6 +69,14 @@ public enum PWMChannel : int
6969
PWM_5 = 5,
7070
PWM_6 = 6,
7171
PWM_7 = 7,
72+
PWM_8 = 8,
73+
PWM_9 = 9,
74+
PWM_10 = 10,
75+
PWM_11 = 11,
76+
PWM_12 = 12,
77+
PWM_13 = 13,
78+
PWM_14 = 14,
79+
PWM_15 = 15,
7280
}
7381

7482
public enum AnalogChannel : int

Framework/Core/Native_Hardware/Native_PWM/PWM.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Microsoft.SPOT.Hardware;
33
using System.Runtime.CompilerServices;
44

5-
65
namespace Microsoft.SPOT.Hardware
76
{
87
/// <summary>
@@ -43,6 +42,10 @@ public enum ScaleFactor : uint
4342
/// Scale of the period/duration (mS, uS, nS)
4443
/// </summary>
4544
private ScaleFactor m_scale;
45+
/// <summary>
46+
/// Whether this object has been disposed.
47+
/// </summary>
48+
private bool m_disposed = false;
4649

4750
//--//
4851

@@ -129,7 +132,12 @@ public PWM(Cpu.PWMChannel channel, uint period, uint duration, ScaleFactor scale
129132
/// </summary>
130133
public void Dispose()
131134
{
132-
Dispose(true);
135+
if (!m_disposed)
136+
{
137+
Dispose(true);
138+
GC.SuppressFinalize(this);
139+
m_disposed = true;
140+
}
133141
}
134142

135143
/// <summary>

0 commit comments

Comments
 (0)