Page 1 of 1
Doubt
Posted: Thu Mar 26, 2020 2:47 am
by aaperezd
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
Re: Doubt
Posted: Fri Mar 27, 2020 12:08 am
by Moray
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;
Re: Doubt
Posted: Fri Mar 27, 2020 4:14 pm
by TomKerekes
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
Re: Doubt
Posted: Fri Mar 27, 2020 6:39 pm
by aaperezd
Many thanks!!!
I will read everything they sent me!