Home Page

This commit is contained in:
2024-11-21 16:28:39 -05:00
parent 27ca83ad4f
commit 94843fa797
4 changed files with 81 additions and 7 deletions

View File

@@ -19,6 +19,12 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
/* Start of preamble from import "C" comments. */
#line 3 "ctils.go"
#include <stdlib.h>
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
@@ -74,8 +80,22 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
extern "C" {
#endif
/* Return type for prepareCStringArray */
struct prepareCStringArray_return {
char** r0;
GoInt r1;
};
extern __declspec(dllexport) struct prepareCStringArray_return prepareCStringArray(GoSlice goStrings);
extern __declspec(dllexport) void freeCStringArray(char** cStrings, GoInt length);
extern __declspec(dllexport) void loadConfigs();
extern __declspec(dllexport) GoSlice getConfigNames();
/* Return type for getConfigNames */
struct getConfigNames_return {
char** r0;
int r1;
};
extern __declspec(dllexport) struct getConfigNames_return getConfigNames();
extern __declspec(dllexport) char* getCode(GoString configName);
extern __declspec(dllexport) GoUint64 getTimeRemaining(GoInt n);
extern __declspec(dllexport) GoUint64 getTimeRemainingMS(GoInt n);

View File

@@ -15,6 +15,9 @@
#include "../libs/GUI/GUI_BMPfile.h"
#include "../libs/Config/Debug.h"
extern char** getConfigNames(int* length);
extern void freeCStringArray(char** cStrings, int length);
void Handler(int sigNum) {
DebugLine(28, 0, "Caught signal %d\n", sigNum);
EPD_2in13_V4_Init();
@@ -31,19 +34,35 @@ void Handler(int sigNum) {
}
void home(UWORD *blackImage) {
int length;
char** configNames = getConfigNames(&length);
if (configNames == NULL || length == 0) {
DebugLine(10, 0, "No configs found\n");
return;
}
Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 0, WHITE);
EPD_2in13_V4_Init();
Paint_SelectImage(blackImage);
Paint_Clear(WHITE);
for (int i = 0; i < length; ++i) {
Paint_DrawString(5, 5 + (i * 20), configNames[i], &Font12, WHITE, BLACK);
}
EPD_2in13_V4_Display_Base(blackImage);
freeCStringArray(configNames, length);
}
void code(UWORD *blackImage) {
int ch;
codeLoop:
while(1) {
ch = getch();
if (ch != ERR) {
if (ch == 'q') break;
DebugLine(2, 0, "Key Pressed: %c\n", ch);
DebugLine(2, 0, "Key Pressed: %c\n", ch);
}
Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
@@ -72,7 +91,7 @@ void code(UWORD *blackImage) {
for (int i = getTimeRemainingMS(30);; i = getTimeRemainingMS(30)) {
ch = getch();
if (ch != ERR) {
if (ch == 'q') break;
if (ch == 'q') return;
}
if (i > lastI) break;
startTime = clock();
@@ -117,6 +136,7 @@ int drawLoop() {
return -1;
}
home(blackImage);
code(blackImage);
return 0;