Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
osie
Commits
d8a5d668
Commit
d8a5d668
authored
Apr 10, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc measurement
parent
be47fac3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
coupler/cli.h
coupler/cli.h
+1
-1
coupler/keep_alive.h
coupler/keep_alive.h
+6
-1
coupler/keep_alive_subscriber.h
coupler/keep_alive_subscriber.h
+1
-5
coupler/mod_io_opc_ua.h
coupler/mod_io_opc_ua.h
+3
-0
coupler/server.c
coupler/server.c
+1
-1
No files found.
coupler/cli.h
View file @
d8a5d668
...
@@ -199,7 +199,7 @@ void handleCLI(int argc, char **argv) {
...
@@ -199,7 +199,7 @@ void handleCLI(int argc, char **argv) {
// update current measurement mode
// update current measurement mode
const
char
*
s
=
getenv
(
"CURRENT_GPIO_MODE"
);
const
char
*
s
=
getenv
(
"CURRENT_GPIO_MODE"
);
if
(
s
!=
NULL
)
CURRENT_GPIO_MODE
=
1
;
if
(
s
!=
NULL
)
CURRENT_GPIO_MODE
=
atoi
(
s
)
;
printf
(
"GPIO measurement mode = %d
\n
"
,
CURRENT_GPIO_MODE
);
printf
(
"GPIO measurement mode = %d
\n
"
,
CURRENT_GPIO_MODE
);
}
}
...
...
coupler/keep_alive.h
View file @
d8a5d668
...
@@ -20,7 +20,12 @@ static unsigned int SAFE_MODE_STATE_COUNTER = 0;
...
@@ -20,7 +20,12 @@ static unsigned int SAFE_MODE_STATE_COUNTER = 0;
// the current GPI state (used for debuging)
// the current GPI state (used for debuging)
static
unsigned
int
CURRENT_GPIO_STATE
=
0
;
static
unsigned
int
CURRENT_GPIO_STATE
=
0
;
// variable representing the measurement over GPIO
/*
* variable representing the measurement mode over GPIO
* 0: disabled
* 1: enabled for keep-alive subsystem
* 2: enabled for first i2c0.relay0
*/
static
unsigned
int
CURRENT_GPIO_MODE
=
0
;
static
unsigned
int
CURRENT_GPIO_MODE
=
0
;
// the heart beat interval (in ms)
// the heart beat interval (in ms)
...
...
coupler/keep_alive_subscriber.h
View file @
d8a5d668
...
@@ -61,10 +61,6 @@ static int setGPIO() {
...
@@ -61,10 +61,6 @@ static int setGPIO() {
if
(
ioctl
(
led
.
fd
,
GPIOHANDLE_SET_LINE_VALUES_IOCTL
,
&
data
)
<
0
)
if
(
ioctl
(
led
.
fd
,
GPIOHANDLE_SET_LINE_VALUES_IOCTL
,
&
data
)
<
0
)
perror
(
"Error setting GPIO to 1"
);
perror
(
"Error setting GPIO to 1"
);
// debug
//UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, \
// "GPIO = %d", CURRENT_GPIO_STATE);
close
(
fd
);
close
(
fd
);
close
(
led
.
fd
);
close
(
led
.
fd
);
return
0
;
return
0
;
...
@@ -100,7 +96,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -100,7 +96,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
// set GPIO so we can monitor using logical analyzer the work of
// set GPIO so we can monitor using logical analyzer the work of
// keep-alive network system
// keep-alive network system
if
(
CURRENT_GPIO_MODE
)
setGPIO
();
if
(
CURRENT_GPIO_MODE
==
1
)
setGPIO
();
}
}
}
}
...
...
coupler/mod_io_opc_ua.h
View file @
d8a5d668
...
@@ -470,6 +470,9 @@ static void afterWriteTimeI2C0_0(UA_Server *server,
...
@@ -470,6 +470,9 @@ static void afterWriteTimeI2C0_0(UA_Server *server,
if
(
data
->
value
.
type
==
&
UA_TYPES
[
UA_TYPES_INT32
])
if
(
data
->
value
.
type
==
&
UA_TYPES
[
UA_TYPES_INT32
])
{
{
UA_Int32
hrValue
=
*
(
UA_Int32
*
)
data
->
value
.
data
;
UA_Int32
hrValue
=
*
(
UA_Int32
*
)
data
->
value
.
data
;
// used only for debuging with logical analyzer
if
(
CURRENT_GPIO_MODE
==
2
)
setGPIO
();
int
addr
=
I2C_SLAVE_ADDR_LIST
[
0
];
int
addr
=
I2C_SLAVE_ADDR_LIST
[
0
];
if
(
hrValue
>
0
)
if
(
hrValue
>
0
)
{
{
...
...
coupler/server.c
View file @
d8a5d668
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include <string.h>
#include <string.h>
#include "common.h"
#include "common.h"
#include "mod_io_i2c.h"
#include "mod_io_i2c.h"
#include "mod_io_opc_ua.h"
#include <time.h>
#include <time.h>
#include <open62541/plugin/log_stdout.h>
#include <open62541/plugin/log_stdout.h>
#include <open62541/server.h>
#include <open62541/server.h>
...
@@ -57,6 +56,7 @@ char *X509_CERTIFICATE_FILENAME;
...
@@ -57,6 +56,7 @@ char *X509_CERTIFICATE_FILENAME;
#include "keep_alive_publisher.h"
#include "keep_alive_publisher.h"
#include "keep_alive_subscriber.h"
#include "keep_alive_subscriber.h"
#include "cli.h"
#include "cli.h"
#include "mod_io_opc_ua.h"
static
volatile
UA_Boolean
running
=
true
;
static
volatile
UA_Boolean
running
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment