7 Generated APIs
The generated library offers a list of user-friendly APIs that abstract and simplify the low-level configuration.
The APIs from the Motor Control Stack found in motor_control.h
are the
following:
MC_Initialize
- The initialization function must be called before any other functionMC_StartStop
- Starts or stops the motor depending on which state it is found in when the start-stop event is receivedMC_DelayMs
- Performs a delay using a timer in the background, without interruptsMC_ReferenceSet
- Sets the reference point for speed in closed loop or the amplitude level in open loop synchronizationMC_PotentiometerRead
- Returns potentiometer value, expressed in percentageMC_FastPotentiometerRead
- Returns potentiometer value, expressed in raw Analog-to-Digital (A/D) formatMC_VoltageBusRead
- Returns voltage bus value expressed in voltsMC_TemperatureRead
- Returns MOSFET transistors temperature, expressed in degrees CelsiusMC_CurrentRead
- Returns mean application current consumption, expressed in milliamperesMC_Speed_Get
- Returns the rotational speed expressed inmc_speed_t
MC_PeriodicHandlerRegister
- Registers a custom software callback for the main application. This function must be called from the main and not the interrupt context.MC_StatusGet
- Returns the state of the motor (MOTOR_IDLE, MOTOR_RUNNING or MOTOR_FAULT), direction of the motor (MC_DIR_CW or MC_DIR_CCW), and the fault status (FAULT_UNDERVOLTAGE, FAULT_OVERVOLTAGE, FAULT_STALL, FAULT_OVERTEMPERATURE or FAULT_OVERCURRENT)
Users must only use the public APIs from the motor_control.h
file so as
not to alter the library’s functionality.