29 lines
687 B
C
29 lines
687 B
C
#include "device.h"
|
|
#include <string.h>
|
|
|
|
static void pressPwrMethod(Device_t *device) {
|
|
device->state.methods.pressPwr(device);
|
|
}
|
|
|
|
static void pressStrInputMethod(Device_t *device) {
|
|
device->state.methods.pressStrInput(device);
|
|
}
|
|
|
|
static void pressLockMethod(Device_t *device) {
|
|
device->state.methods.pressLock(device);
|
|
}
|
|
|
|
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,
|
|
},
|
|
};
|
|
}
|
|
|