I want to be able to access the arrays and variables with pointers. So I made an array of pointers to those arrays and variables. But it doesnt seem to compile right. Where do I go wrong? (c++, atmel, avrstudio)
volatile uint8_t lfo1Clock = 0;
volatile uint8_t lfo2Clock = 0;
volatile uint8_t lfo3Clock = 0;
volatile uint8_t lfo4Clock = 0;
volatile uint8_t lfo5Clock = 0;
volatile uint8_t lfo6Clock = 0;
uint8_t lfo1[5]={4,0,0,0,0};
uint8_t lfo2[5]={4,0,0,0,0};
uint8_t lfo3[5]={4,0,0,0,0};
uint8_t lfo4[5]={4,0,0,0,0};
uint8_t lfo5[5]={4,0,0,0,0};
uint8_t lfo6[5]={4,0,0,0,0};
uint16_t *lfoList [] = {lfo1,lfo2,lfo3,lfo4,lfo5,lfo6};
uint16_t *lfoClockList [] = {lfo1Clock,lfo2Clock,lfo3Clock,lfo4Clock,lfo5Clock,lfo6Clock};
Thanks for any advice.
Your first array is an array of uint16_t pointers, but it's pointing to uint8_t arrays. It should be something like this:
Your second array is also an array of pointers of the wrong type, but it also contains simple uint8_t instances which wouldn't work even if the type was correct.
If it's just meant to be an array of uint8_t instances, I suspect you want this:
If you actually did need the second array to be an array of uint8_t pointers, then you'll need to take the address of each of those items. And I think you need to use
volatilein the array definition for the type to be compatible.