Created
November 20, 2021 16:37
-
-
Save repen/ee2628b3ad240d1fc4932b03c075d1f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MESSAGE_QUANTITY 10; | |
struct LEDMessage{ | |
char led_code; | |
char value; | |
unsigned int hash_sum; | |
}; | |
union UMessage{ | |
char bytes[60]; | |
struct LEDMessage message_array[10]; | |
}; | |
struct LEDMessage message_provider(char code, char val, unsigned int hash); | |
void accumulated_messages(void); | |
int main() { | |
union UMessage messages; | |
struct LEDMessage msg = message_provider(1, 0, 0xDD3322AA); | |
printf("%d\n", msg.led_code); | |
for (int i = 0; i < 10; ++i) { | |
messages.message_array[i] = message_provider(1 + i, 0, 0xDD3322AA); | |
} | |
for (int i = 0; i < 60; ++i) { | |
printf("index[%d]Byte: %d\n", i, messages.bytes[i]); | |
} | |
// accumulated_messages(); | |
return 0; | |
} | |
struct LEDMessage message_provider(char code, char val, unsigned int hash){ | |
struct LEDMessage temp = {code, val, hash}; | |
return temp; | |
}; | |
void accumulated_messages(){ | |
for (int i = 0; i < 10; i++) { | |
printf("i = %d\n", i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment