This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541 get Timestamp using OSAL_Clock

Hi,

I'm trying to get the Timestamp using OSAL_Clock lib.

I tried declaring firstly two variables in order to handle what I'm going to get from the calls to the functions:

UTCTime timestamp;
UTCTimeStruct timestampstruct;

After that, in a periodic event function I want to get the timestamp every 5 seconds like this:

timestamp=osal_getClock(); // get the ms from the initial date set
osal_ConvertUTCTime( &timestampstruct, timestamp ); //to have the RTC as struct, easier to handle

ptext[15]=timestampstruct.seconds; //being text an uint8 in order to store the seconds.

And seems not to work well. May be it could be because in the doc says that I must enable the OSAL_CLOCK compiler flag to use this feature and I haven't done this. How can I enable this flag if it's the reason why it isn't working for me?

Regards

Iván Gómez Bustinduy

  • Hi,

    I am not much aware of this issue but if you want to add compiler flag you can do :

    1. Goto Project->Option. 

    2. click on "C/C++ compiler" and goto "Preprocessor" tab on right hand side.

    3. Add "OSAL_CLOCK" in defined symbol list. (outlined as below) you can write there in new line.

    Shown below:

    -----------------------------------------------------------------------------------------

    Press "Verify" option if your question is answered.