Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
6a15ac80
Commit
6a15ac80
authored
Oct 30, 2014
by
Henrik Sölver
Committed by
Damien George
Oct 30, 2014
Browse files
Options
Downloads
Patches
Plain Diff
tests: Added and adapted CAN tests for extended messages
parent
50463681
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/pyb/can.py
+35
-2
35 additions, 2 deletions
tests/pyb/can.py
tests/pyb/can.py.exp
+7
-1
7 additions, 1 deletion
tests/pyb/can.py.exp
with
42 additions
and
3 deletions
tests/pyb/can.py
+
35
−
2
View file @
6a15ac80
from
pyb
import
CAN
from
pyb
import
CAN
can
=
CAN
(
1
)
can
=
CAN
(
1
,
CAN
.
LOOPBACK
)
print
(
can
)
print
(
can
)
can
.
init
(
CAN
.
LOOPBACK
)
print
(
can
.
any
(
0
))
print
(
can
.
any
(
0
))
can
.
send
(
'
abcd
'
,
123
)
can
.
send
(
'
abcd
'
,
123
)
print
(
can
.
any
(
0
))
print
(
can
.
any
(
0
))
print
(
can
.
recv
(
0
))
print
(
can
.
recv
(
0
))
can
.
send
(
'
abcd
'
,
-
1
)
print
(
can
.
recv
(
0
))
can
.
send
(
'
abcd
'
,
0x7FF
+
1
)
print
(
can
.
recv
(
0
))
#Test too long message
try
:
can
.
send
(
'
abcdefghi
'
,
0x7FF
)
except
ValueError
:
print
(
'
passed
'
)
else
:
print
(
'
failed
'
)
del
can
#Testing extended IDs
can
=
CAN
(
1
,
CAN
.
LOOPBACK
,
extframe
=
True
)
print
(
can
)
try
:
can
.
send
(
'
abcde
'
,
0x7FF
+
1
)
except
ValueError
:
print
(
'
failed
'
)
else
:
r
=
can
.
recv
(
0
)
if
r
[
0
]
==
0x7FF
+
1
and
r
[
3
]
==
b
'
abcde
'
:
print
(
'
passed
'
)
else
:
print
(
'
failed, wrong data received
'
)
print
(
'
end
'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/pyb/can.py.exp
+
7
−
1
View file @
6a15ac80
CAN(1)
CAN(1
, LOOPBACK, False
)
False
False
True
True
(123, 0, 0, b'abcd')
(123, 0, 0, b'abcd')
(2047, 0, 0, b'abcd')
(0, 0, 0, b'abcd')
passed
CAN(1, LOOPBACK, True)
passed
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment