Quick question, I have a user defined structure MyData.
typedef struct {
char strStart[25];
char messageType;
char errorCode;
char wordCount;
unsigned short RxBuffer[1];
}MyData;
MyData DATxBuffer;
MyData *ptr_DATxBuffer;
Now I do:-
// Pointer to the data structure
ptr_DATxBuffer = &DATxBuffer;
Now I would like to use an array - circular buffers so how do I set the current pointer to the correct buffer?
MyData DATxBuffer[10]; // 10 buffers
MyData *ptr_DATxBuffer;
Now do I do:-
// Pointer to the data structure
int currentBuffer = 0;
.
.
.
while(1)
{
ptr_DATxBuffer = &DATxBuffer[currentBuffer];
.
.
SendData(ptr_DATxBuffer);
currentBuffer++;
if(currentBuffer > 10)
currentBuffer = 0;
.
.
}
typedef struct {
char strStart[25];
char messageType;
char errorCode;
char wordCount;
unsigned short RxBuffer[1];
}MyData;
MyData DATxBuffer;
MyData *ptr_DATxBuffer;
Now I do:-
// Pointer to the data structure
ptr_DATxBuffer = &DATxBuffer;
Now I would like to use an array - circular buffers so how do I set the current pointer to the correct buffer?
MyData DATxBuffer[10]; // 10 buffers
MyData *ptr_DATxBuffer;
Now do I do:-
// Pointer to the data structure
int currentBuffer = 0;
.
.
.
while(1)
{
ptr_DATxBuffer = &DATxBuffer[currentBuffer];
.
.
SendData(ptr_DATxBuffer);
currentBuffer++;
if(currentBuffer > 10)
currentBuffer = 0;
.
.
}