![]() ![]() There shouldn't be any more issues in your function calls and the infinite while loop, just pay attention which pointers are you passing into the HAL_RTC_SetDate and HAL_RTC_GetDate functions. Change for your hw 7 SCK - A5, SDA - A4, INT - D3/INT1 8 9 After. 4 5 I used a RBBB with Arduino IDE, the pins are mapped a 6 bit differently. 2 Set the clock to a time then loop over reading time and 3 output the time and date to the serial console. I'm sure with this you can tweak your code to have it work. 1 / Demonstration of RtcPcf8563 Set Time. That's why the printf statement contains -> operators instead of just. or we can even leave the structure's name out and leave it anonymous - like you did in your code - we don't need it named at all since we already have a new type made out of it that we can use. } date_struct_type // Define and typedef a structure at the same time That code is identical to writing typedef struct date_struct In my code, I split up the structure definition and the typedef into two individual statements. That means, from that point on, you work with the structure as if it was just a variable type. In your code, you first define an anonymous local structure and immediately typedef it to create a new type. or pass a reference to the structure, but never a reference to the pointer ![]() or pass the pointer into any hypothetical function Printf("Month: %d\nDate: %d\nYear: %d\n", date_ptr->month, date_ptr->date, date_ptr->year) ![]() Den Wochentag (DOW) und die Uhrzeit umstellen funktioniert, aber das Datum will sich einfach nicht ändern lassen. Use the pointer to adress the structure's values Es steht immer auf dem, egal was ich mache. Typedef struct date_struct date_struct_type // make 'struct date_struct' into a new typeĭate_struct_type date // Declare a variable of the new typeĭate.month = 0x03 // Initialize the fields of the variableĭate_struct_type * date_ptr // Create a new pointer to the structĭate_ptr =
0 Comments
Leave a Reply. |