2025-02-13 01:38 PM
Hello everybody,
I am currently programming on a STM32G0 for a screen with the st7567 driver.
I created a function to display a text.
When indicating the information on the font I have a warning from the cubeIDE compiler.
in my main.c
st7567_Write_Text_Page(25, 2, Buffer, microsoftSansSerif_8pt, INFO_microsoftSansSerif_8pt);
advertissing : passing argument 5 of 'st7567_Write_Text_Page' from incompatible pointer type [-Wincompatible-pointer-types]
The prototype's function is declared in a file named st7567_driver.h like this :
void st7567_Write_Text_Page(uint8_t , uint8_t , char* , uint8_t * , uint32_t *);
advertissing : expected 'uint32_t *' {aka 'long unsigned int *'} but argument is of type 'uint32_t (*)[3]' {aka 'long unsigned int (*)[3]'}
And the font.c like this :
const uint32_t INFO_microsoftSansSerif_8pt[][3] =
{
{2, 12, 0}, //
{1, 12, 4}, // !
{4, 12, 6}, // "
{6, 12, 14}, // #
{5, 12, 26}, // $
-
-
-
{1, 12, 838}, // |
{3, 12, 840}, // }
{6, 12, 846}, // ~
};
I don't understand why have got an advertissing, certainly because i'm a beginner.
Thank you if you can help me.
Jérémy
Solved! Go to Solution.
2025-02-13 01:57 PM
The error is happening because you are passing a pointer to a two-dimensional array while the function is expecting a regular pointer.
If you want to write all bytes you have in the array, in consecutive order, you can cast the pointer to the correct type.
st7567_Write_Text_Page(25, 2, Buffer, microsoftSansSerif_8pt, (uint32_t*)INFO_microsoftSansSerif_8pt);
2025-02-13 01:57 PM
The error is happening because you are passing a pointer to a two-dimensional array while the function is expecting a regular pointer.
If you want to write all bytes you have in the array, in consecutive order, you can cast the pointer to the correct type.
st7567_Write_Text_Page(25, 2, Buffer, microsoftSansSerif_8pt, (uint32_t*)INFO_microsoftSansSerif_8pt);
2025-02-13 02:08 PM
Thank you very much ! it's work perfectly