API Documentation

class DriveMaster
#include <DriveMaster.h>

Base class for motor control.

Subclassed by HBridge

Public Functions

DriveMaster(int pin)

Construct a new DriveMaster object with only the pin.

Parameters:

pin – The pin number for motor control.

DriveMaster(int pin, int dir_pin)

Construct a new DriveMaster object with the specified pin and direction pin.

Parameters:
  • pin – The pin number for motor control.

  • dir_pin – The pin number for direction control.

virtual ~DriveMaster()

Destroy the DriveMaster object.

virtual void begin()

Initialize the motor control.

virtual void write(uint16_t value, bool telemetery = false)

Write a command to the motor.

Parameters:
  • value – The command value to write.

  • telemetry – Flag indicating telemetry presence.

virtual void write(int16_t value)

Write a command to the motor using an 8-bit signed integer value. The value ranges from -255 to 255, where:

  • 255 is full speed forward

  • -255 is full speed reverse

  • 0 is stop

Parameters:

value – The signed 8-bit command value to write (-255 to 255).

virtual void sendCommand(uint16_t value)

Send a command to the motor.

Parameters:

value – The command value to send.

virtual void sendValue(uint16_t value)

Send a value to the motor.

Parameters:

value – The value to send.

Protected Attributes

int _pin

Pin number for motor control.

int _dir_pin

Pin number for direction control.

class HBridge : public DriveMaster
#include <HBridge.h>

A class to control an H-Bridge motor driver.

The HBridge class provides methods to initialize and control the speed and direction of a motor using an H-Bridge. It inherits from the DriveMaster base class, which provides the control pins.

Public Functions

explicit HBridge(int pin, int dir_pin)

Constructs an HBridge object with specified control pins.

Parameters:
  • pin – The PWM pin used for controlling motor speed (inherited from DriveMaster).

  • dir_pin – The direction control pin (inherited from DriveMaster).

virtual void begin() override

Initializes the H-Bridge driver.

Sets up the necessary pin modes for motor control.

virtual void write(int16_t value) override

Writes a speed value to the motor.

The value controls both the speed and direction of the motor. Positive values set forward direction, while negative values set reverse direction. The value is constrained between -255 and 255.

Parameters:

value – The speed value to write, where 0 is stopped, 255 is full forward, and -255 is full reverse.

module conf

Variables

shell
project = "DriveMaster"
copyright = "2025, Witty-Wizard"
author = "Witty-Wizard"
release = "0.0.3"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "breathe", "sphinx_copybutton"]
templates_path = ["_templates"]
exclude_patterns = []
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
breathe_projects = {"DriveMaster": "../xml"}
breathe_default_project = "DriveMaster"
html_theme_options = {"style_external_links": True,  # Adds an external link icon"navigation_depth": 4,"prev_next_buttons_location": "bottom","collapse_navigation": False,"sticky_navigation": True,}
html_context = {"display_github": True,"github_user": "Witty-Wizard","github_repo": "DriveMaster","github_version": "main","conf_py_path": "/Docs/source/",  # Adjust based on repo structure}
file conf.py
file DriveMaster.cpp
#include “DriveMaster.h
file DriveMaster.h
#include <Arduino.h>
#include “dshot.h
#include “HBridge.h

Header file for the DriveMaster class.

Defines

DRIVEMASTER_H
file dshot.cpp
#include “dshot.h
file dshot.h
#include “DriveMaster.h

Header file for the dshot class.

Defines

DSHOT_H
file HBridge.cpp
#include <HBridge.h>
file HBridge.h
#include “DriveMaster.h

Header file for the HBridge class, which controls an H-Bridge motor driver.

Defines

HBRIDGE_H
dir Docs
dir Docs/source
dir src