diff --git a/tinio/library/libcyusbserial.so.1 b/tinio/library/libcyusbserial.so.1 new file mode 100755 index 0000000..4eb942e Binary files /dev/null and b/tinio/library/libcyusbserial.so.1 differ diff --git a/tinio/testUtility/CyUSBSerialCommandUtility b/tinio/testUtility/CyUSBSerialCommandUtility new file mode 100755 index 0000000..f834df2 Binary files /dev/null and b/tinio/testUtility/CyUSBSerialCommandUtility differ diff --git a/tinio/tinio b/tinio/tinio new file mode 100755 index 0000000..1faf90a Binary files /dev/null and b/tinio/tinio differ diff --git a/tinio/tinio.c b/tinio/tinio.c new file mode 100644 index 0000000..328de9d --- /dev/null +++ b/tinio/tinio.c @@ -0,0 +1,40 @@ +// TinI/O code rewrite of 2019 - fixing a kid's mistakes +// This code is licensed under the ISC license +#include +#include +#include "header/CyUSBSerial.h" +#include + +typedef enum inErr { + USAGE = 0, + INVALID +} inErr; + +void cyErrHandler(CY_RETURN_STATUS err); +void inErrHandler(inErr err); + +bool setPin(CY_HANDLE h, int pinNumber, bool value) { + assert(pinNumber <= 11); // sanity checks, should be sanitized in the parser + assert(pinNumber >=0); + CY_RETURN_STATUS err = CySetGpioValue(h, pinNumber, value); + if (err) cyErrHandler(err); + return value; +} + +bool getPin(CY_HANDLE h, int pinNumber){ + assert(pinNumber <= 11); // sanity checks, should be sanitized in the parser + assert(pinNumber >=0); +} + +bool flpPin(CY_HANDLE h, int pinNumber) { + assert(pinNumber <= 11); // sanity checks, should be sanitized in the parser + assert(pinNumber >=0); + bool val = getPin(h, pinNumber); + val = !val; + setPin(h, pinNumber, val); + return val; +} + + +void parser(int argc, char **args); +int main(int argc, char **args); diff --git a/tinio/tinio.cpp b/tinio/tinio.cpp index 7eeb7cf..ff905d4 100644 --- a/tinio/tinio.cpp +++ b/tinio/tinio.cpp @@ -18,7 +18,6 @@ const CY_VID_PID deviceVidPid{UINT16(0x04b4), uint8_t deviceNumList[maxDevs]; uint8_t deviceCount; CY_DEVICE_INFO deviceInfoList[maxDevs]; - // vars for deviceOpen function CY_HANDLE deviceHandleList[maxDevs];