zarfld / LinuxCnc_PokeysLibComp

Pokeys comp for LinuxCnc using https://bitbucket.org/mbosnak/pokeyslib.git
MIT License
5 stars 0 forks source link

HAL Interface: PEv2 #131

Open zarfld opened 1 month ago

zarfld commented 1 month ago

ensure pokeys_py and pokeys_rt follow the definition below for halinterface of PEv2 and use the correct enumerations and commands to update and extract information for each axis

ensure that pins for required & enabled axes are created only

ensure that input pins are updated by the corresponding pointers in pokeyslib for outputs ensure that the pointers in pokeyslib are update based on corresponding pins

update documentation accordingly

PEv2 information

Pins

Parameters

PEv2 information - for each axis

Pins

Parameters

update developer description Here’s an analysis of the PoKeysLibPulseEngine_v2.c file, outlining the pointers used or updated in each function:

1. *`PK_PEv2_StatusGet(sPoKeysDevice device)`**

2. *`PK_PEv2_PulseEngineSetup(sPoKeysDevice device)`**

3. *`PK_PEv2_AxisConfigurationGet(sPoKeysDevice device)`**

4. *`PK_PEv2_AxisConfigurationSet(sPoKeysDevice device)`**

5. *`PK_PEv2_PositionSet(sPoKeysDevice device)`**

6. *`PK_PEv2_PulseEngineStateSet(sPoKeysDevice device)`**

7. *`PK_PEv2_PulseEngineMove(sPoKeysDevice device)`**

8. *`PK_PEv2_PulseEngineMovePV(sPoKeysDevice device)`**

9. *`PK_PEv2_BufferFill(sPoKeysDevice device)`**

10. *`PK_PEv2_BufferClear(sPoKeysDevice device)`**

11. *`PK_PEv2_HomingStart(sPoKeysDevice device)`**

12. *`PK_PEv2_HomingFinish(sPoKeysDevice device)`**

13. *`PK_PEv2_ProbingStart(sPoKeysDevice device)`**

14. *`PK_PEv2_ProbingFinish(sPoKeysDevice device)`**

15. *`PK_PEv2_BacklashCompensationSettings_Get(sPoKeysDevice device)`**

16. *`PK_PEv2_BacklashCompensationSettings_Set(sPoKeysDevice device)`**

17. *`PK_PEv2_SyncedPWMSetup(sPoKeysDevice device)`**


Summary of Key Pointers:

  1. Axis State and Motion:

    • device->PEv2.AxesState[]
    • device->PEv2.CurrentPosition[]
    • device->PEv2.ReferencePositionSpeed[]
    • device->PEv2.ReferenceVelocityPV[]
  2. Homing and Limits:

    • device->PEv2.HomingStartMaskSetup
    • device->PEv2.AxesSwitchConfig[]
    • device->PEv2.SignalConfig[]
  3. Backlash Compensation:

    • device->PEv2.BacklashWidth[]
    • device->PEv2.BacklashAcceleration[]
    • device->PEv2.BacklashCompensationEnabled
  4. Probing:

    • device->PEv2.ProbeStatus
    • device->PEv2.ProbeSpeed
  5. PWM Setup:

    • device->PEv2.PWMSetup[]

Here is a detailed list of the bitmapped fields in PoKeysLib.h (PEv2) that need to be split for each axis, along with their corresponding enumerations, values, and meanings:

1. HomingStartMaskSetup


2. BacklashCompensationEnabled


3. TriggerIngnoredAxisMask


4. DedicatedLimitNInputs and DedicatedLimitPInputs


5. SignalConfig[] (Signal inversion flags)


6. AxesSwitchConfig[] (Switch configuration for each axis)


7. MotionBuffer[]


8. PWMSetup[] (PWM output configuration)


9. ePK_PEv2_AxisConfig (Axis configuration flags)


Full List of Enumerations in PEv2 that Affect Axis Behavior

  1. ePK_PEv2_AxisConfig: Configuration flags for each axis (enable, inversion, position mode, etc.)
  2. ePK_PEv2_AxisSwitchOptions: Switch options for each axis (limit and home switch configuration, inversion)
  3. ePK_PEv2_AxisSignalOptions: Signal inversion options for each axis (step and direction inversion)

