Doubt

Moderators: TomKerekes, dynomotion

Post Reply
aaperezd
Posts: 11
Joined: Wed Feb 26, 2020 3:07 pm

Doubt

Post by aaperezd » Thu Mar 26, 2020 2:47 am

Hi friends,

I have a question that maybe is silly, but I could not solve it.
I try to understand where "persist.Userdata" is generated, I understand that it must be from an array, but that in between it has a point (persist (.) Userdata) already seems strange to me because according to my knowledge no points are used, which I can read to understand where those functions are ??

regards

Moray
Posts: 282
Joined: Thu Apr 26, 2018 10:16 pm

Re: Doubt

Post by Moray » Fri Mar 27, 2020 12:08 am

It is part of Dymotion's proprietary code, so the only information publicly available is the header file with the declarations, not the code behind. The header file is KMotionDef.h, which can be found in the DSP_KFLOP directory.

The relevant extract from the header file is-

Code: Select all

// This structure is set to default every time the program runs UNTIL
// the program image has been FLASHED using the FLASH command
// from then on it will not be cleared, so data that was present at the
// time it was flashed will persist     

#define N_USER_DATA_VARS 100
                    
typedef struct
{
    int RunOnStartUp; // word Bits 1-7 selects which threads to execute on startup   
    unsigned int EntryPoints[N_USER_THREADS];   // each downloaded program's entry point
    int UserData[N_USER_DATA_VARS]; // General purpose way to share and or save user program data
} PERSIST;

extern PERSIST persist;  

User avatar
TomKerekes
Posts: 2529
Joined: Mon Dec 04, 2017 1:49 am

Re: Doubt

Post by TomKerekes » Fri Mar 27, 2020 4:14 pm

Hi aaperezd,

C allows the use of data structures which are basically a grouping of variables. The "dot" operator is used to select a sub member of a data structure. The array int UserData[N_USER_DATA_VARS] is a member of the data structure PERSIST. The variable persist is one instance of the structure type PERSIST and is declared internally withing KFLOP.

Here is a reference.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

aaperezd
Posts: 11
Joined: Wed Feb 26, 2020 3:07 pm

Re: Doubt

Post by aaperezd » Fri Mar 27, 2020 6:39 pm

Many thanks!!!
I will read everything they sent me!

Post Reply