![]() |
LibSpindle-C-Library 1.0
Library Code documentation
|
#include <Spindle.h>
Data Fields | |
| void(* | setDutyCycle )(SpindleHandle_t h, void *context, int backwards, float dutyCycle) |
| void(* | enaPWM )(SpindleHandle_t h, void *context, int ena) |
| float | maxRPM |
| float | absMinRPM |
| float | minRPM |
| void * | context |
The SpindlePhysicalParams_t structure is represents the abstraction functions and members as a container. The objetcs are passed as structure pointer when calling SPINDLE_CreateInstance. It contains function pointers to platform specific functions which enable the spindle or regulate the speed and direction of it. There are also limit values for the maximum, minimum and absolute minimum RPM and an additional context pointer which is passed the the abstraction functions. The user must provide a configured structure in its design when calling SPINDLE_CreateInstance.
| float SpindlePhysicalParams::absMinRPM |
specifies the minimum possible absolute RPM value which is usable with the spindle a requested RPM value lower than this value is limited and therefore its not possible to let the spindle run slower. This value is used for clock wise and counter clock wise spindle rotation in the same way.
| void* SpindlePhysicalParams::context |
optional context pointer for platform abstraction. can be null.
| void(* SpindlePhysicalParams::enaPWM) (SpindleHandle_t h, void *context, int ena) |
This function pointer is used to enable or disable the PWM output and to set the enable outputs od the half bridges of the spindle
The pointer must not be null
| [in,out] | h | optional handle of the spindle library. |
| [in,out] | context | optional context pointer the user has passed by the SPINDLE_CreateInstance call. |
| [in] | ena | value that sets enable or disable state (1 = enabled, 0 = disabled) |
The behavior is schematically as follows:
| float SpindlePhysicalParams::maxRPM |
specifies the maximum positive RPM value which represents a duty cycle of 1.0
| float SpindlePhysicalParams::minRPM |
specifies the minimum negative RPM value. Mostly this value is symmetrical to the max value which means it can be the same value
| void(* SpindlePhysicalParams::setDutyCycle) (SpindleHandle_t h, void *context, int backwards, float dutyCycle) |
This function pointer is used to change the duty cycle of the spindle. This function is necessary for changing the PWM generation itself. It also sets the direction of the spindle which means turning clock wise or counter clock wise
The pointer must not be null
| [in,out] | h | optional handle of the spindle library. |
| [in,out] | context | optional context pointer the user has passed by the SPINDLE_CreateInstance call. |
| [in] | dutyCycle | value between 0 = 0% and 1 = 100% |
| [in] | backwards | sets the direction of the spindle (clockwise or counter clockwise = backward). |
The behavior is schematically as follows: