RTC Date and Time Display Issues on Tera Term with Format and Pointer Errors
Good day everyone, my aim is to showcase the RTC date and time on Tera Term; however, I am facing errors that are explained in the code below. Furthermore, no information is appearing on Tera Term. My approach involves using pointers according to SetDate and GetDate declarations. Nonetheless, there have been warnings such as:
1.
format '%d' expects a matching 'int' argument [-Wformat=]
2. passing argument 2 of 'HAL_RTC_GetDate' from incompatible pointer type [-Wincompatible-pointer-types]
3. passing argument 2 of 'HAL_RTC_SetDate' from incompatible pointer type [-Wincompatible-pointer-types]
Here’s the code I'm working with:
How can I resolve these errors and warnings?2 Replies
Hey @Sterling In C in your project, you cannot initialize structure members directly within the structure definition. Instead, you should define the structure and then create an instance of it.
Another error that's occurring in your project,You're trying to use a pointer to a
uint8_t
to point to a structure (Date_struct)
. This error is causing the warnings about incompatible pointer types.
Here’s a corrected version of your code that addresses the above issues:
Woah, that’s loaded… thanks @UC GEE