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 /stmhal/mphal.h | |
| 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 'stmhal/mphal.h')
| -rw-r--r-- | stmhal/mphal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/stmhal/mphal.h b/stmhal/mphal.h index 4e9a8b2bb..33407622c 100644 --- a/stmhal/mphal.h +++ b/stmhal/mphal.h @@ -5,3 +5,4 @@ #define GPIO_read_pin(gpio, pin) (((gpio)->IDR >> (pin)) & 1) #define GPIO_set_pin(gpio, pin_mask) (((gpio)->BSRRL) = (pin_mask)) #define GPIO_clear_pin(gpio, pin_mask) (((gpio)->BSRRH) = (pin_mask)) +#define GPIO_read_output_pin(gpio, pin) (((gpio)->ODR >> (pin)) & 1) |
