RoboidControl for Arduino
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Attributes | Static Protected Attributes | List of all members
Passer::RoboidControl::DRV8833Motor Class Reference

One motor port on the DRV8833 motor controller. More...

#include <DRV8833.h>

Inheritance diagram for Passer::RoboidControl::DRV8833Motor:
Passer::RoboidControl::Motor Passer::RoboidControl::Thing

Public Types

enum class  Direction { Clockwise = 1 , CounterClockwise = -1 }
 Motor turning direction. More...
 

Public Member Functions

 DRV8833Motor ()
 
 DRV8833Motor (byte pinIn1, byte pinIn2, Direction direction=Direction::Clockwise)
 Setup the DC motor.
 
void SetSpeed (float speed) override
 Set the motor speed.
 
virtual float GetSpeed ()
 Get the current target speed of the motor.
 
bool IsMotor ()
 Check if the Thing is a Motor.
 
bool IsSensor ()
 Check if the Thing is a Sensor.
 

Public Attributes

Direction direction = Direction::Clockwise
 The forward turning direction of the motor.
 
unsigned int type
 The type of Thing.
 

Static Public Attributes

static const unsigned int SwitchType = SensorType | (unsigned int)Type::Switch
 
static const unsigned int DistanceSensorType
 
static const unsigned int ControlledMotorType
 
static const unsigned int UncontrolledMotorType
 

Protected Types

enum class  Type {
  Undetermined , Switch , DistanceSensor , ControlledMotor ,
  UncontrolledMotor
}
 Basic Thing types. More...
 

Protected Attributes

byte pinIn1 = 0
 The pin number for the in1 signal.
 
byte pinIn2 = 0
 The pin number for the in2 signal.
 
float currentTargetSpeed = 0
 

Static Protected Attributes

static const unsigned int MotorType = 0x8000
 Bitmask for Motor type.
 
static const unsigned int SensorType = 0x4000
 Bitmap for Sensor type.
 

Detailed Description

One motor port on the DRV8833 motor controller.

Member Enumeration Documentation

◆ Direction

enum class Passer::RoboidControl::Motor::Direction
stronginherited

Motor turning direction.

Enumerator
Clockwise 
CounterClockwise 

◆ Type

enum class Passer::RoboidControl::Thing::Type
strongprotectedinherited

Basic Thing types.

Enumerator
Undetermined 
Switch 
DistanceSensor 
ControlledMotor 
UncontrolledMotor 

Constructor & Destructor Documentation

◆ DRV8833Motor() [1/2]

DRV8833Motor::DRV8833Motor ( )

◆ DRV8833Motor() [2/2]

DRV8833Motor::DRV8833Motor ( byte  pinIn1,
byte  pinIn2,
Direction  direction = Direction::Clockwise 
)

Setup the DC motor.

Parameters
pinIn1the pin number for the in1 signal
pinIn2the pin number for the in2 signal
directionthe forward turning direction of the motor

Member Function Documentation

◆ SetSpeed()

void DRV8833Motor::SetSpeed ( float  speed)
overridevirtual

Set the motor speed.

Parameters
speedSpeed between -1 (full reverse), 0 (stop) and 1 (full forward)

Reimplemented from Passer::RoboidControl::Motor.

◆ GetSpeed()

float Motor::GetSpeed ( )
virtualinherited

Get the current target speed of the motor.

Returns
The speed between -1 (full backward), 0 (stop) and 1 (full forward)

◆ IsMotor()

bool Thing::IsMotor ( )
inherited

Check if the Thing is a Motor.

Returns
True when the Thing is a Motor and False otherwise

◆ IsSensor()

bool Thing::IsSensor ( )
inherited

Check if the Thing is a Sensor.

Returns
True when the Thing is a Sensor and False otherwise

Member Data Documentation

◆ pinIn1

byte Passer::RoboidControl::DRV8833Motor::pinIn1 = 0
protected

The pin number for the in1 signal.

◆ pinIn2

byte Passer::RoboidControl::DRV8833Motor::pinIn2 = 0
protected

The pin number for the in2 signal.

◆ direction

Direction Passer::RoboidControl::Motor::direction = Direction::Clockwise
inherited

The forward turning direction of the motor.

◆ currentTargetSpeed

float Passer::RoboidControl::Motor::currentTargetSpeed = 0
protectedinherited

◆ type

unsigned int Passer::RoboidControl::Thing::type
inherited

The type of Thing.

◆ SwitchType

const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch
staticinherited

◆ DistanceSensorType

const unsigned int Thing::DistanceSensorType
staticinherited
Initial value:
=
static const unsigned int SensorType
Bitmap for Sensor type.
Definition Thing.h:31

◆ ControlledMotorType

const unsigned int Thing::ControlledMotorType
staticinherited
Initial value:
=
static const unsigned int MotorType
Bitmask for Motor type.
Definition Thing.h:29

◆ UncontrolledMotorType

const unsigned int Thing::UncontrolledMotorType
staticinherited

◆ MotorType

const unsigned int Passer::RoboidControl::Thing::MotorType = 0x8000
staticprotectedinherited

Bitmask for Motor type.

◆ SensorType

const unsigned int Passer::RoboidControl::Thing::SensorType = 0x4000
staticprotectedinherited

Bitmap for Sensor type.


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