CPlay/unions/unions.c
2025-08-24 12:46:47 +02:00

16 lines
334 B
C

#include <stdint.h>
typedef enum {
CMD_SET_LEVEL = 1,
CMD_SET_LIGHTS = 2,
CMD_SET_DIST = 3,
} command_t;
typedef struct Message {
uint8_t type;
union {
struct { uint8_t level; } set_level;
struct { uint8_t on; } set_lights;
struct { float distance; } set_distance;
} data;
} Message;