![]() |
LibL6474-C-Library 1.0
Library Code documentation
|
#include <LibL6474.h>
Data Fields | |
| void *(* | malloc )(unsigned int size) |
| void(* | free )(const void *const pMem) |
| int(* | transfer )(void *pIO, char *pRX, const char *pTX, unsigned int length) |
| void(* | reset )(void *pGPO, const int ena) |
| void(* | sleep )(unsigned int ms) |
| int(* | step )(void *pPWM, int dir, unsigned int numPulses) |
The L6474x_Platform_t structure is used to encapsulate platform specific parameters and to provide environment specific functions in a generalized format. Theses functions are malloc and free or some PWM and GPIO abstractions The lock guards and thread safety mechanisms are also abstracted by this structure
| void(* L6474x_Platform::free) (const void *const pMem) |
classic free function pointer which releases memory previously allocated by malloc. The user must provide this function as part of the platform abstraction. The minimal functionality can be reached by providing a function which simply calls free in case The malloc abstraction function is a call to malloc.
| [in] | pMem | pointer of the memory space which shall be freed |
The behavior is schematically as follows:
| void *(* L6474x_Platform::malloc) (unsigned int size) |
classic malloc function pointer which returns null in case of an error or a memory void* pointer with the given size by the first argument. The user must provide this function as part of the platform abstraction. The minimal functionality can be reached by providing a function which simply calls malloc.
| [in] | size | number of bytes requested by the memory allocation request |
The behavior is schematically as follows:
| void(* L6474x_Platform::reset) (void *pGPO, const int ena) |
the reset function is used to provide gpio access to the reset of the stepper driver chip. keep in mind that the chip has a reset not pin and so the ena signal must be inverted to set the correct reset level physically
| [in,out] | pGPO | optional user context pointer which has been passed by the L6474_CreateInstance call |
| [in] | ena | output state to set without level inversion |
The behavior is schematically as follows:
| void(* L6474x_Platform::sleep) (unsigned int ms) |
the sleep function implements a wait time with the argument in milliseconds
| [in] | ms | time to sleep in milliseconds |
The behavior is schematically as follows:
| int(* L6474x_Platform::step) (void *pPWM, int dir, unsigned int numPulses) |
the step function is a synchronous blocking function until the movement has been fully executed. This can be e.g. a PWM generation via GPIO pulsing given by the numPulses argument
| [in,out] | pPWM | optional user context pointer which has been passed by the L6474_CreateInstance call |
| [in] | dir | output signal to drive the stepper clock wise or counter clockwise |
| [in] | numPulses | number of high and low transitions to generate a pulse for the stepper chip |
The behavior is schematically as follows:
| int(* L6474x_Platform::transfer) (void *pIO, char *pRX, const char *pTX, unsigned int length) |
the transfer function is used to provide bus access to the stepper driver chip
| [in,out] | pIO | optional user context pointer which has been passed by the L6474_CreateInstance call |
| [out] | pRX | pointer to the receive data buffer |
| [in] | pTX | pointer to the transmit data buffer |
| [in] | length | number of bytes for RX and TX |
The behavior is schematically as follows: