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_ DEFAULT_ ADDRESS - The address a PCA9685 answers at with its six address pins low.
- PAMOJA_
PCA9685_ INTERNAL_ OSC_ HZ - The PCA9685’s internal oscillator frequency, in hertz.
- PAMOJA_
PCA9685_ MODE1_ AUTO_ INCREMENT - MODE1’s auto-increment bit: the register pointer moves on after each byte.
- PAMOJA_
PCA9685_ MODE1_ EXTCLK - MODE1’s EXTCLK bit: the prescaler divides the EXTCLK pin rather than the oscillator.
- PAMOJA_
PCA9685_ MODE1_ RESET - The power-on value of MODE1: asleep, answering the All Call address.
- PAMOJA_
PCA9685_ MODE1_ RESTART - MODE1’s RESTART bit: set when the part slept with a channel running, cleared by a written 1.
- PAMOJA_
PCA9685_ MODE1_ SLEEP - MODE1’s SLEEP bit: the oscillator is off and PRE_SCALE takes a write.
- PAMOJA_
PCA9685_ MODE2_ RESET - The power-on value of MODE2: totem-pole outputs.
- PAMOJA_
PCA9685_ OSCILLATOR_ STARTUP_ MICROS - How long the oscillator takes to run once woken, in microseconds.
- PAMOJA_
PCA9685_ PRE_ SCALE_ MIN - The smallest value the part loads into PRE_SCALE, about 1526 Hz.
- PAMOJA_
PCA9685_ PRE_ SCALE_ RESET - The power-on value of PRE_SCALE: 200 Hz on the internal oscillator.
- PAMOJA_
PCA9685_ REGISTER_ ALL_ LED_ ON_ L - The first of the four ALL_LED registers, which load every channel at once.
- PAMOJA_
PCA9685_ REGISTER_ LED0_ ON_ L - The first of channel 0’s four registers; channel n starts four registers on per channel.
- PAMOJA_
PCA9685_ REGISTER_ MODE1 - Mode register 1: restart, clock, auto-increment, sleep, and the addresses answered.
- PAMOJA_
PCA9685_ REGISTER_ MODE2 - Mode register 2: how the outputs are wired and when they change.
- PAMOJA_
PCA9685_ REGISTER_ PRE_ SCALE - The prescaler that sets the PWM frequency, writable only while the part sleeps.
- PAMOJA_
STEPPER_ DEFAULT_ PULSE_ MICROS - How long a step and direction driver holds the direction before a step pulse, and the pulse itself, unless given another, in microseconds.
- PAMOJA_
STEPPER_ DEFAULT_ STEP_ MICROS - The pause a stepper driver takes after each step unless given another, in microseconds: two milliseconds, a rate common geared hobby motors follow without stalling.
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.