1 | typedef struct
|
2 | {
|
3 | uint8_t red;
|
4 | uint8_t green;
|
5 | uint8_t blue;
|
6 |
|
7 | uint8_t state;
|
8 | }colors_t;
|
Hallo,
ist es möglich mit einem "union" die 3 x Member aus dem struct zu
beeinflussen?
Ich möchte gerne mit einer Variable alle 3 aufeinmal herunter zählen.
Pseudocode..
1 | colors_t color;
|
2 | color.red = 10;
|
3 | color.green = 10;
|
4 | color.blue = 10;
|
5 |
|
6 | for( uint8_t i = 0 ; i < 10 ; i++)
|
7 | {
|
8 | color.union.alle_drei--;
|
9 | }
|
Wie stellt man das mit einem Union an? Die andere Variable (state) im
"struct" soll nicht beeinflusst werden.
Danke für Hilfe.