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
d487bc74
Commit
d487bc74
authored
Apr 05, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Support up to 8 MOD-IOs.
See merge request
nexedi/osie!39
parents
1efa9bef
6f5eebab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
2 deletions
+98
-2
coupler/mod_io_i2c.h
coupler/mod_io_i2c.h
+2
-2
coupler/mod_io_opc_ua.h
coupler/mod_io_opc_ua.h
+96
-0
No files found.
coupler/mod_io_i2c.h
View file @
d487bc74
...
@@ -8,8 +8,8 @@ static char *DEFAULT_I2C_0_ADDR = "0x58";
...
@@ -8,8 +8,8 @@ static char *DEFAULT_I2C_0_ADDR = "0x58";
// the list of attached I2C slaves
// the list of attached I2C slaves
const
int
DEFAULT_I2C_SLAVE_ADDR
=
0x58
;
const
int
DEFAULT_I2C_SLAVE_ADDR
=
0x58
;
// XXX:code assumes only
2 I2C slaves but it can be more
// XXX:code assumes only
8 I2C slaves but it can be up to 127
int
I2C_SLAVE_ADDR_LIST
[]
=
{
0
,
0
};
int
I2C_SLAVE_ADDR_LIST
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
// the block device at host machine
// the block device at host machine
static
char
*
DEFAULT_I2C_BLOCK_DEVICE_NAME
=
"/dev/i2c-1"
;
static
char
*
DEFAULT_I2C_BLOCK_DEVICE_NAME
=
"/dev/i2c-1"
;
...
...
coupler/mod_io_opc_ua.h
View file @
d487bc74
...
@@ -99,6 +99,102 @@ static void addVariable(UA_Server *server)
...
@@ -99,6 +99,102 @@ static void addVariable(UA_Server *server)
addUIntegerVariableReadNode
(
server
,
"i2c1.ain2"
,
"I2C1 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c1.ain2"
,
"I2C1 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c1.ain3"
,
"I2C1 / Analog Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c1.ain3"
,
"I2C1 / Analog Input 3"
);
}
}
if
(
length
>=
3
)
{
// IC2-2
addIntegerVariableNode
(
server
,
"i2c2.relay0"
,
"I2C2 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c2.relay1"
,
"I2C2 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c2.relay2"
,
"I2C2 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c2.relay3"
,
"I2C2 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c2.in0"
,
"I2C2 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c2.in1"
,
"I2C2 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c2.in2"
,
"I2C2 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c2.in3"
,
"I2C2 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c2.ain0"
,
"I2C2 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c2.ain1"
,
"I2C2 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c2.ain2"
,
"I2C2 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c2.ain3"
,
"I2C2 / Analog Input 3"
);
}
if
(
length
>=
4
)
{
// IC2-3
addIntegerVariableNode
(
server
,
"i2c3.relay0"
,
"I2C3 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c3.relay1"
,
"I2C3 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c3.relay2"
,
"I2C3 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c3.relay3"
,
"I2C3 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c3.in0"
,
"I2C3 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c3.in1"
,
"I2C3 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c3.in2"
,
"I2C3 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c3.in3"
,
"I2C3 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c3.ain0"
,
"I2C3 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c3.ain1"
,
"I2C3 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c3.ain2"
,
"I2C3 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c3.ain3"
,
"I2C3 / Analog Input 3"
);
}
if
(
length
>=
5
)
{
// IC2-4
addIntegerVariableNode
(
server
,
"i2c4.relay0"
,
"I2C4 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c4.relay1"
,
"I2C4 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c4.relay2"
,
"I2C4 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c4.relay3"
,
"I2C4 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c4.in0"
,
"I2C4 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c4.in1"
,
"I2C4 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c4.in2"
,
"I2C4 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c4.in3"
,
"I2C4 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c4.ain0"
,
"I2C4 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c4.ain1"
,
"I2C4 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c4.ain2"
,
"I2C4 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c4.ain3"
,
"I2C4 / Analog Input 3"
);
}
if
(
length
>=
6
)
{
// IC2-5
addIntegerVariableNode
(
server
,
"i2c5.relay0"
,
"I2C5 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c5.relay1"
,
"I2C5 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c5.relay2"
,
"I2C5 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c5.relay3"
,
"I2C5 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c5.in0"
,
"I2C5 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c5.in1"
,
"I2C5 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c5.in2"
,
"I2C5 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c5.in3"
,
"I2C5 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c5.ain0"
,
"I2C5 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c5.ain1"
,
"I2C5 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c5.ain2"
,
"I2C5 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c5.ain3"
,
"I2C5 / Analog Input 3"
);
}
if
(
length
>=
7
)
{
// IC2-6
addIntegerVariableNode
(
server
,
"i2c6.relay0"
,
"I2C6 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c6.relay1"
,
"I2C6 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c6.relay2"
,
"I2C6 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c6.relay3"
,
"I2C6 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c6.in0"
,
"I2C6 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c6.in1"
,
"I2C6 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c6.in2"
,
"I2C6 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c6.in3"
,
"I2C6 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c6.ain0"
,
"I2C6 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c6.ain1"
,
"I2C6 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c6.ain2"
,
"I2C6 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c6.ain3"
,
"I2C6 / Analog Input 3"
);
}
if
(
length
>=
8
)
{
// IC2-7
addIntegerVariableNode
(
server
,
"i2c7.relay0"
,
"I2C7 / Relay 0"
);
addIntegerVariableNode
(
server
,
"i2c7.relay1"
,
"I2C7 / Relay 1"
);
addIntegerVariableNode
(
server
,
"i2c7.relay2"
,
"I2C7 / Relay 2"
);
addIntegerVariableNode
(
server
,
"i2c7.relay3"
,
"I2C7 / Relay 3"
);
addBooleanVariableReadNode
(
server
,
"i2c7.in0"
,
"I2C7 / Digital Input 0"
);
addBooleanVariableReadNode
(
server
,
"i2c7.in1"
,
"I2C7 / Digital Input 1"
);
addBooleanVariableReadNode
(
server
,
"i2c7.in2"
,
"I2C7 / Digital Input 2"
);
addBooleanVariableReadNode
(
server
,
"i2c7.in3"
,
"I2C7 / Digital Input 3"
);
addUIntegerVariableReadNode
(
server
,
"i2c7.ain0"
,
"I2C7 / Analog Input 0"
);
addUIntegerVariableReadNode
(
server
,
"i2c7.ain1"
,
"I2C7 / Analog Input 1"
);
addUIntegerVariableReadNode
(
server
,
"i2c7.ain2"
,
"I2C7 / Analog Input 2"
);
addUIntegerVariableReadNode
(
server
,
"i2c7.ain3"
,
"I2C7 / Analog Input 3"
);
}
}
}
/* Connect to variables to physical relays
/* Connect to variables to physical relays
...
...
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