From 0349c6d6572f59770898d3f40287ebdcd2f8ed30 Mon Sep 17 00:00:00 2001 From: Gentoo Date: Sat, 27 Mar 2021 10:36:05 +1100 Subject: initial commit --- source/gecko.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 source/gecko.c (limited to 'source/gecko.c') diff --git a/source/gecko.c b/source/gecko.c new file mode 100644 index 0000000..f089027 --- /dev/null +++ b/source/gecko.c @@ -0,0 +1,31 @@ +#include "gecko.h" + +int geckoFound = 0; + +void checkForGecko() +{ + #ifdef DEBUG + geckoFound = usb_isgeckoalive(EXI_CHANNEL_1); + if(geckoFound){usb_flush(EXI_CHANNEL_1);} + #endif +} + +int gprintf(const char *str, ...) +{ + #ifdef DEBUG + if(!geckoFound){return -1;} + + char astr[2048]; + snprintf(astr, 2048, "%s\r\n", str); + + char nstr[2048]; + va_list ap; + va_start(ap, str); + int size = vsnprintf(nstr, 2047, astr, ap); + va_end(ap); + + usb_sendbuffer(1, nstr, size); + usb_flush(EXI_CHANNEL_1); + #endif + return 0; +} -- cgit v1.2.3