cancel
Showing results for 
Search instead for 
Did you mean: 

Calling RTC_Init

giambattista
Associate
Posted on June 27, 2011 at 12:13

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 much

3 REPLIES 3
Posted on June 28, 2011 at 08:23

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;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
giambattista
Associate
Posted on June 29, 2011 at 08:47

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 '

Posted on June 30, 2011 at 05:17

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..