Conclusion:

Many of these bitmapped fields need to be split into individual HAL pins or parameters to map each axis’s status, configuration, and behavior in LinuxCNC. This ensures that each axis operates independently, and its signals are correctly interpreted by the system. The enumeration-based fields provide a clear method for interpreting and configuring these bitmapped values.

Let's go through the key functions related to PoKeys PEv2 in pokeyslib and describe how the values should be updated from corresponding pointers in PoKeysLib to the LinuxCNC HAL pins. We'll use the pin names and usage as defined in the pokeys.comp file.

General Structure

For each PoKeys PEv2 function, we will:

  1. Retrieve values from PoKeysLib pointers.
  2. Update the corresponding LinuxCNC HAL pins.

Example Code for Updating PEv2-Related Pins in LinuxCNC

1. PK_PEv2_StatusGet: Retrieve the status of the pulse engine

This function retrieves the general status of the pulse engine, including the current position, axis states, and other general information. The relevant LinuxCNC HAL pins include position feedback (joint.N.pos-fb), axis state, and switch statuses.

void update_pev2_status()
{
    // Call PoKeys function to retrieve pulse engine status
    PK_PEv2_StatusGet(device);

    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Update the position feedback pin (joint.N.pos-fb)
        *hal_pos_fb[i] = device->PEv2.CurrentPosition[i] * AXIS_SCALE_FACTOR;

        // Update the home switch pin (joint.N.home-sw-in)
        *hal_home_sw[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_HOME) ? 1 : 0;

        // Update the positive limit switch pin (joint.N.limit-p-sw-in)
        *hal_limit_p[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_LIMIT_P) ? 1 : 0;

        // Update the negative limit switch pin (joint.N.limit-n-sw-in)
        *hal_limit_n[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_LIMIT_N) ? 1 : 0;

        // Update the axis state (e.g., STOPPED, RUNNING, etc.)
        *hal_axis_state[i] = device->PEv2.AxesState[i];
    }
}

2. PK_PEv2_PulseEngineMove: Execute a move (either position or velocity-based)

This function executes a move by sending position or velocity commands to the PoKeys device. The LinuxCNC HAL pins that handle velocity and position commands should be updated accordingly.

void update_pev2_move()
{
    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Update the velocity command pin (joint.N.vel-cmd)
        device->PEv2.ReferencePositionSpeed[i] = *hal_vel_cmd[i] / VELOCITY_SCALE;

        // Trigger a move based on the updated velocity command
        PK_PEv2_PulseEngineMove(device);
    }
}

3. PK_PEv2_AxisConfigurationGet: Retrieve axis configuration (limits, home switch, etc.)

This function retrieves the axis configuration, including the home switch, limit switches, and soft limits. The information is reflected in the HAL pins for limit switches, home switches, and soft limits.

void update_pev2_axis_configuration()
{
    // Fetch axis configuration for all axes
    PK_PEv2_AxisConfigurationGet(device);

    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Update home switch status
        *hal_home_sw[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_HOME) ? 1 : 0;

        // Update positive limit switch status
        *hal_limit_p[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_LIMIT_P) ? 1 : 0;

        // Update negative limit switch status
        *hal_limit_n[i] = (device->PEv2.AxesSwitchConfig[i] & PK_ASO_SWITCH_LIMIT_N) ? 1 : 0;

        // Update soft limits
        *hal_soft_limit_min[i] = device->PEv2.SoftLimitMin[i];
        *hal_soft_limit_max[i] = device->PEv2.SoftLimitMax[i];
    }
}

4. PK_PEv2_HomingStart: Start the homing procedure

This function initiates the homing procedure for an axis. The homing switch pin (joint.N.home-sw-in) should be updated when homing is in progress or complete.

void update_pev2_homing()
{
    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Start the homing process
        device->PEv2.HomingStartMaskSetup = (1 << i); // Home axis 'i'
        PK_PEv2_HomingStart(device);

        // Wait for homing to complete and update the HAL pin
        while (device->PEv2.AxesState[i] != PK_PEAxisState_axHOME)
        {
            // Continuously fetch the status
            PK_PEv2_StatusGet(device);

            // Update home switch pin
            *hal_home_sw[i] = (device->PEv2.AxesState[i] == PK_PEAxisState_axHOME) ? 1 : 0;
        }
    }
}

