diff options
| author | Dave Hylands | 2014-07-22 07:57:36 -0700 |
|---|---|---|
| committer | Dave Hylands | 2014-08-07 23:15:41 -0700 |
| commit | 6f418fc1b068c1a41113bb2b019a5803765e1deb (patch) | |
| tree | 79477835459eb424012f58d77a150bdf9a80eed5 /teensy/Makefile | |
| parent | 3ef911345c94a6d612ab50c1e912e81cb2cc3f71 (diff) | |
Add support for selecting pin alternate functions from python.
Converts generted pins to use qstrs instead of string pointers.
This patch also adds the following functions:
pyb.Pin.names()
pyb.Pin.af_list()
pyb.Pin.gpio()
dir(pyb.Pin.board) and dir(pyb.Pin.cpu) also produce useful results.
pyb.Pin now takes kw args.
pyb.Pin.__str__ now prints more useful information about the pin
configuration.
I found the following functions in my boot.py to be useful:
```python
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin)))
def af():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin.af_list())))
```
Diffstat (limited to 'teensy/Makefile')
| -rw-r--r-- | teensy/Makefile | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/teensy/Makefile b/teensy/Makefile index 54e6ef050..5b8e26621 100644 --- a/teensy/Makefile +++ b/teensy/Makefile @@ -1,7 +1,7 @@ include ../py/mkenv.mk # qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h +QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h # include py core make definitions include ../py/py.mk @@ -53,6 +53,7 @@ SRC_C = \ lexermemzip.c \ memzip.c \ modpyb.c \ + pin_defs_teensy.c \ teensy_hal.c \ uart.c \ usb.c \ @@ -137,6 +138,8 @@ AF_FILE = mk20dx256-af.csv PREFIX_FILE = mk20dx256-prefix.c GEN_PINS_SRC = $(BUILD)/pins_gen.c GEN_PINS_HDR = $(HEADER_BUILD)/pins.h +GEN_PINS_QSTR = $(BUILD)/pins_qstr.h +GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins-af-const.h # Making OBJ use an order-only depenedency on the generated pins.h file # has the side effect of making the pins.h file before we actually compile @@ -147,9 +150,9 @@ $(OBJ): | $(HEADER_BUILD)/pins.h # Use a pattern rule here so that make will only call make-pins.py once to make # both pins_$(BOARD).c and pins.h -$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h: teensy-%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) +$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%-af-const.h $(BUILD)/%_qstr.h: teensy-%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD) $(ECHO) "Create $@" - $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC) + $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) > $(GEN_PINS_SRC) $(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c $(call compile_c) |
