Jump to main content

##

# 3.3.7 mcFocI_MotorDirectionChange

## C

    /* Change motor direction */
    void mcFocI_MotorDirectionChange(const tmcFocI_ModuleData_s * const pParameters)

## Summary

Changes the direction of the motor.

## Description

This function changes the motor's direction by inverting the direction command stored in the FOC module's state. The direction command state is then used in the mcFocI_FieldOrientedControlFast API to update the reference speed.

## Precondition

None.

## Parameters

Param | Description
--- | ---
pParameters | A pointer to the FOC module data structure.

## Returns

None

## Example

    // Define the FOC module data structure
    tmcFocI_ModuleData_s mcFocI_ModuleData_gds;

    /** Change state variable to toggle motor spin direction  */
    mcFocI_MotorDirectionChange(&mcFocI_ModuleData_gds);

## Remarks

None.