added more comments

This commit is contained in:
sirlilpanda
2025-08-29 00:11:41 +12:00
parent 034d87394e
commit 4734b778d8

View File

@@ -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);