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
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
a8f5d15f
Commit
a8f5d15f
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal: Update help and comments re gpio changing to Pin.
parent
c66d86c5
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
stmhal/help.c
+5
-6
5 additions, 6 deletions
stmhal/help.c
stmhal/modpyb.c
+0
-1
0 additions, 1 deletion
stmhal/modpyb.c
stmhal/pin.c
+6
-6
6 additions, 6 deletions
stmhal/pin.c
stmhal/qstrdefsport.h
+0
-3
0 additions, 3 deletions
stmhal/qstrdefsport.h
stmhal/usrsw.c
+1
-3
1 addition, 3 deletions
stmhal/usrsw.c
with
12 additions
and
19 deletions
stmhal/help.c
+
5
−
6
View file @
a8f5d15f
...
...
@@ -21,21 +21,20 @@ STATIC const char *help_text =
" pyb.switch(f) -- call the given function when the switch is pressed
\n
"
" pyb.Led(n) -- create Led object for LED n (n=1,2,3,4)
\n
"
" Led methods: on(), off(), toggle(), intensity(<n>)
\n
"
" pyb.Pin(pin) -- get a pin
\n
"
" pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p
\n
"
" Pin methods: value([v]), high(), low()
\n
"
" pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4)
\n
"
" Servo methods: calibrate(...), pulse_width([p]), angle([x, [t]]), speed([x, [t]])
\n
"
" pyb.Accel() -- create an Accelerometer object
\n
"
" Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()
\n
"
" pyb.rng() -- get a 30-bit hardware random number
\n
"
" pyb.gpio_in(port, [m]) -- set IO port to input, mode m
\n
"
" pyb.gpio_out(port, [m]) -- set IO port to output, mode m
\n
"
" pyb.gpio(port) -- get digital port value
\n
"
" pyb.gpio(port, val) -- set digital port value, True or False, 1 or 0
\n
"
" pyb.ADC(port) -- make an analog port object
\n
"
" ADC methods: read()
\n
"
"
\n
"
"Ports are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name
\n
"
"Port
input
modes are: pyb.P
ULL_NONE, pyb.PULL_UP, pyb.PULL_DOWN
\n
"
"Port
output
modes are: pyb.P
USH_
PULL, pyb.
OPEN_DRAI
N
\n
"
"Port
IO
modes are: pyb.P
in.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD
\n
"
"Port
pull
modes are: pyb.P
in.PULL_NONE, pyb.Pin.
PULL
_UP
, pyb.
Pin.PULL_DOW
N
\n
"
"
\n
"
"Control commands:
\n
"
" CTRL-A -- on a blank line, enter raw REPL mode
\n
"
...
...
This diff is collapsed.
Click to expand it.
stmhal/modpyb.c
+
0
−
1
View file @
a8f5d15f
...
...
@@ -13,7 +13,6 @@
#include
"pybstdio.h"
#include
"pyexec.h"
#include
"led.h"
#include
"gpio.h"
#include
"pin.h"
#include
"extint.h"
#include
"usrsw.h"
...
...
This diff is collapsed.
Click to expand it.
stmhal/pin.c
+
6
−
6
View file @
a8f5d15f
...
...
@@ -18,7 +18,7 @@
//
// x1_pin = pyb.Pin.board.X1
//
// g = pyb.
gpio
(pyb.Pin.board.X1,
0
)
// g = pyb.
Pin
(pyb.Pin.board.X1,
pyb.Pin.IN
)
//
// CPU pins which correspond to the board pins are available
// as pyb.cpu.Name. For the CPU pins, the names are the port letter
...
...
@@ -27,16 +27,16 @@
//
// You can also use strings:
//
// g = pyb.
gpio
('X1',
0
)
// g = pyb.
Pin
('X1',
pyb.Pin.OUT_PP
)
//
// Users can add their own names:
//
// pyb.Pin
(
"LeftMotorDir"
,
pyb.Pin.cpu.C12
)
// g = pyb.
gpio
("LeftMotorDir",
0
)
// pyb.Pin
.dict[
"LeftMotorDir"
] =
pyb.Pin.cpu.C12
// g = pyb.
Pin
("LeftMotorDir",
pyb.Pin.OUT_OD
)
//
// and can query mappings
//
// pin = pyb.Pin("LeftMotorDir")
;
// pin = pyb.Pin("LeftMotorDir")
//
// Users can also add their own mapping function:
//
...
...
@@ -46,7 +46,7 @@
//
// pyb.Pin.mapper(MyMapper)
//
// So, if you were to call: pyb.
gpio
("LeftMotorDir",
0
)
// So, if you were to call: pyb.
Pin
("LeftMotorDir",
pyb.Pin.OUT_PP
)
// then "LeftMotorDir" is passed directly to the mapper function.
//
// To summarize, the following order determines how things get mapped into
...
...
This diff is collapsed.
Click to expand it.
stmhal/qstrdefsport.h
+
0
−
3
View file @
a8f5d15f
...
...
@@ -34,9 +34,6 @@ Q(rng)
Q
(
LCD
)
Q
(
SD
)
Q
(
SDcard
)
Q
(
gpio
)
Q
(
gpio_in
)
Q
(
gpio_out
)
Q
(
FileIO
)
// Entries for sys.path
Q
(
0
:/
)
...
...
This diff is collapsed.
Click to expand it.
stmhal/usrsw.c
+
1
−
3
View file @
a8f5d15f
...
...
@@ -6,12 +6,10 @@
#include
"qstr.h"
#include
"obj.h"
#include
"runtime.h"
#include
"usrsw.h"
#include
"extint.h"
#include
"gpio.h"
#include
"pin.h"
#include
"genhdr/pins.h"
#include
"usrsw.h"
// Usage Model:
//
...
...
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