c - Using a register in a struct -


I am trying to set up a structure that has a register, pin number, and ADC value. I want to change the value of the register by using a function called setLED. However, I am getting errors saying this.

  Expression should have an expression of integral type should be type of indicator  

This is my structure LED_X and the ports have been defined above.

  typedef struct {const uint32_t pins; Unstable uint32_t * const reg; Uint32_t adcValue; } LED_LUT; #define LED_LUT_DEF {{LED_0, (volatile uint32_t *) GPIO_PORTC_DATA_R, 0}, \ {LED_1, (volatile uint32_t *) GPIO_PORTC_DATA_R, 0}, \ {LED_2, (volatile uint32_t *) GPIO_PORTC_DATA_R, 0}, \ {LED_3, ( GPIO_PORTC_DATA_R, {} LED_4, (unstable uint32_t *) GPIO_PORTF_DATA_R, 0}, \ {LED_5, (volatile uint32_t *) GPIO_PORTF_DATA_R, 0}, \ {LED_6, (volatile uint32_t *) GPIO_PORTF_DATA_R, 0}, \ {LED_7 (volatile uint32_t *) GPIO_PORTF_DATA_R, 0},}  

and here function receives errors collection that is:

  void setLEDs (LED_LUT Leading LUT [NUM_OF_LEDS]) for {int i; (I = 0; I & lt; NUM_OF_LEDS; ++ i), // set the threshold above, otherwise this is not clear That (ledLUT [i] .adcValue & gt; ADC_THRESHOLD) {ledLUT [i] - & gt; Reg | = (uint32_t *) ledLUT [i] .pin; // error here} else {ledLUT [i] - & gt ; Reg & amp; = (uint32_t *) ~ ledLUT [i] .pin; // here error}}}  

ledLUT has been started primarily:

  LED_LUT ledLUT [8] = LED_LUT_DEF;  

I think this is probably a syntax error, but I'm not sure what I'm doing wrong. I have tried casting / defining many different combinations, but they have not found the right solution.

  leads [i] - & gt; Reg | = (Uint32_t *) ledLUT [i]. PIN should be  

  * (ledLUT [i] .reg) | = (Uint32_t) ledLUT [i]. PIN  

and

  ledLUT [i] - & gt; Reg & amp; = (Uint32_t *) ~ ledLUT [i] .pin should be  

  * (ledLUT [i] .reg) & amp; = (Uint32_t) ~ ledLUT [I] .pin  

Because ledLUT is an array of strontaks, not an array of pointers.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -