Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
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
Esteban Blanc
proview
Commits
654643b6
Commit
654643b6
authored
Apr 20, 2010
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scan interval added to gpio
parent
823be2d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
+2
-1
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
+27
-0
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
View file @
654643b6
...
...
@@ -8,7 +8,8 @@
typedef
struct
{
FILE
*
value_fp
[
GPIO_MAX_CHANNELS
];
unsigned
int
number
[
GPIO_MAX_CHANNELS
];
int
scancount
;
int
interval_cnt
;
int
has_read_method
;
}
io_sLocalGPIO_Module
;
#endif
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
View file @
654643b6
...
...
@@ -129,9 +129,21 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
io_sCard
*
cp
)
{
io_sLocalGPIO_Module
*
local
=
(
io_sLocalGPIO_Module
*
)
cp
->
Local
;
pwr_sClass_GPIO_Module
*
op
=
(
pwr_sClass_GPIO_Module
*
)
cp
->
op
;
int
i
;
char
str
[
20
];
if
(
op
->
ScanInterval
>
1
)
{
local
->
has_read_method
=
1
;
if
(
local
->
interval_cnt
!=
0
)
{
local
->
interval_cnt
++
;
if
(
local
->
interval_cnt
>=
op
->
ScanInterval
)
local
->
interval_cnt
=
0
;
return
IO__SUCCESS
;
}
local
->
interval_cnt
++
;
}
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
...
...
@@ -157,8 +169,23 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
io_sCard
*
cp
)
{
io_sLocalGPIO_Module
*
local
=
(
io_sLocalGPIO_Module
*
)
cp
->
Local
;
pwr_sClass_GPIO_Module
*
op
=
(
pwr_sClass_GPIO_Module
*
)
cp
->
op
;
int
i
;
if
(
op
->
ScanInterval
>
1
)
{
if
(
!
local
->
has_read_method
)
{
if
(
local
->
interval_cnt
!=
0
)
{
local
->
interval_cnt
++
;
if
(
local
->
interval_cnt
>=
op
->
ScanInterval
)
local
->
interval_cnt
=
0
;
return
IO__SUCCESS
;
}
local
->
interval_cnt
++
;
}
else
if
(
local
->
interval_cnt
!=
1
)
return
IO__SUCCESS
;
}
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
...
...
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