aboutsummaryrefslogtreecommitdiff
path: root/apps/plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugin.h')
-rw-r--r--apps/plugin.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
new file mode 100644
index 0000000..5d62b93
--- /dev/null
+++ b/apps/plugin.h
@@ -0,0 +1,56 @@
+#ifndef _PLUGIN_H_
+#define _PLUGIN_H_
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "gfx.h"
+#include "timer.h"
+
+#define LCD_WIDTH (*gfx_width)
+#define LCD_HEIGHT (*gfx_height)
+#define LCD_BLACK VGA_RGBPACK(0, 0, 0)
+#define LCD_WHITE VGA_RGBPACK(255,255,255)
+#define LCD_RGBPACK VGA_RGBPACK
+#define LOGF printf
+#define ARRAYLEN(a) (sizeof(a)/sizeof(a[0]))
+
+#define RGB_UNPACK_RED(x) ((x & 0xFF0000) >> 16)
+#define RGB_UNPACK_GREEN(x) ((x & 0xFF00) >> 8)
+#define RGB_UNPACK_BLUE(x) ((x & 0xFF) >> 0)
+
+enum plugin_status {
+ PLUGIN_OK = 0, /* PLUGIN_OK == EXIT_SUCCESS */
+ /* 1...255 reserved for exit() */
+ PLUGIN_POWEROFF,
+ PLUGIN_GOTO_WPS,
+ PLUGIN_ERROR = -1,
+};
+
+struct plugin_api {
+ void (*lcd_clear_display)(void);
+ void (*lcd_hline)(int x1, int x2, int y);
+ void (*lcd_vline)(int x, int y1, int y2);
+ void (*lcd_drawpixel)(int x, int y);
+ void (*lcd_drawline)(int x1, int y1, int x2, int y2);
+ void (*lcd_drawrect)(int x, int y, int width, int height);
+ void (*lcd_fillrect)(int x, int y, int width, int height);
+ void (*lcd_set_foreground)(unsigned foreground);
+ unsigned (*lcd_get_foreground)(void);
+ void (*lcd_set_background)(unsigned foreground);
+ unsigned (*lcd_get_background)(void);
+
+ void (*srand)(unsigned int seed);
+ unsigned int (*rand)(void);
+
+ void (*lcd_filltriangle)(int, int, int, int, int, int);
+ void (*lcd_drawcircle)(int x, int y, int r);
+ void (*lcd_fillcircle)(int x, int y, int r);
+ void (*lcd_update)(void);
+ void (*lcd_putsxy)(int x, int y, const char*);
+};
+
+/* defined by the plugin */
+extern const struct plugin_api *rb;
+
+#endif