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
1
Merge Requests
1
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
nexedi
osie
Commits
285530e5
Commit
285530e5
authored
Oct 28, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper naming.
parent
ca4702ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+18
-17
No files found.
coupler/opc-ua-server/server.c
View file @
285530e5
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
#include <open62541/server_config_default.h>
#include <open62541/server_config_default.h>
// global relay state
// global relay state
uint8_t
myrelay
=
0
;
uint8_t
I2C_0_RELAYS_STATE
=
0
;
// state of 4 relays at MOD-IO 0
uint8_t
I2C_1_RELAYS_STATE
=
0
;
// state of 4 relays at MOD-IO 1
// the default addresses of MOD-IOs
// the default addresses of MOD-IOs
const
int
MOD_IO_0_ADDR
=
0x58
;
const
int
MOD_IO_0_ADDR
=
0x58
;
...
@@ -149,12 +150,12 @@ static void afterWriteTime0(UA_Server *server,
...
@@ -149,12 +150,12 @@ static void afterWriteTime0(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
;
if
(
hrValue
>
0
){
if
(
hrValue
>
0
){
myrelay
|=
1UL
<<
0
;
// relay0
I2C_0_RELAYS_STATE
|=
1UL
<<
0
;
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
else
{
else
{
myrelay
&=
~
(
1UL
<<
0
);
// relay0
I2C_0_RELAYS_STATE
&=
~
(
1UL
<<
0
);
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
}
}
}
}
...
@@ -166,12 +167,12 @@ static void afterWriteTime1(UA_Server *server,
...
@@ -166,12 +167,12 @@ static void afterWriteTime1(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
;
if
(
hrValue
>
0
){
if
(
hrValue
>
0
){
myrelay
|=
1UL
<<
1
;
I2C_0_RELAYS_STATE
|=
1UL
<<
1
;
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
else
{
else
{
myrelay
&=
~
(
1UL
<<
1
);
I2C_0_RELAYS_STATE
&=
~
(
1UL
<<
1
);
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
}
}
}
}
...
@@ -183,12 +184,12 @@ static void afterWriteTime2(UA_Server *server,
...
@@ -183,12 +184,12 @@ static void afterWriteTime2(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
;
if
(
hrValue
>
0
){
if
(
hrValue
>
0
){
myrelay
|=
1UL
<<
2
;
I2C_0_RELAYS_STATE
|=
1UL
<<
2
;
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
else
{
else
{
myrelay
&=
~
(
1UL
<<
2
);
I2C_0_RELAYS_STATE
&=
~
(
1UL
<<
2
);
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
}
}
}
}
...
@@ -200,12 +201,12 @@ static void afterWriteTime3(UA_Server *server,
...
@@ -200,12 +201,12 @@ static void afterWriteTime3(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
;
if
(
hrValue
>
0
){
if
(
hrValue
>
0
){
myrelay
|=
1UL
<<
3
;
I2C_0_RELAYS_STATE
|=
1UL
<<
3
;
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
else
{
else
{
myrelay
&=
~
(
1UL
<<
3
);
I2C_0_RELAYS_STATE
&=
~
(
1UL
<<
3
);
setRelayState
(
myrelay
,
MOD_IO_0_ADDR
);
setRelayState
(
I2C_0_RELAYS_STATE
,
MOD_IO_0_ADDR
);
}
}
}
}
}
}
...
...
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