5. PK_PEv2_ProbingStart: Start probing (used for Z-height detection, for example)

If probing is supported by PoKeys, this function initiates probing and updates the HAL pins related to probing (e.g., probe-in).

void update_pev2_probing()
{
    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Start the probing process
        device->PEv2.ProbeInput = i; // Select probe input for axis 'i'
        PK_PEv2_ProbingStart(device);

        // Continuously fetch the status and update the probe pin
        while (device->PEv2.AxesState[i] != PK_PEAxisState_axPROBED)
        {
            // Fetch status
            PK_PEv2_StatusGet(device);

            // Update the probe-in pin
            *hal_probe_in[i] = (device->PEv2.AxesState[i] == PK_PEAxisState_axPROBED) ? 1 : 0;
        }
    }
}

6. PK_PEv2_BacklashCompensationSettings_Get/Set: Manage backlash compensation

If backlash compensation is enabled, this function retrieves or sets the backlash compensation settings for each axis. The backlash-related HAL pins can be updated accordingly.

void update_pev2_backlash()
{
    for (int i = 0; i < 8; i++) // Assuming 8 axes
    {
        // Retrieve backlash settings
        PK_PEv2_BacklashCompensationSettings_Get(device);

        // Update backlash compensation enable pin
        *hal_backlash_enable[i] = device->PEv2.BacklashCompensationEnabled;

        // Update backlash width and compensation values
        *hal_backlash_width[i] = device->PEv2.BacklashWidth[i];
        *hal_backlash_accel[i] = device->PEv2.BacklashAcceleration[i];
    }
}

Summary of Pin-Function Mapping

PoKeysLib Function LinuxCNC Pin Description
PK_PEv2_StatusGet joint.N.pos-fb, joint.N.home-sw-in, joint.N.limit-p-sw-in, joint.N.limit-n-sw-in, pev2.axis-state Updates position, home, limit switches, and axis state.
PK_PEv2_PulseEngineMove joint.N.vel-cmd Updates velocity commands for each axis.
PK_PEv2_AxisConfigurationGet joint.N.home-sw-in, joint.N.limit-p-sw-in, joint.N.limit-n-sw-in, pev2.soft-limit Updates axis configuration like switches and soft limits.
PK_PEv2_HomingStart joint.N.home-sw-in Initiates and monitors the homing process.
PK_PEv2_ProbingStart probe-in Initiates probing for Z-height detection or similar tasks.
PK_PEv2_BacklashCompensationSettings_Get/Set pev2.backlash-enable, pev2.backlash-width, pev2.backlash-accel Manages backlash compensation for each axis.

Key Points

This approach ensures seamless communication between the PoKeys device and the LinuxCNC HAL, while adhering to the PoKeysLib public interface.

zarfld commented 1 month ago

example usage provided by PoLabs can be found here https://bitbucket.org/mbosnak/pokeyslib/src/master/Examples/PulseEngine/PulseEngine.cpp

zarfld commented 1 month ago

for developer description: publich inter face of PEv2 in pokeyslib is as follows: see https://bitbucket.org/mbosnak/pokeyslib/raw/c08da06747d56962640fdf03ff954c0675b1f563/PoKeysLib.h


// Pulse engine state
enum ePK_PEState
{
    PK_PEState_peSTOPPED        = 0,           // Pulse engine is stopped
    PK_PEState_peINTERNAL       = 1,           // PEv1: Internal motion controller is in use, PEv2: not used
    PK_PEState_peBUFFER         = 2,           // PEv1: Buffered operation mode is in use, PEv2: not used
    PK_PEState_peRUNNING        = 3,           // Pulse engine is activated

    PK_PEState_peJOGGING        = 10,          // Jogging mode enabled
    PK_PEState_peSTOPPING       = 11,          // Pulse engine is stopping

    PK_PEState_peHOME           = 20,          // All axes are homed
    PK_PEState_peHOMING         = 21,          // Axes homing is in progress

