Skip to content

File sstep_ctrl.h

FileList > inc > sstep_ctrl.h

Go to the source code of this file

  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>
  • #include "sstep_config.h"
  • #include "sstep_defs.h"

Classes

Type Name
struct sstep
Driver instance.
struct sstep_callbacks
Hardware callbacks.
struct sstep_config
Complete configuration given to sstep_init() .
struct sstep_ctrl_cfg
Control and motion parameters.
struct sstep_motor_cfg
Motor parameters, from the datasheet or measured.
struct sstep_sample
Raw measurements of one fast loop period, as read from the ADC.
struct sstep_stage_cfg
Power stage and measurement parameters.
struct sstep_status
Snapshot returned by sstep_get_status() , in engineering units.

Public Types

Type Name
enum sstep_drive_mode
How the phase voltages are obtained.
enum sstep_event
Events reported through sstep_event_fn.
typedef void(* sstep_event_fn
Notify the application of a motion event (optional).
typedef void(* sstep_fault_fn
Notify the application of new faults (optional).
typedef int(* sstep_output_enable_fn
Enable or disable the power stage outputs (disabled = all legs high impedance).
typedef int(* sstep_pwm_write_fn
Write the PWM compare values of all legs.

Macros

Type Name
define SSTEP_CONFIG_BYTES 152U
Bytes of the configuration copy at the start of the instance and of the private driver state that follows it, for 32-bit (Cortex-M) and 64-bit pointers.
define SSTEP_INSTANCE_WORDS ((SSTEP\_CONFIG\_BYTES + SSTEP\_STATE\_BYTES + 7U) / 8U)
Size of sstep in 64-bit words.
define SSTEP_STATE_BYTES 280U

Public Types Documentation

enum sstep_drive_mode

How the phase voltages are obtained.

enum sstep_drive_mode {
    SSTEP_DRIVE_CURRENT = 0,
    SSTEP_DRIVE_VOLTAGE = 1
};


enum sstep_event

Events reported through sstep_event_fn.

enum sstep_event {
    SSTEP_EVENT_MOVE_DONE = 0,
    SSTEP_EVENT_HOLD_CURRENT = 1
};


typedef sstep_event_fn

Notify the application of a motion event (optional).

typedef void(* sstep_event_fn) (void *context, enum sstep_event event);

Called from sstep_slow_loop().

Parameters:


typedef sstep_fault_fn

Notify the application of new faults (optional).

typedef void(* sstep_fault_fn) (void *context, uint16_t faults);

Called from the context that detected the fault, which may be sstep_fast_loop() (interrupt).

Parameters:


typedef sstep_output_enable_fn

Enable or disable the power stage outputs (disabled = all legs high impedance).

typedef int(* sstep_output_enable_fn) (void *context, bool enable);

Parameters:

Return value:


typedef sstep_pwm_write_fn

Write the PWM compare values of all legs.

typedef int(* sstep_pwm_write_fn) (void *context, const uint16_t compare[SSTEP_LEGS_MAX]);

Called from sstep_fast_loop().

Parameters:

  • context sstep_callbacks::context.
  • compare One compare value per leg, 0 .. pwm_period_ticks (0 = low-side on, pwm_period_ticks = high-side on). Entries above the leg count of the topology are 0. Valid only during the call.

Return value:

  • 0 Success.
  • <0 Error: the driver switches the outputs off with SSTEP_FAULT_HAL.

Macro Definition Documentation

define SSTEP_CONFIG_BYTES

Bytes of the configuration copy at the start of the instance and of the private driver state that follows it, for 32-bit (Cortex-M) and 64-bit pointers.

#define SSTEP_CONFIG_BYTES `152U`

Plain constants, so that the instance size needs no sizeof (static analysis); sstep_ctrl.c checks both at compile time.


define SSTEP_INSTANCE_WORDS

Size of sstep in 64-bit words.

#define SSTEP_INSTANCE_WORDS `((SSTEP_CONFIG_BYTES + SSTEP_STATE_BYTES + 7U) / 8U)`


define SSTEP_STATE_BYTES

#define SSTEP_STATE_BYTES `280U`


The documentation for this class was generated from the following file inc/sstep_ctrl.h