diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-29 17:44:10 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-29 17:44:10 +0200 |
commit | e5a0e65c43934a803c430e53bfa4421a2861a080 (patch) | |
tree | 59fa141cb280e27b17347a0b6cfafa0c774418f6 /shared/pb/types.h | |
parent | a9a38d387f98b29b68f97b8a9c6858d2b399caf0 (diff) | |
parent | 135543d37cc075b4d9924b54f98c83eda3862d1d (diff) |
merge wip/puzbus-spec into wip/client
Diffstat (limited to 'shared/pb/types.h')
-rw-r--r-- | shared/pb/types.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/shared/pb/types.h b/shared/pb/types.h index 8150194..93e2f0c 100644 --- a/shared/pb/types.h +++ b/shared/pb/types.h @@ -24,18 +24,24 @@ extern "C" { * The first byte of a puzzle bus message's data indicates the command type. */ enum __packed pb_cmd { - PB_CMD_READ, //!< read a puzzle module property - PB_CMD_WRITE, //!< write to a puzzle module property + PB_CMD_READ, //!< read a puzzle module property + PB_CMD_WRITE, //!< write to a puzzle module property // PB_CMD_UPDATE, //!< request an update + PB_CMD_MAGIC = 0x69, //!< magic message }; +typedef enum pb_cmd pb_cmd_t; + +static const char pb_magic_msg[] = { 0x70, 0x75, 0x7a, 0x62, 0x75, 0x73 }; +static const char pb_magic_res[] = { 0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67 }; /** \brief Puzzle bus global states */ -enum __packed pb_global_state { +enum __packed pb_state { PB_GS_NOINIT, //!< uninitialized (only used by puzzle modules) PB_GS_IDLE, //!< puzzle not started yet PB_GS_PLAYING, //!< puzzle actively being solved PB_GS_SOLVED, //!< puzzle completed }; +typedef enum pb_state pb_state_t; typedef struct __packed { uint8_t address; |