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 
7 {
8  Position = Pos;
9 }
10 
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 
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 
36 {
37  Pulse.detach();
38 }
void Disable()
Definition: SoftwarePWM.cpp:35
SoftwarePWM(PinName Pin)
Definition: SoftwarePWM.cpp:4
Ticker Pulse
Definition: SoftwarePWM.h:89
void EndPulse()
Definition: SoftwarePWM.cpp:24
void Enable(int StartPos, int Period)
Definition: SoftwarePWM.cpp:29
void SetPosition(int NewPos)
Definition: SoftwarePWM.cpp:6
Timeout PulseStop
Definition: SoftwarePWM.h:90
DigitalOut SoftwarePWMPin
Definition: SoftwarePWM.h:88
void StartPulse()
Definition: SoftwarePWM.cpp:11


rosserial_mbed
Author(s): Gary Servin
autogenerated on Mon Jun 10 2019 14:53:26