qwrtyuo
This commit is contained in:
parent
d105acd14f
commit
9e4ada6897
1
.gitignore
vendored
1
.gitignore
vendored
@ -116,3 +116,4 @@ _deps
|
|||||||
c/build
|
c/build
|
||||||
!c/Makefile
|
!c/Makefile
|
||||||
go/go_p2fa.h
|
go/go_p2fa.h
|
||||||
|
c/libs/go_p2fa.h
|
@ -76,7 +76,7 @@ extern "C" {
|
|||||||
|
|
||||||
extern __declspec(dllexport) void loadConfigs();
|
extern __declspec(dllexport) void loadConfigs();
|
||||||
extern __declspec(dllexport) GoSlice getConfigNames();
|
extern __declspec(dllexport) GoSlice getConfigNames();
|
||||||
extern __declspec(dllexport) GoString getCode(GoString configName);
|
extern __declspec(dllexport) char* getCode(GoString configName);
|
||||||
extern __declspec(dllexport) GoUint64 getTimeRemaining(GoInt n);
|
extern __declspec(dllexport) GoUint64 getTimeRemaining(GoInt n);
|
||||||
extern __declspec(dllexport) GoUint64 getTimeRemainingMS(GoInt n);
|
extern __declspec(dllexport) GoUint64 getTimeRemainingMS(GoInt n);
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ int draw() {
|
|||||||
Paint_Clear(WHITE);
|
Paint_Clear(WHITE);
|
||||||
const char *confName = "default";
|
const char *confName = "default";
|
||||||
GoString confStr = {confName, strlen(confName)};
|
GoString confStr = {confName, strlen(confName)};
|
||||||
Paint_DrawString(5, 5, getCode(confStr).p, &Font24, WHITE, BLACK);
|
const char *code = getCode(confStr);
|
||||||
|
Paint_DrawString(5, 5, code, &Font24, WHITE, BLACK);
|
||||||
|
|
||||||
DEV_Delay_ms(5000);
|
DEV_Delay_ms(5000);
|
||||||
|
|
||||||
|
@ -133,10 +133,11 @@ func getConfigNames() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//export getCode
|
//export getCode
|
||||||
func getCode(configName string) string {
|
func getCode(configName string) *C.char {
|
||||||
code := configs[configName].TOTP()
|
code := configs[configName].TOTP()
|
||||||
|
cCode := C.CString(code)
|
||||||
runtime.KeepAlive(code)
|
runtime.KeepAlive(code)
|
||||||
return code
|
return cCode
|
||||||
}
|
}
|
||||||
|
|
||||||
//export getTimeRemaining
|
//export getTimeRemaining
|
||||||
|
Loading…
Reference in New Issue
Block a user