2011-06-27 03:13 AM
Good morning everybody!
I'm evaluating ST standard device Library with STM32L discovery board. I want to test RTC and so in my main I want to call RTC_Init and so on. So I prepare a RTC_InitType structure, I create a RTC_InitType pointer, than I do: pointer = &structure Now I call RTC_Init and I pass to it my pointer, but there is a compiler error to this instruction: pointer = &structure Why doesn't it work? How can I call routines in stm32l1xx_rtc.h? Thank you very much2011-06-27 11:23 PM
RTC_InitTypeDef RTC_InitStructure;
/* Calender Configuartion */ RTC_InitStructure.RTC_AsynchPrediv = 0x7F; RTC_InitStructure.RTC_SynchPrediv = 0xFF; RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24; RTC_Init(&RTC_InitStructure); RTC_InitTypeDef *ptr; ptr = &RTC_InitStructure; ptr->RTC_AsynchPrediv = 0x7F;2011-06-28 11:47 PM
Thank you for reply.
I adopted your solutions, but my compilers return errors (IAR and Atollic). For example see Cattura.jpg If I use the second option: RTC_InitTypeDef *ptr; ptr = &RTC_InitStructure; ptr->RTC_AsynchPrediv = 0x7F; I obtain the following errors: 1. data definition has no type or storage class 2. initialization from incompatible pointer type 3. type defaulrs to 'int' in declaration of 'ptr '2011-06-29 08:17 PM
Absent a more complete view of what's going on, I'm going to assume you have some problems with #include's, #define's or some other definition for RTC_Init.
Right click of RTC_Init, and see if the IDE provides some details about the use and definitions thereof.