/* I Use for the Fist time KDSK with Processor Expert. I was able to easily create a project, create and configure LDD Component, Generated software,built the project, define and use new fonction, use generated events files
BUT I D'ONT UNDERSTAND HOW TO COMPLETE THE ARGUMENTS OF A GENERATED FONCTION.
For exemple I create a Master SPI LDD COmponent called My_SPI and I try to use the generated fileMy_SPI_SendBlock(); Below are 4 diefferents Try all Wrong.
*/
#ifdef MY_SPI_TRY1
/*Fonction is copy and paste from file My_SPI.h*/
** ===================================================================
** Method : My_SPI_SendBlock (component SPIMaster_LDD)
*/
/*!
** @brief
** This method sends a block of characters. The method returns
** ERR_BUSY when the previous block transmission is not
** completed. The method <CancelBlockTransmission> can be used
** to cancel a transmit operation.
** @param
** DeviceDataPtr - Device data structure
** pointer returned by <Init> method.
** @param
** BufferPtr - Pointer to the block of data
** to send.
** @param
** Size - Number of characters in the buffer.
** @return
** - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active clock configuration
** ERR_DISABLED - Component is disabled
** ERR_BUSY - The previous transmit request is
** pending
*/
/* ===================================================================*/
uint16_t Size=3;
LDD_TError My_SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *Com_depart_SPIPtr, uint16_t Size);
/*1) This Solution is accepted by the build Project Process but looks like a new protype and not a parameter allocation */
#endif // MY_SPI_TRY1
#ifdef MY_SPI_TRY2
/*Fonction is copy and paste from file My_SPI.h*/
uint16_t Size=3;
LDD_TError My_SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *Com_depart_SPI[0]Ptr, uint16_t Size);
/*2) This Solution is rejected by the build Project Process: expected ';', ',' or ')' */
#endif // MY_SPI_TRY2
#ifdef MY_SPI_TRY3
/*Fonction is copy and paste from file My_SPI.h*/
LDD_TError My_SPI_SendBlock(#ifdef MY_SPI_TRY3
LDD_TError My_SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *Com_depart_SPIPtr, 3);
/*3) This Solution is rejected by the build Project Process: expected declaration specifiers or '...' before numeric constant */
#endif // MY_SPI_TRY3);
#ifdef MY_SPI_TRY4
/*Fonction is drag from Component file My_SPI:SPIMaster_LDD*/
My_SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *Com_depart_SPIPtr, 3);
/*4) This Solution is rejected by the build Project Process:
expected expression before 'LDD_TDeviceData'
too few arguments to function 'My_SPI_SendBlock' */
#endif // MY_SPI_TRY4
/* I find out no documentation to explain how to use these parameters. Could somebody help me. Thanks a lot .Robert */
Solved! Go to Solution.
Hi,
It seems that you are using an LDD component driver and not and KSDK driver.
These components use the Processor Expert drivers known as LDD; commonly these drivers has the same structure, when are for Communication peripheral components such as SPI, UART or I2C. The common function looks like:
Function_to_send_data(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
where the parameters are:
• DeviceDataPtr: Pointer to LDD_TDeviceData - Device data structure pointer returned by Init method.
• BufferPtr: Pointer to LDD_TData - Pointer to the block of data to send.
• Size:uint16_t - Number of characters in the buffer.
Here is an example of the typical usage of this function:
LDD_TDeviceData *MySPIPtr;
uint8_t OutData[4] = "0123";
uint8_t size = 4; or #define SIZE 4
MySPIPtr = SM1_Init(NULL);
SM1_SendBlock(MySPIPtr, OutData, SIZE);
If you have installed KDS v1.1.1 you can find the Component User Guide under this path:
<install_folder>\KDS_1.1.1\eclipse\ProcessorExpert\Help\ComponentUserGuides
There you can find a document for each LDD component including typical usage examples.
I hope this information can help you.
Regards,
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------
Hi,
It seems that you are using an LDD component driver and not and KSDK driver.
These components use the Processor Expert drivers known as LDD; commonly these drivers has the same structure, when are for Communication peripheral components such as SPI, UART or I2C. The common function looks like:
Function_to_send_data(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
where the parameters are:
• DeviceDataPtr: Pointer to LDD_TDeviceData - Device data structure pointer returned by Init method.
• BufferPtr: Pointer to LDD_TData - Pointer to the block of data to send.
• Size:uint16_t - Number of characters in the buffer.
Here is an example of the typical usage of this function:
LDD_TDeviceData *MySPIPtr;
uint8_t OutData[4] = "0123";
uint8_t size = 4; or #define SIZE 4
MySPIPtr = SM1_Init(NULL);
SM1_SendBlock(MySPIPtr, OutData, SIZE);
If you have installed KDS v1.1.1 you can find the Component User Guide under this path:
<install_folder>\KDS_1.1.1\eclipse\ProcessorExpert\Help\ComponentUserGuides
There you can find a document for each LDD component including typical usage examples.
I hope this information can help you.
Regards,
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------
Hi, thanks a lot. Extremely clear.
Just a side question : Yes I am using an LDD component driver and not and KSDK driver.But what do you means by using the KSDK driver.
Is it using an OS Component like MQXlite for exemple ?
Best Regards
Hi,
Have a look at this conversation, it would probably solves your queries.
Best Regards,
Adrian