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
767f0723
Commit
767f0723
authored
Oct 03, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a list rather than an individual int variable per I2C slave / relays.
parent
d3df07b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
22 deletions
+17
-22
coupler/mod_io_i2c.h
coupler/mod_io_i2c.h
+1
-6
coupler/mod_io_opc_ua.h
coupler/mod_io_opc_ua.h
+16
-16
No files found.
coupler/mod_io_i2c.h
View file @
767f0723
...
...
@@ -28,12 +28,6 @@
##############################################################################
*/
// global relay state - XXX: use a list rather than individual variables
uint8_t
I2C_0_RELAYS_STATE
=
0
;
// state of 4 relays at I2C slave 0
uint8_t
I2C_1_RELAYS_STATE
=
0
;
// state of 4 relays at I2C slave 1
uint8_t
I2C_2_RELAYS_STATE
=
0
;
// state of 4 relays at I2C slave 4
uint8_t
I2C_3_RELAYS_STATE
=
0
;
// state of 4 relays at I2C slave 3
// the default addresses of MOD-IOs
static
char
*
DEFAULT_I2C_0_ADDR
=
"0x58"
;
...
...
@@ -42,6 +36,7 @@ const int DEFAULT_I2C_SLAVE_ADDR = 0x58;
// the current architecture of LIME2 supports up to 127 MOD-IO I2C slaves
int
I2C_SLAVE_ADDR_LIST
[
127
]
=
{
0
};
uint8_t
I2C_RELAY_STATE_LIST
[
127
]
=
{
0
};
// the number of physical relays
const
int
DEFAULT_RELAY_COUNT
=
4
;
...
...
coupler/mod_io_opc_ua.h
View file @
767f0723
...
...
@@ -369,100 +369,100 @@ static void afterWriteTimeI2C0_0(UA_Server *server,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
0
,
&
I2C_
0_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
0
,
&
I2C_
RELAY_STATE_LIST
[
0
]
,
data
);}
static
void
afterWriteTimeI2C0_1
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
1
,
&
I2C_
0_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
1
,
&
I2C_
RELAY_STATE_LIST
[
0
]
,
data
);}
static
void
afterWriteTimeI2C0_2
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
2
,
&
I2C_
0_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
2
,
&
I2C_
RELAY_STATE_LIST
[
0
]
,
data
);}
static
void
afterWriteTimeI2C0_3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
3
,
&
I2C_
0_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
0
],
3
,
&
I2C_
RELAY_STATE_LIST
[
0
]
,
data
);}
// I2C1
static
void
afterWriteTimeI2C1_0
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
0
,
&
I2C_
1_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
0
,
&
I2C_
RELAY_STATE_LIST
[
1
]
,
data
);}
static
void
afterWriteTimeI2C1_1
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
1
,
&
I2C_
1_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
1
,
&
I2C_
RELAY_STATE_LIST
[
1
]
,
data
);}
static
void
afterWriteTimeI2C1_2
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
2
,
&
I2C_
1_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
2
,
&
I2C_
RELAY_STATE_LIST
[
1
]
,
data
);}
static
void
afterWriteTimeI2C1_3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
3
,
&
I2C_
1_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
1
],
3
,
&
I2C_
RELAY_STATE_LIST
[
1
]
,
data
);}
// I2C2
static
void
afterWriteTimeI2C2_0
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
0
,
&
I2C_
2_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
0
,
&
I2C_
RELAY_STATE_LIST
[
2
]
,
data
);}
static
void
afterWriteTimeI2C2_1
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
1
,
&
I2C_
2_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
1
,
&
I2C_
RELAY_STATE_LIST
[
2
]
,
data
);}
static
void
afterWriteTimeI2C2_2
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
2
,
&
I2C_
2_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
2
,
&
I2C_
RELAY_STATE_LIST
[
2
]
,
data
);}
static
void
afterWriteTimeI2C2_3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
3
,
&
I2C_
2_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
2
],
3
,
&
I2C_
RELAY_STATE_LIST
[
2
]
,
data
);}
// I2C3
static
void
afterWriteTimeI2C3_0
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
0
,
&
I2C_
3_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
0
,
&
I2C_
RELAY_STATE_LIST
[
3
]
,
data
);}
static
void
afterWriteTimeI2C3_1
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
1
,
&
I2C_
3_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
1
,
&
I2C_
RELAY_STATE_LIST
[
3
]
,
data
);}
static
void
afterWriteTimeI2C3_2
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
2
,
&
I2C_
3_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
2
,
&
I2C_
RELAY_STATE_LIST
[
3
]
,
data
);}
static
void
afterWriteTimeI2C3_3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
){
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
3
,
&
I2C_
3_RELAYS_STATE
,
data
);}
setI2CSlaveRelayState
(
I2C_SLAVE_ADDR_LIST
[
3
],
3
,
&
I2C_
RELAY_STATE_LIST
[
3
]
,
data
);}
static
void
addValueCallbackToCurrentTimeVariable
(
UA_Server
*
server
)
...
...
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