16 lines
334 B
C
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;
|