Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
aa3569cd
Commit
aa3569cd
authored
Aug 09, 2015
by
Daniel Campora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cc3200: Add factory smoke test as part of the tools.
parent
8cd9fedf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
0 deletions
+164
-0
cc3200/tools/smoke.py
cc3200/tools/smoke.py
+63
-0
cc3200/tools/smoke.py.exp
cc3200/tools/smoke.py.exp
+101
-0
No files found.
cc3200/tools/smoke.py
0 → 100644
View file @
aa3569cd
import
pyb
import
os
"""
Execute it like this:
python3 run-tests --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py
"""
pin_map
=
[
2
,
1
,
23
,
24
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
22
,
28
,
10
,
9
,
8
,
7
,
6
,
30
,
31
,
3
,
0
,
4
,
5
]
test_bytes
=
os
.
urandom
(
2048
)
def
test_pin_read
(
type
):
# enable the pull resistor on all pins, then read the value
for
p
in
pin_map
:
pin
=
pyb
.
Pin
(
'GP'
+
str
(
p
),
af
=
0
,
mode
=
pyb
.
Pin
.
IN
,
type
=
type
)
# read the pin value
print
(
pin
.
value
())
def
test_pin_shorts
(
type
):
if
type
==
pyb
.
Pin
.
STD_PU
:
type_inverted
=
pyb
.
Pin
.
STD_PD
else
:
type_inverted
=
pyb
.
Pin
.
STD_PU
# enable all pulls of the specified type
for
p
in
pin_map
:
pin
=
pyb
.
Pin
(
'GP'
+
str
(
p
),
af
=
0
,
mode
=
pyb
.
Pin
.
IN
,
type
=
type_inverted
)
# then change the pull one pin at a time and read its value
i
=
0
while
i
<
len
(
pin_map
):
pin
=
pyb
.
Pin
(
'GP'
+
str
(
pin_map
[
i
]),
af
=
0
,
mode
=
pyb
.
Pin
.
IN
,
type
=
type
)
pyb
.
Pin
(
'GP'
+
str
(
pin_map
[
i
-
1
]),
af
=
0
,
mode
=
pyb
.
Pin
.
IN
,
type
=
type_inverted
)
i
+=
1
# read the pin value
print
(
pin
.
value
())
test_pin_read
(
pyb
.
Pin
.
STD_PU
)
test_pin_read
(
pyb
.
Pin
.
STD_PD
)
test_pin_shorts
(
pyb
.
Pin
.
STD_PU
)
test_pin_shorts
(
pyb
.
Pin
.
STD_PD
)
# create a test directory
os
.
mkdir
(
'/flash/test'
)
os
.
chdir
(
'/flash/test'
)
print
(
os
.
getcwd
())
# create a new file
f
=
open
(
'test.txt'
,
'w'
)
n_w
=
f
.
write
(
test_bytes
)
print
(
n_w
==
len
(
test_bytes
))
f
.
close
()
f
=
open
(
'test.txt'
,
'r'
)
r
=
bytes
(
f
.
readall
(),
'ascii'
)
# check that we can write and read it correctly
print
(
r
==
test_bytes
)
f
.
close
()
os
.
remove
(
'test.txt'
)
os
.
chdir
(
'..'
)
os
.
rmdir
(
'test'
)
ls
=
os
.
listdir
()
print
(
'test'
not
in
ls
)
print
(
ls
)
cc3200/tools/smoke.py.exp
0 → 100644
View file @
aa3569cd
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
/flash
True
True
True
['main.py', 'sys', 'lib', 'cert', 'boot.py']
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