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§
- Pamoja
Pwm - A PCA9685 channel’s four register bytes.
- Pamoja
Stepper - An opaque handle to a position in a stepper drive sequence.
Enums§
- Pamoja
Step Direction - Which way to step a motor.
- Pamoja
Step Drive - 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
degreestakes on a given motor.