So I have a list of clockings in my udata in, let's say, clock.c
.
I have read that udata has to be accessed through a pointer, well okay, fair enough.
Above defines.h
//Warning! This has to be conform the linkerscript, you can not just increase it.
#define CLOCKINGLISTLENGTH 50
#define KEYLENGTH 6
//A clocking consists out of a key, time and in/out (and status)
//All the clockings together are the "clockings" list.
//These clockings will await to be transmitted.
typedef struct
{
unsigned isActive:1;
unsigned needsTransmit:1;
unsigned inOut:1;
unsigned val1:1;
unsigned val2:1;
unsigned val3:1;
unsigned val4:1;
unsigned val5:1;
} byte;
typedef struct
{
byte bits;
unsigned char key[KEYLENGTH];
unsigned char time[6];
} Clocking;
Above clock.c
file.
#include "defines.h"
#pragma udata large_udata
Clocking clocking_queue[CLOCKINGLISTLENGTH];
#pragma udata
Clocking *clockings = clocking_queue;//Access udata through pointer!
In eeprom.c
file.
#include "defines.h"
extern Clocking *clockings;
void writeClockingToEEPROM(char clockingIndex){
int eepromIndex = 0;
Write_b_eep(eepromIndex,clockings[clockingIndex].key[0]);
}
So my question is: "How to access udata from another file through a pointer". I simply want to use my clockings_queue (which should be accessed through *clockings pointer) in my EEPROM.c, so that I can store clockings in EEPROM.