    PK_PEState_pePROBECOMPLETE  = 30,          // All axes are homed
    PK_PEState_pePROBE          = 31,          // Axes probing is in progress
    PK_PEState_pePROBEERROR     = 32,          // Error occured during probing

    PK_PEState_peHYBRIDPROBE_STOPPING = 40,
    PK_PEState_peHYBRIDPROBE_COMPLETE = 41,

    PK_PEState_peSTOP_LIMIT     = 100,         // Pulse engine stopped due to limit reached
    PK_PEState_peSTOP_EMERGENCY = 101          // Pulse engine stopped due to emergency switch
};

// Pulse engine axis state
enum ePK_PEAxisState
{
    PK_PEAxisState_axSTOPPED      =  0,        // Axis is stopped
    PK_PEAxisState_axREADY        =  1,        // Axis ready
    PK_PEAxisState_axRUNNING      =  2,        // Axis is running

    PK_PEAxisState_axHOMING_RESETTING = 8,     // Stopping the axis to reset the position counters
    PK_PEAxisState_axHOMING_BACKING_OFF = 9,   // Backing off switch
    PK_PEAxisState_axHOME         =  10,       // Axis is homed
    PK_PEAxisState_axHOMINGSTART  =  11,       // Homing procedure is starting on axis
    PK_PEAxisState_axHOMINGSEARCH =  12,       // Homing procedure first step - going to home
    PK_PEAxisState_axHOMINGBACK   =  13,       // Homing procedure second step - slow homing

    PK_PEAxisState_axPROBED       =  14,       // Probing completed for this axis
    PK_PEAxisState_axPROBESTART   =  15,       // Probing procedure is starting on axis
    PK_PEAxisState_axPROBESEARCH  =  16,       // Probing procedure - probing

    PK_PEAxisState_axERROR        =  20,       // Axis error
    PK_PEAxisState_axLIMIT        =  30        // Axis limit tripped
};

enum ePK_PEv2_AxisConfig
{
    PK_AC_ENABLED            = (1 << 0),       // Axis enabled
    PK_AC_INVERTED           = (1 << 1),       // Axis inverted
    PK_AC_INTERNAL_PLANNER   = (1 << 2),       // Axis uses internal motion planner
    PK_AC_POSITION_MODE      = (1 << 3),       // Internal motion planner for this axis is in position mode
    PK_AC_INVERTED_HOME      = (1 << 4),       // Axis homing direction is inverted
    PK_AC_SOFT_LIMIT_ENABLED = (1 << 5),       // Use soft-limits for this axis
    PK_AC_FAST_OUTPUT        = (1 << 6),       // Fast output mode
    PK_AC_ENABLED_MASKED     = (1 << 7)        // Use output enable pin masking
};

enum ePK_PEv2_AxisSwitchOptions
{
    PK_ASO_SWITCH_LIMIT_N        = (1 << 0),   // Limit- switch
    PK_ASO_SWITCH_LIMIT_P        = (1 << 1),   // Limit+ switch
    PK_ASO_SWITCH_HOME           = (1 << 2),   // Home switch
    PK_ASO_SWITCH_COMBINED_LN_H  = (1 << 3),   // Home switch is shared with Limit- switch
    PK_ASO_SWITCH_COMBINED_LP_H  = (1 << 4),   // Home switch is shared with Limit+ switch
    PK_ASO_SWITCH_INVERT_LIMIT_N = (1 << 5),   // Invert limit- switch polarity
    PK_ASO_SWITCH_INVERT_LIMIT_P = (1 << 6),   // Invert limit+ switch polarity
    PK_ASO_SWITCH_INVERT_HOME    = (1 << 7)    // Invert home switch polarity
};

enum ePK_PEv2_AxisSignalOptions
{
    PK_ASO_INVERT_STEP = (1 << 0),              // Invert step signal (active-low)
    PK_ASO_INVERT_DIRECTION = (1 << 1)          // Invert direction signal
};
// Pulse engine v2 information
typedef struct
{
    uint8_t nrOfAxes;
    uint8_t maxPulseFrequency;
    uint8_t bufferDepth;
    uint8_t slotTiming;

    uint8_t reserved[4];
} sPoKeysPEv2info;

