LibL6474-C-Library 1.0
Library Code documentation
Loading...
Searching...
No Matches
L6474x_Platform Struct Reference

#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)
 

Detailed Description

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

Field Documentation

◆ free

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.

Parameters
[in]pMempointer of the memory space which shall be freed

The behavior is schematically as follows:

◆ malloc

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.

Parameters
[in]sizenumber of bytes requested by the memory allocation request

The behavior is schematically as follows:

◆ reset

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

Parameters
[in,out]pGPOoptional user context pointer which has been passed by the L6474_CreateInstance call
[in]enaoutput state to set without level inversion

The behavior is schematically as follows:

◆ sleep

void(* L6474x_Platform::sleep) (unsigned int ms)

the sleep function implements a wait time with the argument in milliseconds

Parameters
[in]mstime to sleep in milliseconds

The behavior is schematically as follows:

◆ step

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

Parameters
[in,out]pPWMoptional user context pointer which has been passed by the L6474_CreateInstance call
[in]diroutput signal to drive the stepper clock wise or counter clockwise
[in]numPulsesnumber of high and low transitions to generate a pulse for the stepper chip

The behavior is schematically as follows:

◆ transfer

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

Parameters
[in,out]pIOoptional user context pointer which has been passed by the L6474_CreateInstance call
[out]pRXpointer to the receive data buffer
[in]pTXpointer to the transmit data buffer
[in]lengthnumber of bytes for RX and TX

The behavior is schematically as follows:


The documentation for this struct was generated from the following file: