From 4734b778d83f3375fe85010eb63c16e3fb447c4e Mon Sep 17 00:00:00 2001 From: sirlilpanda <33928689+sirlilpanda@users.noreply.github.com> Date: Fri, 29 Aug 2025 00:11:41 +1200 Subject: [PATCH] added more comments --- src/device.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/device.h b/src/device.h index 8467648..ec96b7b 100644 --- a/src/device.h +++ b/src/device.h @@ -24,9 +24,10 @@ // │ │ // └────────┘ +// forward decl typedef struct Device_s Device_t; - +// the interface that you would use to interface with the state typedef struct DeviceInterface_s{ // all the actions that change the state // normally there wouldnt be any args @@ -38,12 +39,14 @@ typedef struct DeviceInterface_s{ void (*pressLock)(Device_t*); }DeviceInterface_t; +// the states themselves typedef struct DeviceState_s{ const char* state_name; Device_t* device; DeviceInterface_t methods; }DeviceState_t; +// the device struct Device_s{ // in theroy this is also the flyweight pattern DeviceState_t state; @@ -53,5 +56,5 @@ struct Device_s{ DeviceInterface_t methods; }; - +// creates the device void initDevice(Device_t* device);