// Pulse engine v2 structure...
typedef struct
{
    sPoKeysPEv2info info;                      // Pulse engine info

    uint8_t         AxesState[8];              // Axis states (bit-mapped) - see ePK_PEAxisState
    uint8_t         AxesConfig[8];             // Axis configuration - see ePK_PEv2_AxisConfig
    uint8_t         AxesSwitchConfig[8];       // Axis switch configuration - see ePK_PEv2_AxisSwitchOptions
    int32_t         CurrentPosition[8];        // Current position
    int32_t         PositionSetup[8];          // Position to be set as current position
    int32_t         ReferencePositionSpeed[8]; // Reference position or speed (position or pulses/s)
    int8_t          InvertAxisEnable[8];       // Invert axis enable signal

    int32_t         SoftLimitMaximum[8];       // Soft limit maximum position
    int32_t         SoftLimitMinimum[8];       // Soft limit minimum position

    uint8_t         HomingSpeed[8];            // Homing speed per axis (in %)
    uint8_t         HomingReturnSpeed[8];      // Homing return speed per axis (in % of the homing speed)

    int32_t         HomeOffsets[8];            // Home position offset
    uint8_t         HomingAlgorithm[8];        // Homing algorithm configuration

    uint8_t         FilterLimitMSwitch[8];     // Digital filter for limit- switch
    uint8_t         FilterLimitPSwitch[8];     // Digital filter for limit+ switch
    uint8_t         FilterHomeSwitch[8];       // Digital filter for home switch

    int32_t         ProbePosition[8];          // Position where probe detected change
    int32_t         ProbeMaxPosition[8];       // Maximum position to travel to until stopping and returning error
    float           MaxSpeed[8];               // Maximum axis speed (in pulses per ms)
    float           MaxAcceleration[8];        // Maximum axis acceleration (in pulses/ms/ms)
    float           MaxDecceleration[8];       // Maximum axis deceleration (in pulses/ms/ms)

    int32_t         MPGjogMultiplier[8];       // MPG jog multiplier value
    uint8_t         MPGjogEncoder[8];          // MPG jog encoder ID
    uint8_t         PinHomeSwitch[8];          // Home switch pin (0 for external dedicated input)
    uint8_t         PinLimitMSwitch[8];        // Limit- switch pin (0 for external dedicated input)
    uint8_t         PinLimitPSwitch[8];        // Limit+ switch pin (0 for external dedicated input)
    uint8_t         AxisEnableOutputPins[8];   // Axis enabled output pin (0 for external dedicated output)
    uint32_t        HomeBackOffDistance[8];    // Back-off distance after homing
    uint16_t        MPGjogDivider[8];          // Divider for the MPG jogging (enhanced encoder resolution)
    uint8_t         FilterProbeInput;          // Filter for the probe input
    uint8_t         reserved[7];               // Motion buffer entries - moved further down...
    uint8_t         AxisSignalOptions[8];      // Axis signal options (invert step or direction)

    float           ReferenceVelocityPV[8];    // Reference velocity in PV mode (between 0.0 and 1.0) as ratio of max. speed
    uint8_t         ReservedSafety[8];         // 8-bytes reserved

    // ------ 64-bit region boundary ------
    uint8_t         PulseEngineEnabled;        // Pulse engine enabled status, also number of enabled axes
    uint8_t         PulseGeneratorType;        // Pulse engine generator type (0: external, 1: internal 3ch)
    uint8_t         ChargePumpEnabled;         // Charge pump output enabled
    uint8_t         EmergencySwitchPolarity;   // Emergency switch polarity (set to 1 to invert)

    uint8_t         PulseEngineActivated;      // Pulse engine activation status
    uint8_t         LimitStatusP;              // Limit+ status (bit-mapped)
    uint8_t         LimitStatusN;              // Limit- status (bit-mapped)
    uint8_t         HomeStatus;                // Home status (bit-mapped)

    uint8_t         ErrorInputStatus;          // Stepper motor driver error inputs status (bit-mapped)
    uint8_t         MiscInputStatus;           // Miscelenous digital inputs...
    uint8_t         LimitOverride;             // Limit override status
    uint8_t         LimitOverrideSetup;        // Limit override configuration

    // State of pulse engine - see ePoKeysPEState
    uint8_t         PulseEngineState;

    uint8_t         AxisEnabledMask;           // Bit-mapped ouput enabled mask
    uint8_t         EmergencyInputPin;
    uint8_t         SyncFastOutputsAxisID;     // Enable synced outputs and select pulse engine axis to map the data to (1-based)

    uint8_t         SyncFastOutputsMapping[8]; // Output mapping for the synced outputs

    // ------ 64-bit region boundary ------
    uint8_t         param1;                    // Parameter 1 value
    uint8_t         param2;
    uint8_t         param3;

    uint8_t         AxisEnabledStatesMask;     // Bit-mapped states, where axis enabled and charge pump signals are active
    uint8_t         PulseEngineStateSetup;     // Pulse engine new state configuration

    uint8_t         SoftLimitStatus;           // Bit-mapped soft-limit statuses per axes
    uint8_t         ExternalRelayOutputs;      // External relay outputs
    uint8_t         ExternalOCOutputs;         // External open-collector outputs
    uint8_t         PulseEngineBufferSize;     // Buffer size information...

    uint8_t         motionBufferEntriesAccepted;
    uint8_t         newMotionBufferEntries;

    uint8_t         HomingStartMaskSetup;      // Bit-mapped axes indexes to be homed
    uint8_t         ProbeStartMaskSetup;       // Bit-mapped axis indexes for probing

    uint8_t         ProbeInput;                // Probe input (0:disabled, 1-8:external inputs, 9+ Pin ID-9)
    uint8_t         ProbeInputPolarity;        // Probe input polarity
    uint8_t         ProbeStatus;               // Probe status (probe completion bit-mapped status)

    // ------ 64-bit region boundary ------
    uint8_t         MotionBuffer[448];         // Motion buffer

    // ------ 64-bit region boundary ------
    float           ProbeSpeed;                // Probe speed (ratio of the maximum speed)
    float           reservedf;

    uint32_t        DebugValues[16];

    uint16_t        BacklashWidth[8];           // half of real backlash width
    int16_t         BacklashRegister[8];        // current value of the backlash register
    uint8_t         BacklashAcceleration[8];    // in pulses per ms^2
    uint8_t         BacklashCompensationEnabled;
    uint8_t         BacklashCompensationMaxSpeed;

    uint8_t         reserved_back[2];

    uint8_t         TriggerPreparing;
    uint8_t         TriggerPrepared;
    uint8_t         TriggerPending;
    uint8_t         TriggerActive;

    int32_t         SpindleSpeedEstimate;
    int32_t         SpindlePositionError;
    uint32_t        SpindleRPM;
    uint32_t        spindleIndexCounter;

    uint8_t         DedicatedLimitNInputs;
    uint8_t         DedicatedLimitPInputs;
    uint8_t         DedicatedHomeInputs;
    uint8_t         TriggerIngnoredAxisMask;

    uint32_t        EncoderIndexCount;
    uint32_t        EncoderTicksPerRotation;
    uint32_t        EncoderVelocity;
    uint32_t        reservedEnd;

    uint8_t         InternalDriverStepConfig[4];
    uint8_t         InternalDriverCurrentConfig[4];

} sPoKeysPEv2;

