Skip to main content

Module actuators

Module actuators 

Source
Expand description

The C ABI for the actuator drivers.

These functions wrap [pamoja_actuators] for callers that reach the SDK through the flat C boundary: the command-encode half of a PCA9685 PWM controller and of a stepper motor, turning a desired output into the bytes and coil patterns a driver applies.

A PWM setting is four register bytes, so it crosses by value as a #[repr(C)] struct the caller writes straight to the channel’s registers. A stepper sequencer and position both carry state across calls, so they cross as handles.

Structs§

PamojaPwm
A PCA9685 channel’s four register bytes.
PamojaStepper
An opaque handle to a position in a stepper drive sequence.

Enums§

PamojaStepDirection
Which way to step a motor.
PamojaStepDrive
A stepper drive pattern, trading torque, smoothness, and resolution.

Constants§

PAMOJA_PCA9685_CHANNELS
How many PWM channels a PCA9685 drives.
PAMOJA_PCA9685_COUNTS
How many counts a PCA9685 period is divided into.
PAMOJA_PCA9685_INTERNAL_OSC_HZ
The PCA9685’s internal oscillator frequency, in hertz.

Functions§

pamoja_pca9685_channel_register
Returns the first of a PCA9685 channel’s four consecutive registers.
pamoja_pca9685_frequency_for_prescale
Returns the update rate a PCA9685 prescale value produces.
pamoja_pca9685_prescale_for_frequency
Returns the prescale value that sets a PCA9685 update rate.
pamoja_pwm_counts
Reads a PCA9685 setting back from the four register bytes a channel holds.
pamoja_pwm_duty
Builds a PWM setting with no phase delay: on at count 0, off at off.
pamoja_pwm_from_counts
Builds a PWM setting from explicit on and off counts.
pamoja_pwm_full_off
The setting that holds a channel continuously low, the power-on state.
pamoja_pwm_full_on
The setting that holds a channel continuously high.
pamoja_pwm_servo
Builds the setting that drives a hobby servo to a given pulse width.
pamoja_stepper_coils
Returns the coil pattern a stepper currently holds, without advancing it.
pamoja_stepper_free
Releases a stepper handle.
pamoja_stepper_new
Creates a stepper at the start of a drive pattern, with its position at zero.
pamoja_stepper_step
Advances a stepper one step and returns the coil pattern to apply.
pamoja_stepper_step_count
Returns how many steps make up one electrical cycle of a drive pattern.
pamoja_stepper_steps
Returns how many steps a stepper has taken, signed by direction.
pamoja_stepper_steps_for_degrees
Returns how many steps a rotation of degrees takes on a given motor.