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
9ee87b3c
Commit
9ee87b3c
authored
Jan 11, 2011
by
Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Arduino board trimmed
parent
80759d43
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
292 additions
and
48 deletions
+292
-48
otherio/exp/rt/src/pwr_arduino_uno.pde
otherio/exp/rt/src/pwr_arduino_uno.pde
+2
-2
otherio/lib/rt/src/rt_io_m_arduino_uno.c
otherio/lib/rt/src/rt_io_m_arduino_uno.c
+158
-40
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+132
-6
src/doc/man/en_us/man_iog.odt
src/doc/man/en_us/man_iog.odt
+0
-0
src/doc/man/en_us/man_iog.pdf
src/doc/man/en_us/man_iog.pdf
+0
-0
No files found.
otherio/exp/rt/src/pwr_arduino_uno.pde
View file @
9ee87b3c
...
...
@@ -46,7 +46,7 @@ byte msgData[100];
byte
rmsg
[
40
];
int
sizeErrorCnt
=
0
;
int
noMessageCnt
=
0
;
const
int
delayTime
=
5
;
const
int
delayTime
=
1
;
const
int
debug
=
0
;
const
int
MSG_TYPE_WRITE
=
1
;
...
...
@@ -127,7 +127,7 @@ int serialRead()
void
setup
()
{
// Start serial port at
9600 baud
// Start serial port at
the configured baud rate
Serial
.
begin
(
9600
);
Serial
.
flush
();
}
...
...
otherio/lib/rt/src/rt_io_m_arduino_uno.c
View file @
9ee87b3c
...
...
@@ -48,6 +48,9 @@ typedef struct {
unsigned
char
AiMask
[
AI_MAX_SIZE
];
unsigned
char
AoMask
[
AO_MAX_SIZE
];
int
IdCnt
;
int
DiPollId
;
int
DiPendingPoll
;
int
AiIntervalCnt
;
io_sChannel
*
DChanList
[
D_MAX_SIZE
*
8
];
io_sChannel
*
AiChanList
[
AI_MAX_SIZE
*
8
];
io_sChannel
*
AoChanList
[
AO_MAX_SIZE
*
8
];
...
...
@@ -63,6 +66,20 @@ typedef struct {
#include <termios.h>
static
FILE
*
fp
;
static
void
logg
(
const
char
*
str
)
{
pwr_tTime
t
;
char
timstr
[
40
];
time_GetTime
(
&
t
);
time_AtoAscii
(
0
,
time_eFormat_Time
,
timstr
,
sizeof
(
timstr
));
timstr
[
9
]
=
0
;
fprintf
(
fp
,
"%s%04lld %s
\n
"
,
timstr
,
t
.
tv_nsec
/
100000
,
str
);
}
typedef
enum
{
ard_eMsgType_Write
=
1
,
ard_eMsgType_DiRead
=
2
,
...
...
@@ -103,11 +120,17 @@ static int receive( int fd, int id, ard_sMsg *rmsg, int size)
msize
=
0
;
msize
+=
read
(
fd
,
rmsg
,
1
);
logg
(
"Receive read"
);
while
(
msize
<
rmsg
->
size
)
{
sts
=
select
(
fd
+
1
,
&
rfd
,
NULL
,
NULL
,
&
tv
);
if
(
sts
==
0
)
return
ARD__NOMSG
;
msize
+=
read
(
fd
,
(
char
*
)
rmsg
+
msize
,
rmsg
->
size
-
msize
);
logg
(
"Receive read ++"
);
}
if
(
rmsg
->
type
==
ard_eMsgType_Debug
)
{
...
...
@@ -126,6 +149,22 @@ static int receive( int fd, int id, ard_sMsg *rmsg, int size)
return
ARD__NOMSG
;
}
static
int
poll_di
(
ard_sMsg
*
msg
,
io_sLocal
*
local
)
{
int
sts
;
msg
->
size
=
3
;
msg
->
id
=
local
->
IdCnt
++
;
msg
->
type
=
ard_eMsgType_DiRead
;
logg
(
"Poll Di"
);
sts
=
write
(
local
->
fd
,
msg
,
msg
->
size
);
local
->
DiPollId
=
msg
->
id
;
local
->
DiPendingPoll
=
1
;
return
sts
;
}
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
...
...
@@ -137,6 +176,9 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
pwr_tStatus
sts
;
int
i
;
unsigned
char
wdg
;
struct
termios
tty_attributes
;
fp
=
fopen
(
"/home/claes/ard.log"
,
"w"
);
// Test
local
=
(
io_sLocal
*
)
calloc
(
1
,
sizeof
(
io_sLocal
));
cp
->
Local
=
local
;
...
...
@@ -264,6 +306,50 @@ static pwr_tStatus IoCardInit( io_tCtx ctx,
return
IO__INITFAIL
;
}
tcgetattr
(
local
->
fd
,
&
tty_attributes
);
#if defined OS_LINUX
tty_attributes
.
c_cflag
&=
~
CBAUD
;
//maska bort all hastighet
#endif
switch
(
op
->
BaudRate
)
{
case
300
:
tty_attributes
.
c_cflag
|=
B300
;
break
;
case
1200
:
tty_attributes
.
c_cflag
|=
B1200
;
break
;
case
2400
:
tty_attributes
.
c_cflag
|=
B2400
;
break
;
case
4800
:
tty_attributes
.
c_cflag
|=
B4800
;
break
;
case
9600
:
tty_attributes
.
c_cflag
|=
B9600
;
break
;
case
19200
:
tty_attributes
.
c_cflag
|=
B19200
;
break
;
case
38400
:
tty_attributes
.
c_cflag
|=
B38400
;
break
;
case
57600
:
tty_attributes
.
c_cflag
|=
B57600
;
break
;
case
115200
:
tty_attributes
.
c_cflag
|=
B115200
;
break
;
default:
tty_attributes
.
c_cflag
|=
B9600
;
break
;
}
sts
=
tcsetattr
(
local
->
fd
,
TCSANOW
,
&
tty_attributes
);
if
(
sts
<
0
)
{
errh_Error
(
"IO Init Card '%s', unable to set baud rate on device %s"
,
cp
->
Name
,
op
->
Device
);
op
->
Status
=
pwr_eArduino_StatusEnum_DeviceSetupError
;
return
IO__INITFAIL
;
}
tcflush
(
local
->
fd
,
TCIOFLUSH
);
// Send config message
...
...
@@ -328,6 +414,9 @@ static pwr_tStatus IoCardClose( io_tCtx ctx,
close
(
local
->
fd
);
free
(
cp
->
Local
);
fclose
(
fp
);
//Test
return
IO__SUCCESS
;
}
...
...
@@ -349,13 +438,22 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
int
i
,
j
;
unsigned
char
m
;
if
(
!
local
->
DiPendingPoll
)
poll_di
(
&
msg
,
local
);
#if 0
msg.size = 3;
msg.id = local->IdCnt++;
msg.type = ard_eMsgType_DiRead;
logg( "Poll Di");
sts = write( local->fd, &msg, msg.size);
#endif
sts
=
receive
(
local
->
fd
,
msg
.
id
,
&
rmsg
,
local
->
DiSize
);
local
->
DiPendingPoll
=
0
;
sts
=
receive
(
local
->
fd
,
local
->
DiPollId
,
&
rmsg
,
local
->
DiSize
);
op
->
Status
=
sts
;
if
(
EVEN
(
sts
))
{
op
->
ErrorCount
++
;
...
...
@@ -374,6 +472,17 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
}
if
(
local
->
AiSize
)
{
int
skip_ai
=
0
;
if
(
op
->
AiScanInterval
>
1
)
{
skip_ai
=
local
->
AiIntervalCnt
;
local
->
AiIntervalCnt
++
;
if
(
local
->
AiIntervalCnt
>=
op
->
AiScanInterval
)
local
->
AiIntervalCnt
=
0
;
}
if
(
!
skip_ai
)
{
ard_sMsg
msg
,
rmsg
;
pwr_tInt32
ivalue
;
pwr_tFloat32
actvalue
;
...
...
@@ -419,6 +528,7 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
}
}
}
}
if
(
op
->
ErrorCount
>=
op
->
ErrorSoftLimit
&&
error_count
<
op
->
ErrorSoftLimit
)
{
...
...
@@ -464,6 +574,7 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
}
logg
(
"Write Do"
);
sts
=
write
(
local
->
fd
,
&
msg
,
msg
.
size
);
}
...
...
@@ -477,6 +588,13 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
return
IO__ERRDEVICE
;
}
if
(
local
->
DiSize
&&
op
->
Options
&
pwr_mArduino_OptionsMask_OptimizedDiPoll
)
{
ard_sMsg
msg
;
poll_di
(
&
msg
,
local
);
}
return
IO__SUCCESS
;
}
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
9ee87b3c
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X1
59
"
Attr NextOix = "_X1
70
"
Attr NextCix = "_X17"
Attr NextTix[0] = "_X
6
"
Attr NextTix[0] = "_X
8
"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
Object MotionControl_StatusEnum $TypeDef 1 15-NOV-2007 14:36:24.17
...
...
@@ -300,7 +300,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndObject
EndObject
Object Arduino_StatusEnum $TypeDef 5 13-DEC-2010 21:41:03.92
Body SysBody
13-DEC-2010 21:41:17.5
4
Body SysBody
03-JAN-2011 21:07:03.7
4
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
...
...
@@ -367,6 +367,95 @@ Volume OtherIO $ClassVolume 0.0.250.10
Attr Value = 18
EndBody
EndObject
Object DeviceSetupError $Value 168 03-JAN-2011 21:33:12.93
Body SysBody 03-JAN-2011 21:33:18.63
Attr Text = "DeviceSetupError"
Attr PgmName = "DeviceSetupError"
Attr Value = 20
EndBody
EndObject
EndObject
Object Arduino_BaudRateEnum $TypeDef 6 03-JAN-2011 21:16:43.20
Body SysBody 03-JAN-2011 21:07:09.34
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object BaudRate_2400 $Value 161 03-JAN-2011 21:17:13.04
Body SysBody 03-JAN-2011 21:17:14.30
Attr Text = "2400"
Attr PgmName = "BaudRate_2400"
Attr Value = 2400
EndBody
EndObject
Object BaudRate_4800 $Value 162 03-JAN-2011 21:17:21.73
Body SysBody 03-JAN-2011 21:17:22.82
Attr Text = "4800"
Attr PgmName = "BaudRate_4800"
Attr Value = 4800
EndBody
EndObject
Object BaudRate_9600 $Value 163 03-JAN-2011 21:17:29.93
Body SysBody 03-JAN-2011 21:17:31.07
Attr Text = "9600"
Attr PgmName = "BaudRate_9600"
Attr Value = 9600
EndBody
EndObject
Object BaudRate_14400 $Value 160 09-JAN-2011 20:23:56.52
Body SysBody 09-JAN-2011 20:24:03.52
Attr Text = "14400"
Attr PgmName = "BaudRate_14400"
Attr Value = 14400
EndBody
EndObject
Object BaudRate_19200 $Value 164 03-JAN-2011 21:17:37.54
Body SysBody 03-JAN-2011 21:17:38.64
Attr Text = "19200"
Attr PgmName = "BaudRate_19200"
Attr Value = 19200
EndBody
EndObject
Object BaudRate_28800 $Value 170 09-JAN-2011 20:24:24.78
Body SysBody 09-JAN-2011 20:24:31.34
Attr Text = "28800"
Attr PgmName = "BaudRate_28800"
Attr Value = 28800
EndBody
EndObject
Object BaudRate_38400 $Value 165 03-JAN-2011 21:17:44.96
Body SysBody 03-JAN-2011 21:17:46.11
Attr Text = "38400"
Attr PgmName = "BaudRate_38400"
Attr Value = 38400
EndBody
EndObject
Object BaudRate_57600 $Value 166 03-JAN-2011 21:17:53.04
Body SysBody 03-JAN-2011 21:17:54.16
Attr Text = "57600"
Attr PgmName = "BaudRate_57600"
Attr Value = 57600
EndBody
EndObject
Object BaudRate_115200 $Value 167 03-JAN-2011 21:18:13.86
Body SysBody 03-JAN-2011 21:18:14.96
Attr Text = "115200"
Attr PgmName = "BaudRate_115200"
Attr Value = 115200
EndBody
EndObject
EndObject
Object Arduino_OptionsMask $TypeDef 7 06-JAN-2011 15:51:06.94
Body SysBody 06-JAN-2011 15:48:58.95
Attr TypeRef = "pwrs:Type-$Mask"
Attr Elements = 1
EndBody
Object OptimizedDiPoll $Bit 169 06-JAN-2011 15:49:48.79
Body SysBody 06-JAN-2011 15:49:55.05
Attr Text = "OptimizedDiPoll"
Attr PgmName = "OptimizedDiPoll"
Attr Value = 1
EndBody
EndObject
EndObject
EndObject
Object Class $ClassHier 2 15-NOV-2007 14:35:40.72
...
...
@@ -2292,6 +2381,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @Group IO
! @Summary Rack object for Arduino USB devices.
! Rack object for Arduino USB devices.
! This object is configured below the Node object.
!
! @b See also
! @classlink Arduino_Uno otherio_arduino_uno.html
...
...
@@ -2388,7 +2478,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object RtBody $ObjBodyDef 1 13-DEC-2010 21:36:40.01
Body SysBody 13-DEC-2010 21:39:07.38
Attr StructName = "Arduino_Uno"
Attr NextAix = "_X2
1
"
Attr NextAix = "_X2
4
"
EndBody
!/**
! Optional description.
...
...
@@ -2502,6 +2592,41 @@ Volume OtherIO $ClassVolume 0.0.250.10
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Baud rate of the USB connection.
! For fast scantimes the baud rate has to be increased.
!*/
Object BaudRate $Attribute 21 03-JAN-2011 21:18:39.87
Body SysBody 03-JAN-2011 21:19:00.44
Attr PgmName = "BaudRate"
Attr TypeRef = "OtherIO:Type-Arduino_BaudRateEnum"
EndBody
EndObject
!/**
! Options.
! If OptimizedDiPoll is set the poll message for Di values are sent
! at the end of the execution of the prevoius scan, instead of at
! the start of the execution.
!*/
Object Options $Attribute 22 06-JAN-2011 15:50:22.78
Body SysBody 06-JAN-2011 15:51:32.48
Attr PgmName = "Options"
Attr TypeRef = "OtherIO:Type-Arduino_OptionsMask"
EndBody
EndObject
!/**
! Specifies, in relation to the scantime of the thread, how often
! the Ai channels of the board are handled. If AiScanInterval is 1 or 0,
! the Ai are handled every scan. If AiScanInterval is for example 10, they
! are handled every 10'th scan, i.e. the scantime for the module
! will be AiScanInterval times the scantime of the thread.
!*/
Object AiScanInterval $Attribute 23 09-JAN-2011 10:37:58.02
Body SysBody 09-JAN-2011 10:38:12.99
Attr PgmName = "AiScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 144 13-DEC-2010 21:36:40.01
Object IoCardInit $Method 145 13-DEC-2010 21:36:40.01
...
...
@@ -2531,10 +2656,11 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
Object Template Arduino_Uno 2151907328 01-JAN-1970 01:00:00.00
Body RtBody
13-DEC-2010 21:54:49.89
Body RtBody
03-JAN-2011 21:19:26.25
Attr ErrorSoftLimit = 25
Attr ErrorHardLimit = 50
Attr WatchdogTime = 5.000000e+00
Attr BaudRate = 9600
EndBody
EndObject
EndObject
...
...
src/doc/man/en_us/man_iog.odt
View file @
9ee87b3c
No preview for this file type
src/doc/man/en_us/man_iog.pdf
View file @
9ee87b3c
No preview for this file type
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