Hi all,
I am using Kinetis K60F MK60FN1M0 with CodeWarrior for MCU v10.6.
I am trying to show some text on my LCD display but i get the following warning message:
passing argument 5 of 'D4D_DrawTextRectTabAdvXY' from incompatible pointer type [enabled by default]
i call the function like this:
(1) uint8_t Text[ ] = "Hello";
(2) D4D_ClearScreen(D4D_COLOR_SYSTEM_BCKG);
(3) D4D_DrawTextRectXY(50, 50, 150, 150, (char*) Text, D4D_COLOR_RED, D4D_COLOR_BLACK);
In line (3) i become the warning message. According to the DRM116 - PDF from NXP 'Text' have to be a pointer to a text buffer.
Have someone any idea what i am doing wrong?
Best Regards
Armend
Solved! Go to Solution.
Hi Armend Gecaj
If you go to definition of D4D_DrawTextRectXY() function you can find:
#define D4D_DrawTextRectXY(x1, y1, x2, y2, buffText, colorText, colorBkgd) D4D_DrawTextRectTabXY(x1, y1, x2, y2, buffText, NULL, colorText, colorBkgd)
And the definition of D4D_DrawTextRectTabXY() function is:
void D4D_DrawTextRectTabXY(D4D_COOR x1, D4D_COOR y1, D4D_COOR x2, D4D_COOR y2, D4D_STRING* buffText, D4D_TAB* pTab, D4D_COLOR colorText, D4D_COLOR colorBkgd)
{
D4D_POINT tmp_point;
D4D_SIZE tmp_size;
tmp_point.x = x1;
tmp_point.y = y1;
tmp_size.cx = (D4D_COOR)(x2 - x1);
tmp_size.cy = (D4D_COOR)(y2 - y1);
D4D_DrawTextRectTab( &tmp_point, &tmp_size, buffText, pTab, colorText, colorBkgd);
}
where you can see that Text has to be a of type D4D_STRING*. As you can actually find D4D_STRING is a structure:
typedef struct D4D_STRING_S
{
D4D_TCHAR *pText; ///< pointer to text array
D4D_INDEX buffSize; ///< size of text buffer array
D4D_FONT fontId; ///< index of used font
D4D_STR_PROPERTIES *str_properties; ///< pointer to string properties
D4D_INDEX printLen; ///< Length of string that should be used (printed).
D4D_INDEX printOff; ///< Offset of string that should be used (printed).
}D4D_STRING;
So, this is why you got the warning message, because you are from a (char *) to a D4D_STRING definition.
Hope this could helps you.
Have a great day,
Jorge Alcala
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Armend Gecaj
If you go to definition of D4D_DrawTextRectXY() function you can find:
#define D4D_DrawTextRectXY(x1, y1, x2, y2, buffText, colorText, colorBkgd) D4D_DrawTextRectTabXY(x1, y1, x2, y2, buffText, NULL, colorText, colorBkgd)
And the definition of D4D_DrawTextRectTabXY() function is:
void D4D_DrawTextRectTabXY(D4D_COOR x1, D4D_COOR y1, D4D_COOR x2, D4D_COOR y2, D4D_STRING* buffText, D4D_TAB* pTab, D4D_COLOR colorText, D4D_COLOR colorBkgd)
{
D4D_POINT tmp_point;
D4D_SIZE tmp_size;
tmp_point.x = x1;
tmp_point.y = y1;
tmp_size.cx = (D4D_COOR)(x2 - x1);
tmp_size.cy = (D4D_COOR)(y2 - y1);
D4D_DrawTextRectTab( &tmp_point, &tmp_size, buffText, pTab, colorText, colorBkgd);
}
where you can see that Text has to be a of type D4D_STRING*. As you can actually find D4D_STRING is a structure:
typedef struct D4D_STRING_S
{
D4D_TCHAR *pText; ///< pointer to text array
D4D_INDEX buffSize; ///< size of text buffer array
D4D_FONT fontId; ///< index of used font
D4D_STR_PROPERTIES *str_properties; ///< pointer to string properties
D4D_INDEX printLen; ///< Length of string that should be used (printed).
D4D_INDEX printOff; ///< Offset of string that should be used (printed).
}D4D_STRING;
So, this is why you got the warning message, because you are from a (char *) to a D4D_STRING definition.
Hope this could helps you.
Have a great day,
Jorge Alcala
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------