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
19502957
Commit
19502957
authored
9 years ago
by
danicampora
Browse files
Options
Downloads
Patches
Plain Diff
cc3200: Set pin direction first, then value. Fixes #1542.
parent
e0d7740a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cc3200/mods/pybpin.c
+2
-4
2 additions, 4 deletions
cc3200/mods/pybpin.c
tests/wipy/pin.py
+11
-2
11 additions, 2 deletions
tests/wipy/pin.py
tests/wipy/pin.py.exp
+2
-0
2 additions, 0 deletions
tests/wipy/pin.py.exp
with
15 additions
and
6 deletions
cc3200/mods/pybpin.c
+
2
−
4
View file @
19502957
...
@@ -290,16 +290,14 @@ STATIC void pin_obj_configure (const pin_obj_t *self) {
...
@@ -290,16 +290,14 @@ STATIC void pin_obj_configure (const pin_obj_t *self) {
default:
default:
break
;
break
;
}
}
// configure the direction
MAP_GPIODirModeSet
(
self
->
port
,
self
->
bit
,
direction
);
// set the pin value
// set the pin value
if
(
self
->
value
)
{
if
(
self
->
value
)
{
MAP_GPIOPinWrite
(
self
->
port
,
self
->
bit
,
self
->
bit
);
MAP_GPIOPinWrite
(
self
->
port
,
self
->
bit
,
self
->
bit
);
}
else
{
}
else
{
MAP_GPIOPinWrite
(
self
->
port
,
self
->
bit
,
0
);
MAP_GPIOPinWrite
(
self
->
port
,
self
->
bit
,
0
);
}
}
// configure the direction
MAP_GPIODirModeSet
(
self
->
port
,
self
->
bit
,
direction
);
}
}
// now set the alternate function
// now set the alternate function
MAP_PinModeSet
(
self
->
pin_num
,
self
->
af
);
MAP_PinModeSet
(
self
->
pin_num
,
self
->
af
);
...
...
This diff is collapsed.
Click to expand it.
tests/wipy/pin.py
+
11
−
2
View file @
19502957
"""
This test need a set of pins which can be set as inputs and have no external
"""
This test need a set of pins which can be set as inputs and have no external
pull up or pull down connected.
pull up or pull down connected.
GP12 and GP17 must be connected together
"""
"""
from
machine
import
Pin
from
machine
import
Pin
import
os
import
os
...
@@ -14,6 +16,13 @@ elif 'WiPy' in mch:
...
@@ -14,6 +16,13 @@ elif 'WiPy' in mch:
else
:
else
:
raise
Exception
(
'
Board not supported!
'
)
raise
Exception
(
'
Board not supported!
'
)
# test initial value
p
=
Pin
(
'
GP12
'
,
Pin
.
IN
)
Pin
(
'
GP17
'
,
Pin
.
OUT
,
value
=
1
)
print
(
p
()
==
1
)
Pin
(
'
GP17
'
,
Pin
.
OUT
,
value
=
0
)
print
(
p
()
==
0
)
def
test_noinit
():
def
test_noinit
():
for
p
in
pin_map
:
for
p
in
pin_map
:
pin
=
Pin
(
p
)
pin
=
Pin
(
p
)
...
...
This diff is collapsed.
Click to expand it.
tests/wipy/pin.py.exp
+
2
−
0
View file @
19502957
True
True
1
1
1
1
1
1
...
...
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