Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
a8f5d15f
Commit
a8f5d15f
authored
Apr 18, 2014
by
Damien George
Browse files
stmhal: Update help and comments re gpio changing to Pin.
parent
c66d86c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
stmhal/help.c
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
"
...
...
stmhal/modpyb.c
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"
...
...
stmhal/pin.c
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
...
...
stmhal/qstrdefsport.h
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
:/
)
...
...
stmhal/usrsw.c
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:
//
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment