-// SilentTimer Action Figure communication library
+// SilentTimer Action Figure communication library, v1.0
// libstaf.c
//
-// 03.07.2020
+// 14.12.2020
// Copyright (C) 2020 Balthasar Szczepański
//
// This program is free software: you can redistribute it and/or modify
return status;
}
- tcflush(fd,TCIOFLUSH);
+ tcflush(fd,TCIFLUSH);
status = stafSendFrame(fd, command, dataOut, lengthOut);
if(status != 0)
if (display != NULL)
{
+ if (pinout==NULL)
+ return ERR_MISSING_POINTER;
+
*display = 0;
for(i=0; i<4; ++i)
{
uint8_t outdata[4];
int i,j;
+ if (pinout==NULL)
+ return ERR_MISSING_POINTER;
+
for(i=0; i<4; ++i)
{
outdata[i]=0xff;
if (status != 0)
return status;
- *value = indata[0];
+ if (value != NULL)
+ *value = indata[0];
if (restoreState)
{
return status;
}
- outdata[4] |= operation & calc_mask;
+ outdata[4] = operation & calc_mask;
status=stafEncodeCalculationArgument (b, outdata, &flags);
if (status != 0)
// SilentTimer Action Figure communication library
-// libstaf.h
+// libstaf.h, v1.0
//
// 03.07.2020
// Copyright (C) 2020 Balthasar Szczepański
#include "libstaf.h"
-//just a test...
+//just a test of all functions...
int main (int argc, char *argv[])
{
struct tm *now;
- fd = stafConnect("/dev/ttyUSB0");
+ fd = stafConnect("/dev/ttyS0");
printf("Connect: %d\n",fd);
if(fd<0)
stafSetYear(fd, NULL, now->tm_year+1900, 0);
stafClearAlarm(fd, NULL, 0);
+ // usleep(3000000);
+
a = stafSetMode(fd, NULL, mode_reset);
printf("Reset: %d\n",a);