Browse Source

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

pull/512/head
Damien George 11 years ago
parent
commit
a8f5d15fc6
  1. 11
      stmhal/help.c
  2. 1
      stmhal/modpyb.c
  3. 12
      stmhal/pin.c
  4. 3
      stmhal/qstrdefsport.h
  5. 4
      stmhal/usrsw.c

11
stmhal/help.c

@ -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.PULL_NONE, pyb.PULL_UP, pyb.PULL_DOWN\n"
"Port output modes are: pyb.PUSH_PULL, pyb.OPEN_DRAIN\n"
"Port IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD\n"
"Port pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN\n"
"\n"
"Control commands:\n"
" CTRL-A -- on a blank line, enter raw REPL mode\n"

1
stmhal/modpyb.c

@ -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"

12
stmhal/pin.c

@ -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

3
stmhal/qstrdefsport.h

@ -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:/)

4
stmhal/usrsw.c

@ -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:
//

Loading…
Cancel
Save