Struct SYN_DCMotor¶
DC motor instance — pins, speed, ramp state.
#include <syn_dc_motor.h>
Public Attributes¶
| Type | Name |
|---|---|
| void * | duty_ctx |
| int32_t | duty_max |
| bool | invert |
| uint32_t | last_tick |
| uint8_t | mode |
| SYN_GPIO_Pin | pin_a |
| SYN_GPIO_Pin | pin_b |
| SYN_Ramp | ramp |
| int32_t | ramp_rate |
| void(* | set_duty |
| int32_t | speed |
| int32_t | target |
Public Attributes Documentation¶
variable duty_ctx¶
Context for set_duty
variable duty_max¶
Maximum duty cycle value. Output range is [-duty_max, +duty_max]. Set to match your PWM timer resolution (e.g., 255 for 8-bit, 1000 for 0.1%, 4095 for 12-bit, 65535 for 16-bit). Default: SYN_DC_MOTOR_DUTY_MAX_DEFAULT (1000).
variable invert¶
Invert direction
variable last_tick¶
Last ramp update tick
variable mode¶
SYN_DCMotorMode
variable pin_a¶
PWM pin (or IN_A for dual mode)
variable pin_b¶
DIR pin (or IN_B for dual mode)
variable ramp¶
Internal velocity ramp generator
variable ramp_rate¶
Rate of speed change (per ms, Q8)
variable set_duty¶
Duty output callback — user provides this to set actual PWM duty.
Parameters:
pinGPIO pin to set duty on.dutyDuty cycle value in range [0, duty_max].ctxUser context.
variable speed¶
Current speed (-duty_max to +duty_max)
variable target¶
Target speed for ramping
The documentation for this class was generated from the following file src/syntropic/motor/syn_dc_motor.h