8000 stmhal: Update help and comments re gpio changing to Pin. · errordeveloper/micropython@a8f5d15 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit a8f5d15

Browse files
committed
stmhal: Update help and comments re gpio changing to Pin.
1 parent c66d86c commit a8f5d15

File tree

5 files changed

+12
-19
lines changed

5 files changed

+12
-19
lines changed

stmhal/help.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,20 @@ STATIC const char *help_text =
2121
" pyb.switch(f) -- call the given function when the switch is pressed\n"
2222
" pyb.Led(n) -- create Led object for LED n (n=1,2,3,4)\n"
2323
" Led methods: on(), off(), toggle(), intensity(<n>)\n"
24+
" pyb.Pin(pin) -- get a pin\n"
25+
" pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p\n"
26+
" Pin methods: value([v]), high(), low()\n"
2427
" pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4)\n"
2528
" Servo methods: calibrate(...), pulse_width([p]), angle([x, [t]]), speed([x, [t]])\n"
2629
" pyb.Accel() -- create an Accelerometer object\n"
2730
" Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()\n"
2831
" pyb.rng() -- get a 30-bit hardware random number\n"
29-
" pyb.gpio_in(port, [m]) -- set IO port to input, mode m\n"
30-
" pyb.gpio_out(port, [m]) -- set IO port to output, mode m\n"
31-
" pyb.gpio(port) -- get digital port value\n"
32-
" pyb.gpio(port, val) -- set digital port value, True or False, 1 or 0\n"
3332
" pyb.ADC(port) -- make an analog port object\n"
3433
" ADC methods: read()\n"
3534
"\n"
3635
"Ports are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name\n"
37-
"Port input modes are: pyb.PULL_NONE, pyb.PULL_UP, pyb.PULL_DOWN\n"
38-
"Port output modes are: pyb.PUSH_PULL, pyb.OPEN_DRAIN\n"
36+
"Port IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD\n"
37+
"Port pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN\n"
3938
"\n"
4039
"Control commands:\n"
4140
" CTRL-A -- on a blank line, enter raw REPL mode\n"

stmhal/modpyb.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "pybstdio.h"
1414
#include "pyexec.h"
1515
#include "led.h"
16-
#include "gpio.h"
1716
#include "pin.h"
1817
#include "extint.h"
1918
#include "usrsw.h"

stmhal/pin.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//
1919
// x1_pin = pyb.Pin.board.X1
2020
//
21-
// g = pyb.gpio(pyb.Pin.board.X1, 0)
21+
// g = pyb.Pin(pyb.Pin.board.X1, pyb.Pin.IN)
2222
//
2323
// CPU pins which correspond to the board pins are available
2424
// as pyb.cpu.Name. For the CPU pins, the names are the port letter
@@ -27,16 +27,16 @@
2727
//
2828
// You can also use strings:
2929
//
30-
// g = pyb.gpio('X1', 0)
30+
// g = pyb.Pin('X1', pyb.Pin.OUT_PP)
3131
//
3232
// Users can add their own names:
3333
//
34-
// pyb.Pin("LeftMotorDir", pyb.Pin.cpu.C12)
35-
// g = pyb.gpio("LeftMotorDir", 0)
34+
// pyb.Pin.dict["LeftMotorDir"] = pyb.Pin.cpu.C12
35+
// g = pyb.Pin("LeftMotorDir", pyb.Pin.OUT_OD)
3636
//
3737
// and can query mappings
3838
//
39-
// pin = pyb.Pin("LeftMotorDir");
39+
// pin = pyb.Pin("LeftMotorDir")
4040
//
4141
// Users can also add their own mapping function:
4242
//
@@ -46,7 +46,7 @@
4646
//
4747
// pyb.Pin.mapper(MyMapper)
4848
//
49-
// So, if you were to call: pyb.gpio("LeftMotorDir", 0)
49+
// So, if you were to call: pyb.Pin("LeftMotorDir", pyb.Pin.OUT_PP)
5050
// then "LeftMotorDir" is passed directly to the mapper function.
5151
//
5252
// To summarize, the following order determines how things get mapped into

stmhal/qstrdefsport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ Q(rng)
3434
Q(LCD)
3535
Q(SD)
3636
Q(SDcard)
37-
Q(gpio)
38-
Q(gpio_in)
39-
Q(gpio_out)
4037
Q(FileIO)
4138
// Entries for sys.path
4239
Q(0:/)

stmhal/usrsw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
#include "qstr.h"
77
#include "obj.h"
88
#include "runtime.h"
9-
#include "usrsw.h"
10-
119
#include "extint.h"
12-
#include "gpio.h"
1310
#include "pin.h"
1411
#include "genhdr/pins.h"
12+
#include "usrsw.h"
1513

1614
// Usage Model:
1715
//

0 commit comments

Comments
 (0)
0