I have four arrays of data (3072 bytes each.) I want to point to one of these arrays, so if a function were passed a pointer to these arrays, it could manipulate them, and the pointers could be s
So initially I thought of pointers-to-pointers:
uint16_t *buffer0_level[BUFF_WORDS] FAR;
uint16_t *buffer0_mask[BUFF_WORDS] FAR;
uint16_t *buffer1_level[BUFF_WORDS] FAR;
uint16_t *buffer1_mask[BUFF_WORDS] FAR;
uint16_t **draw_buffer_level;
uint16_t **draw_buffer_mask;
uint16_t **disp_buffer_level;
uint16_t **disp_buffer_mask;
And then to set the pointers I'd do something like this:
draw_buffer_level = buffer0_level;
draw_buffer_mask = buffer0_mask;
disp_buffer_level = buffer1_level;
disp_buffer_mask = buffer1_mask;
This seems to work.
However, I then want to pass the pointer to a function, fill_buffer, which fills one of the arrays with some data word.
The definition is:
void fill_buffer(uint16_t *buff, uint16_t word)
But when calling it like this:
fill_buffer(draw_buffer_level, 0x0000);
fill_buffer(draw_buffer_mask, 0x0000);
fill_buffer(disp_buffer_level, 0x0000);
fill_buffer(disp_buffer_mask, 0x0000);
GCC complains:
gfx.c:46: warning: passing argument 1 of 'fill_buffer' from incompatible pointer type
gfx.c:47: warning: passing argument 1 of 'fill_buffer' from incompatible pointer type
gfx.c:48: warning: passing argument 1 of 'fill_buffer' from incompatible pointer type
gfx.c:49: warning: passing argument 1 of 'fill_buffer' from incompatible pointer type
I'm sure it's just a stupid error, but what is it? I'm still a novice to C programming.