Updated rx_fsm lurking RS-485 monitor application for Win32.
This commit is contained in:
@@ -37,11 +37,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Linux includes */
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
/* Windows includes */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define STRICT 1
|
||||
#include <windows.h>
|
||||
|
||||
/* local includes */
|
||||
#include "bytes.h"
|
||||
@@ -53,16 +52,11 @@
|
||||
|
||||
/* local port data - shared with RS-485 */
|
||||
volatile struct mstp_port_struct_t MSTP_Port;
|
||||
|
||||
|
||||
void *milliseconds_task(void *pArg)
|
||||
{
|
||||
struct timespec timeOut,remains;
|
||||
|
||||
timeOut.tv_sec = 0;
|
||||
timeOut.tv_nsec = 10000000; /* 1 milliseconds */
|
||||
|
||||
for (;;) {
|
||||
nanosleep(&timeOut, &remains);
|
||||
Sleep(1);
|
||||
dlmstp_millisecond_timer();
|
||||
}
|
||||
|
||||
@@ -82,7 +76,7 @@ uint16_t dlmstp_put_receive(
|
||||
(void)src;
|
||||
(void)pdu;
|
||||
(void)pdu_len;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -136,19 +130,22 @@ int main(void)
|
||||
{
|
||||
volatile struct mstp_port_struct_t *mstp_port;
|
||||
int rc = 0;
|
||||
pthread_t hThread;
|
||||
|
||||
unsigned long hThread = 0;
|
||||
uint32_t arg_value = 0;
|
||||
|
||||
/* mimic our pointer in the state machine */
|
||||
mstp_port = &MSTP_Port;
|
||||
/* initialize our interface */
|
||||
RS485_Set_Interface("/dev/ttyS0");
|
||||
RS485_Set_Interface("COM4");
|
||||
RS485_Set_Baud_Rate(38400);
|
||||
RS485_Initialize();
|
||||
MSTP_Init(mstp_port);
|
||||
mstp_port->Lurking = true;
|
||||
/* start our MilliSec task */
|
||||
rc = pthread_create(&hThread, NULL, milliseconds_task, NULL);
|
||||
hThread = _beginthread(milliseconds_task,4096,&arg_value);
|
||||
if (hThread == 0) {
|
||||
fprintf(stderr, "Failed to start timer task\n");
|
||||
}
|
||||
/* run forever */
|
||||
for (;;) {
|
||||
RS485_Check_UART_Data(mstp_port);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="rx_fsm" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin\Debug\rx_fsm.exe" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
<Add option="-DBIG_ENDIAN=0" />
|
||||
<Add option="-DBACDL_MSTP=1" />
|
||||
<Add directory="." />
|
||||
<Add directory="..\..\" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin\Release\rx_fsm.exe" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
</Compiler>
|
||||
<Unit filename="..\..\crc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\crc.h" />
|
||||
<Unit filename="mstp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="mstp.h" />
|
||||
<Unit filename="rs485.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="rs485.h" />
|
||||
<Unit filename="rx_fsm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="stdbool.h" />
|
||||
<Unit filename="stdint.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
Reference in New Issue
Block a user