Skip to content

Commit

Permalink
Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Apr 14, 2024
1 parent 7ac58d7 commit 6bbd7d5
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
9 changes: 9 additions & 0 deletions application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ App(
sources=[
"*.c",
"aeabi_uldivmod.sx",
"!plugin*.c",
],
fap_icon="icons/logo.png",
fap_category="NFC",
Expand All @@ -39,3 +40,11 @@ App(
fap_weburl="https://seader.ericbetts.dev",
fap_icon_assets="icons",
)

App(
appid="plugin_wiegand",
apptype=FlipperAppType.PLUGIN,
entry_point="plugin_wiegand_ep",
requires=["seader"],
sources=["plugin_wiegand.c"],
)
19 changes: 19 additions & 0 deletions plugin_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @file plugin_interface.h
* @brief Example plugin interface.
*
* Common interface between a plugin and host application
*/
#pragma once

#include <stdint.h>
#include <stddef.h>

#define PLUGIN_APP_ID "plugin_wiegand"
#define PLUGIN_API_VERSION 1

typedef struct {
const char* name;
int (*count)(uint8_t, uint64_t);
int (*description)(uint8_t, uint64_t, size_t);
} PluginWiegand;
37 changes: 37 additions & 0 deletions plugin_wiegand.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

#include "plugin_interface.h"

#include <flipper_application/flipper_application.h>

static int wiegand_format_count(uint8_t bit_length, uint64_t bits) {
UNUSED(bit_length);
UNUSED(bits);
return 1337;
}

static int wiegand_format_description(uint8_t bit_length, uint64_t bits, size_t index) {
UNUSED(bit_length);
UNUSED(bits);
UNUSED(index);

return 0;
}

/* Actual implementation of app<>plugin interface */
static const PluginWiegand plugin_wiegand = {
.name = "Plugin Wiegand",
.count = &wiegand_format_count,
.description = &wiegand_format_description,
};

/* Plugin descriptor to comply with basic plugin specification */
static const FlipperAppPluginDescriptor plugin_wiegand_descriptor = {
.appid = PLUGIN_APP_ID,
.ep_api_version = PLUGIN_API_VERSION,
.entry_point = &plugin_wiegand,
};

/* Plugin entry point - must return a pointer to const descriptor */
const FlipperAppPluginDescriptor* plugin_wiegand_ep(void) {
return &plugin_wiegand_descriptor;
}

0 comments on commit 6bbd7d5

Please sign in to comment.