added some comments and removed the static keyword from the now exposed functions

This commit is contained in:
sirlilpanda
2025-09-01 23:21:39 +12:00
parent 5efd42326b
commit f73b377911

View File

@@ -1,15 +1,21 @@
#include "device.h"
#include <string.h> #include <string.h>
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); device->state.methods.pressPwr(device);
} }
static void pressStrInputMethod(Device_t *device) { void pressStrInputButton(Device_t *device) {
device->state.methods.pressStrInput(device); device->state.methods.pressStrInput(device);
} }
static void pressLockMethod(Device_t *device) { void pressLockButton(Device_t *device) {
device->state.methods.pressLock(device); device->state.methods.pressLock(device);
} }
@@ -17,12 +23,6 @@ void initDevice(Device_t* device) {
*device = (Device_t){ *device = (Device_t){
.state = NULL, .state = NULL,
.entered_string = "frogs", .entered_string = "frogs",
.entered_string_len = 6,
.methods = (DeviceInterface_t){
.pressPwr = &pressPwrMethod,
.pressStrInput = &pressStrInputMethod,
.pressLock = &pressLockMethod,
},
}; };
} }