QuadroCopter  0.1.4
quadro::pwm::dji_2212 Class Reference

#include <dji_2212.h>

Inheritance diagram for quadro::pwm::dji_2212:
quadro::pwm::motors quadro::pwm::pwmDevice quadro::IDevice quadro::pwm::pwmOverlay

Public Member Functions

 dji_2212 (pinBlocks _block, PWMPins _pin)
 
void init ()
 
void setDuty (long _duty)
 
void setPeriod (long _period)
 
void setRun (int _run)
 
void setPolarity (int _polarity)
 
- Public Member Functions inherited from quadro::pwm::motors
 motors ()
 
 motors (pinBlocks _block, PWMPins _pin)
 
void setTargetSpeed (long _targetSpeed)
 
void reversePolarity ()
 
void start ()
 
void stop ()
 
- Public Member Functions inherited from quadro::pwm::pwmDevice
 pwmDevice ()
 
 pwmDevice (pinBlocks _block, PWMPins _pin) throw ( pwmSetupException& )
 
long get (valType _vt)
 
void set (valType _vt, long _val)
 
void setPinNum (PWMPins _pin)
 
void setBlockNum (pinBlocks _block)
 
- Public Member Functions inherited from quadro::IDevice
virtual ~IDevice ()
 

Additional Inherited Members

- Public Types inherited from quadro::pwm::pwmDevice
enum  valType {
  Run, Duty, Period, Polarity,
  Power_Control, Power_RunTime_Active, Power_RunTime_Suspended
}
 
- Public Attributes inherited from quadro::pwm::motors
long currentDuty
 Storage for the current Duty value. More...
 
long currentPeriod
 Storage for the current Period value. More...
 
int currentRun
 Storage for the current Run value. More...
 
int currentPolarity
 Storage for the current Polarity value. More...
 
- Public Attributes inherited from quadro::pwm::pwmDevice
pinBlocks blockNum
 stores the PWM device block num More...
 
PWMPins pinNum
 stores the PWM device pin num More...
 
string powerControlStr
 stores the current power setting string More...
 
- Protected Member Functions inherited from quadro::pwm::motors
long getMaxSpeed ()
 
long getMinSpeed ()
 
int getSpeedStep ()
 
void setMaxSpeed (long _maxSpeed)
 
void setMinSpeed (long _minSpeed)
 
void setSpeedStep (int _speedStep)
 

Detailed Description

Class for running DJI_2212 motors, extends the motors class

Constructor & Destructor Documentation

dji_2212::dji_2212 ( pinBlocks  _block,
PWMPins  _pin 
)

Public entry point for running a DJI_2212 motor, set the Block and Pin number in the constructor.

Parameters
pinBlock_block
PWMPins_pin
25  :motors( _block, _pin )
26 {
27 
28  setMaxSpeed( MAX_DUTY );
29  setMinSpeed( MIN_DUTY );
30  setSpeedStep( DEFAULT_SPEED_STEP );
31  setPeriod( DEFAULT_PERIOD );
32  setDuty( getMinSpeed());
33  setPolarity( 1 );
34 
35 }
void setMinSpeed(long _minSpeed)
Definition: motors.cpp:121
void setPeriod(long _period)
Definition: dji_2212.cpp:51
void setSpeedStep(int _speedStep)
Definition: motors.cpp:131
long getMinSpeed()
Definition: motors.cpp:111
motors()
Definition: motors.h:37
void setDuty(long _duty)
Definition: dji_2212.cpp:45
void setMaxSpeed(long _maxSpeed)
Definition: motors.cpp:126
void setPolarity(int _polarity)
Definition: dji_2212.cpp:63

Member Function Documentation

void dji_2212::init ( )

This method will set the basic settings to initialise the motor, this will normally result in the motor spinning slowly.

38 {
39  setPeriod( DEFAULT_PERIOD );
40  setTargetSpeed( SPIN_SLOWSPEED );
41  setRun( 1 );
42  start();
43 }
void setPeriod(long _period)
Definition: dji_2212.cpp:51
void setTargetSpeed(long _targetSpeed)
Definition: motors.cpp:31
void start()
Definition: motors.cpp:81
void setRun(int _run)
Definition: dji_2212.cpp:57
void dji_2212::setDuty ( long  _duty)

Set the motors duty value

Parameters
_duty
46 {
47  currentDuty = _duty;
48  set( Duty, currentDuty );
49 }
void set(valType _vt, long _val)
Definition: pwmDevice.cpp:111
long currentDuty
Storage for the current Duty value.
Definition: motors.h:73
Duty Value Type.
Definition: pwmDevice.h:62
void dji_2212::setPeriod ( long  _period)

Set the motors Period value here

Parameters
_period
52 {
53  currentPeriod = _period;
55 }
void set(valType _vt, long _val)
Definition: pwmDevice.cpp:111
Period Value Type.
Definition: pwmDevice.h:63
long currentPeriod
Storage for the current Period value.
Definition: motors.h:74
void dji_2212::setPolarity ( int  _polarity)

Set the motors Polarity here.

Parameters
_polarity
64 {
65  currentPolarity = _polarity;
67 }
Polarity Value Type.
Definition: pwmDevice.h:64
void set(valType _vt, long _val)
Definition: pwmDevice.cpp:111
int currentPolarity
Storage for the current Polarity value.
Definition: motors.h:76
void dji_2212::setRun ( int  _run)

Set the motors Run value here

Parameters
_run
58 {
59  currentRun = _run;
60  set( Run, currentRun );
61 }
void set(valType _vt, long _val)
Definition: pwmDevice.cpp:111
int currentRun
Storage for the current Run value.
Definition: motors.h:75
Run Value Type.
Definition: pwmDevice.h:61

The documentation for this class was generated from the following files:
  • /Users/michaelbrookes/ClionProjects/Quadro/lib/pwm/motors/dji_2212/dji_2212.h
  • /Users/michaelbrookes/ClionProjects/Quadro/lib/pwm/motors/dji_2212/dji_2212.cpp