// Pulse engine v2 commands

// Get status of Pulse engine POKEYSDECL int32_t PK_PEv2_StatusGet(sPoKeysDevice device); // Get additional status data POKEYSDECL int32_t PK_PEv2_Status2Get(sPoKeysDevice device); // Configure (setup) the pulse engine POKEYSDECL int32_t PK_PEv2_PulseEngineSetup(sPoKeysDevice device); // Read additional parameters POKEYSDECL int32_t PK_PEv2_AdditionalParametersGet(sPoKeysDevice device); // Set additional parameters POKEYSDECL int32_t PK_PEv2_AdditionalParametersSet(sPoKeysDevice device); // Retrieve single axis parameters. Axis ID is in param1 POKEYSDECL int32_t PK_PEv2_AxisConfigurationGet(sPoKeysDevice device); // Set single axis parameters. Axis ID is in param1 POKEYSDECL int32_t PK_PEv2_AxisConfigurationSet(sPoKeysDevice device); // Set positions - param2 is used for bit-mapped axis selection POKEYSDECL int32_t PK_PEv2_PositionSet(sPoKeysDevice device); // Set pulse engine state POKEYSDECL int32_t PK_PEv2_PulseEngineStateSet(sPoKeysDevice device); // Execute the move. Position or speed is specified by the ReferencePositionSpeed POKEYSDECL int32_t PK_PEv2_PulseEngineMove(sPoKeysDevice device); // Execute the move in PV (position-velocity) mode. Position is specified by the ReferencePositionSpeed, relative velocity by ReferenceVelocityPV - requires FW 4.4.7 or newer POKEYSDECL int32_t PK_PEv2_PulseEngineMovePV(sPoKeysDevice device); // Read external outputs state - save them to ExternalRelayOutputs and ExternalOCOutputs POKEYSDECL int32_t PK_PEv2_ExternalOutputsGet(sPoKeysDevice device); // Set external outputs state (from ExternalRelayOutputs and ExternalOCOutputs) POKEYSDECL int32_t PK_PEv2_ExternalOutputsSet(sPoKeysDevice device); // Transfer motion buffer to device. The number of new entries (newMotionBufferEntries) must be specified // The number of accepted entries is saved to motionBufferEntriesAccepted. // In addition, pulse engine state is read (PEv2_GetStatus) POKEYSDECL int32_t PK_PEv2_BufferFill(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_BufferFill_16(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_BufferFillLarge(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_BufferFillLarge_16(sPoKeysDevice device); // Clear motion buffer in device POKEYSDECL int32_t PK_PEv2_BufferClear(sPoKeysDevice device); // Reboot pulse engine v2 POKEYSDECL int32_t PK_PEv2_PulseEngineReboot(sPoKeysDevice device); // Start the homing procedure. Home offsets must be provided in the HomeOffsets // Axes to home are selected as bit-mapped HomingStartMaskSetup value POKEYSDECL int32_t PK_PEv2_HomingStart(sPoKeysDevice device); // Finish the homing procedure POKEYSDECL int32_t PK_PEv2_HomingFinish(sPoKeysDevice device); // Star the probing procedure. // ProbeMaxPosition defines the maximum position in position ticks where probing error will be thrown // ProbeSpeed defines the probing speed (1 = max speed) // ProbeInput defines the extenal input (values 1-8) or PoKeys pin (0-based Pin ID + 9) // ProbeInputPolarity defines the polarity of the probe signal POKEYSDECL int32_t PK_PEv2_ProbingStart(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ProbingHybridStart(sPoKeysDevice device); // Finish the probing procedure. Probe position and status are saved to ProbePosition and ProbeStatus POKEYSDECL int32_t PK_PEv2_ProbingFinish(sPoKeysDevice device); // Same as previous command, except for pulse engine states not being reset to 'STOPPED' POKEYSDECL int32_t PK_PEv2_ProbingFinishSimple(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_SyncedPWMSetup(sPoKeysDevice device, uint8_t enabled, uint8_t srcAxis, uint8_t dstPWMChannel); POKEYSDECL int32_t PK_PEv2_SyncOutputsSetup(sPoKeysDevice * device);

// Get/Set internal motor drivers parameters POKEYSDECL int32_t PK_PEv2_InternalDriversConfigurationGet(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_InternalDriversConfigurationSet(sPoKeysDevice device);

POKEYSDECL int32_t PK_PEv2_ThreadingPrepareForTrigger(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingForceTriggerReady(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingTrigger(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingRelease(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingStatusGet(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingCancel(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_ThreadingSetup(sPoKeysDevice * device, uint8_t sensorMode, uint16_t ticksPerRevolution, uint16_t tagetSpindleRPM, uint16_t filterGainSpeed, uint16_t filterGainPosition);

POKEYSDECL int32_t PK_PEv2_BacklashCompensationSettings_Get(sPoKeysDevice device); POKEYSDECL int32_t PK_PEv2_BacklashCompensationSettings_Set(sPoKeysDevice device);

for usage and information on how these commands interact with pointers of struct please analyze https://bitbucket.org/mbosnak/pokeyslib/src/master/PoKeysLibPulseEngine_v2.c