NXPCUP-libary
Library for car's control board on NXPCUP competition based on the Mbed framework.
Classes | List of all members
nxpcup::Servo Class Reference

#include <Servo.h>

Classes

struct  Config
 
 Servo (Config config)
 
 Servo (PinName pin, uint16_t minUs=1000, uint16_t maxUs=2000)
 
void setAngleCorrection (int8_t angle)
 
void setAngleMinMax (uint8_t min, uint8_t max)
 
void setAngleMinMaxCenter (uint8_t diffAngle)
 
void setAngle (uint8_t degree)
 
void setAngleCenter (int8_t degree, bool reverse=false)
 
uint8_t angle () const
 
int8_t centerAngle () const
 
int getMinAngle () const
 
int getMaxAngle () const
 

Constructor & Destructor Documentation

nxpcup::Servo::Servo ( Config  config)
inline

Constructor for Servo class.

Parameters
configstructureConfig}
nxpcup::Servo::Servo ( PinName  pin,
uint16_t  minUs = 1000,
uint16_t  maxUs = 2000 
)
inline

Constructor for Servo class.

Parameters
pinNamename of the servo pin
minUsminimal pulse wide (default pulse for 0 degree)
minUsmaximal pulse wide (default pulse for 180 degree)

Member Function Documentation

uint8_t nxpcup::Servo::angle ( ) const
inline

Get last set angle - value could be clamped inangle()}

int8_t nxpcup::Servo::centerAngle ( ) const
inline

Get last center set angle - value could be clamped inangle()}

int nxpcup::Servo::getMaxAngle ( ) const
inline

Get maximal allowed angle.

Set in constructor or with functionsangleMinMax},angleMinMaxCenter}.

int nxpcup::Servo::getMinAngle ( ) const
inline

Get minimal allowed angle.

Set in constructor or with functionsangleMinMax},angleMinMaxCenter}.

void nxpcup::Servo::setAngle ( uint8_t  degree)
inline

Set position of the servo in degree.

Parameters
degreein range (0 <-> 180)
void nxpcup::Servo::setAngleCenter ( int8_t  degree,
bool  reverse = false 
)
inline

Set position of the servo in degree around center (middle position).

Parameters
degreein range (-90 <-> 90) - not checked by this function
reversethe range (0 = 0, 90 => -90, -90 => 90)
void nxpcup::Servo::setAngleCorrection ( int8_t  angle)
inline

Set correction angle for functions working with angle.

Parameters
anglewhich will be add to the set angle
void nxpcup::Servo::setAngleMinMax ( uint8_t  min,
uint8_t  max 
)
inline

Set minimal and maximal allowed angle.

Parameters
minsuggested range (0 <-> 180) - not checked by this function
maxsuggested range (0 <-> 180) - not checked by this function
void nxpcup::Servo::setAngleMinMaxCenter ( uint8_t  diffAngle)
inline

Set maximal allowed angle from center (middle).

Parameters
diffAngleallowed +- range from center suggested range (0 <-> 90) - not checked by this function

The documentation for this class was generated from the following file: