diff --git a/src/device.c b/src/device.c index 455f854..caa1d90 100644 --- a/src/device.c +++ b/src/device.c @@ -1,15 +1,21 @@ -#include "device.h" #include -static void pressPwrMethod(Device_t *device) { +#include "device.h" + + +// these functions are where the bulk of the ugliness happens +// these function just pass through and call the method that +// is defined within the state structs methods + +void pressPwrButton(Device_t *device) { device->state.methods.pressPwr(device); } -static void pressStrInputMethod(Device_t *device) { +void pressStrInputButton(Device_t *device) { device->state.methods.pressStrInput(device); } -static void pressLockMethod(Device_t *device) { +void pressLockButton(Device_t *device) { device->state.methods.pressLock(device); } @@ -17,12 +23,6 @@ void initDevice(Device_t* device) { *device = (Device_t){ .state = NULL, .entered_string = "frogs", - .entered_string_len = 6, - .methods = (DeviceInterface_t){ - .pressPwr = &pressPwrMethod, - .pressStrInput = &pressStrInputMethod, - .pressLock = &pressLockMethod, - }, }; }