Main Page
Namespaces
Classes
Files
File List
File Members
src
examples
MotorShield
SoftwarePWM
SoftwarePWM.cpp
Go to the documentation of this file.
1
#include "
SoftwarePWM.h
"
2
#include "mbed.h"
3
4
SoftwarePWM::SoftwarePWM
(PinName Pin) : SoftwarePWMPin(Pin) {}
5
6
void
SoftwarePWM::SetPosition
(
int
Pos)
7
{
8
Position
= Pos;
9
}
10
11
void
SoftwarePWM::StartPulse
()
12
{
13
if
(
Position
<= 0)
14
{
15
SoftwarePWMPin
= 0 ;
16
}
17
else
18
{
19
SoftwarePWMPin
= 1;
20
PulseStop
.attach_us(
this
, &
SoftwarePWM::EndPulse
,
Position
);
21
}
22
}
23
24
void
SoftwarePWM::EndPulse
()
25
{
26
SoftwarePWMPin
= 0;
27
}
28
29
void
SoftwarePWM::Enable
(
int
StartPos,
int
Period)
30
{
31
Position
= StartPos;
32
Pulse
.attach_us(
this
, &
SoftwarePWM::StartPulse
, Period);
33
}
34
35
void
SoftwarePWM::Disable
()
36
{
37
Pulse
.detach();
38
}
SoftwarePWM::Disable
void Disable()
Definition:
SoftwarePWM.cpp:35
SoftwarePWM::SoftwarePWM
SoftwarePWM(PinName Pin)
Definition:
SoftwarePWM.cpp:4
SoftwarePWM::Pulse
Ticker Pulse
Definition:
SoftwarePWM.h:89
SoftwarePWM::Position
int Position
Definition:
SoftwarePWM.h:87
SoftwarePWM::EndPulse
void EndPulse()
Definition:
SoftwarePWM.cpp:24
SoftwarePWM::Enable
void Enable(int StartPos, int Period)
Definition:
SoftwarePWM.cpp:29
SoftwarePWM::SetPosition
void SetPosition(int NewPos)
Definition:
SoftwarePWM.cpp:6
SoftwarePWM::PulseStop
Timeout PulseStop
Definition:
SoftwarePWM.h:90
SoftwarePWM.h
SoftwarePWM::SoftwarePWMPin
DigitalOut SoftwarePWMPin
Definition:
SoftwarePWM.h:88
SoftwarePWM::StartPulse
void StartPulse()
Definition:
SoftwarePWM.cpp:11
rosserial_mbed
Author(s): Gary Servin
autogenerated on Fri Jun 7 2019 22:02:48