Skip to content

File syn_motor_output.h

FileList > motor > syn_motor_output.h

Go to the source code of this file

Abstract motor output interface. More...

  • #include <stdint.h>

Classes

Type Name
struct SYN_MotorOutput
Abstract motor output interface (vtable).

Detailed Description

Decouples the motor controller from specific motor drivers. Any motor (DC, stepper, brushless, etc.) implements this three-function interface and can be driven by syn_motor_ctrl.

** **

// DC motor — use the factory:
SYN_MotorOutput out = syn_dc_motor_output(&my_dc);

// Custom motor — wire directly:
SYN_MotorOutput out = {
    .set_output = my_motor_set_output,
    .coast      = my_motor_coast,
    .brake      = my_motor_brake,
    .ctx        = &my_motor,
};

// Pass to motor controller:
cfg.motor = out;

The documentation for this class was generated from the following file src/syntropic/motor/syn_motor_output.h