stmhal: Update help and comments re gpio changing to Pin.

This commit is contained in:
Damien George 2014-04-18 22:48:59 +01:00
parent c66d86c5ce
commit a8f5d15fc6
5 changed files with 12 additions and 19 deletions

@ -21,21 +21,20 @@ STATIC const char *help_text =
" pyb.switch(f) -- call the given function when the switch is pressed\n" " 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" " pyb.Led(n) -- create Led object for LED n (n=1,2,3,4)\n"
" Led methods: on(), off(), toggle(), intensity(<n>)\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" " 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" " Servo methods: calibrate(...), pulse_width([p]), angle([x, [t]]), speed([x, [t]])\n"
" pyb.Accel() -- create an Accelerometer object\n" " pyb.Accel() -- create an Accelerometer object\n"
" Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()\n" " Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()\n"
" pyb.rng() -- get a 30-bit hardware random number\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" " pyb.ADC(port) -- make an analog port object\n"
" ADC methods: read()\n" " ADC methods: read()\n"
"\n" "\n"
"Ports are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name\n" "Ports are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name\n"
"Port input modes are: pyb.PULL_NONE, pyb.PULL_UP, pyb.PULL_DOWN\n" "Port IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD\n"
"Port output modes are: pyb.PUSH_PULL, pyb.OPEN_DRAIN\n" "Port pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN\n"
"\n" "\n"
"Control commands:\n" "Control commands:\n"
" CTRL-A -- on a blank line, enter raw REPL mode\n" " CTRL-A -- on a blank line, enter raw REPL mode\n"

@ -13,7 +13,6 @@
#include "pybstdio.h" #include "pybstdio.h"
#include "pyexec.h" #include "pyexec.h"
#include "led.h" #include "led.h"
#include "gpio.h"
#include "pin.h" #include "pin.h"
#include "extint.h" #include "extint.h"
#include "usrsw.h" #include "usrsw.h"

@ -18,7 +18,7 @@
// //
// x1_pin = pyb.Pin.board.X1 // 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 // CPU pins which correspond to the board pins are available
// as pyb.cpu.Name. For the CPU pins, the names are the port letter // as pyb.cpu.Name. For the CPU pins, the names are the port letter
@ -27,16 +27,16 @@
// //
// You can also use strings: // You can also use strings:
// //
// g = pyb.gpio('X1', 0) // g = pyb.Pin('X1', pyb.Pin.OUT_PP)
// //
// Users can add their own names: // Users can add their own names:
// //
// pyb.Pin("LeftMotorDir", pyb.Pin.cpu.C12) // pyb.Pin.dict["LeftMotorDir"] = pyb.Pin.cpu.C12
// g = pyb.gpio("LeftMotorDir", 0) // g = pyb.Pin("LeftMotorDir", pyb.Pin.OUT_OD)
// //
// and can query mappings // and can query mappings
// //
// pin = pyb.Pin("LeftMotorDir"); // pin = pyb.Pin("LeftMotorDir")
// //
// Users can also add their own mapping function: // Users can also add their own mapping function:
// //
@ -46,7 +46,7 @@
// //
// pyb.Pin.mapper(MyMapper) // 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. // then "LeftMotorDir" is passed directly to the mapper function.
// //
// To summarize, the following order determines how things get mapped into // To summarize, the following order determines how things get mapped into

@ -34,9 +34,6 @@ Q(rng)
Q(LCD) Q(LCD)
Q(SD) Q(SD)
Q(SDcard) Q(SDcard)
Q(gpio)
Q(gpio_in)
Q(gpio_out)
Q(FileIO) Q(FileIO)
// Entries for sys.path // Entries for sys.path
Q(0:/) Q(0:/)

@ -6,12 +6,10 @@
#include "qstr.h" #include "qstr.h"
#include "obj.h" #include "obj.h"
#include "runtime.h" #include "runtime.h"
#include "usrsw.h"
#include "extint.h" #include "extint.h"
#include "gpio.h"
#include "pin.h" #include "pin.h"
#include "genhdr/pins.h" #include "genhdr/pins.h"
#include "usrsw.h"
// Usage Model: // Usage Model:
// //