summaryrefslogtreecommitdiff
path: root/examples/pins.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-27 15:36:53 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 10:33:03 +1100
commit69661f3343bedf86e514337cff63d96cc42f8859 (patch)
treeaf5dfb380ffdb75dda84828f63cf9d840d992f0f /examples/pins.py
parent3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff)
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'examples/pins.py')
-rw-r--r--examples/pins.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/examples/pins.py b/examples/pins.py
index aafdb4813..3a8472e8a 100644
--- a/examples/pins.py
+++ b/examples/pins.py
@@ -4,6 +4,7 @@
import pyb
import pins_af
+
def af():
max_name_width = 0
max_af_width = 0
@@ -13,21 +14,22 @@ def af():
max_af_width = max(max_af_width, len(af_entry[1]))
for pin_entry in pins_af.PINS_AF:
pin_name = pin_entry[0]
- print('%-*s ' % (max_name_width, pin_name), end='')
+ print("%-*s " % (max_name_width, pin_name), end="")
for af_entry in pin_entry[1:]:
- print('%2d: %-*s ' % (af_entry[0], max_af_width, af_entry[1]), end='')
- print('')
+ print("%2d: %-*s " % (af_entry[0], max_af_width, af_entry[1]), end="")
+ print("")
+
def pins():
- mode_str = { pyb.Pin.IN : 'IN',
- pyb.Pin.OUT_PP : 'OUT_PP',
- pyb.Pin.OUT_OD : 'OUT_OD',
- pyb.Pin.AF_PP : 'AF_PP',
- pyb.Pin.AF_OD : 'AF_OD',
- pyb.Pin.ANALOG : 'ANALOG' }
- pull_str = { pyb.Pin.PULL_NONE : '',
- pyb.Pin.PULL_UP : 'PULL_UP',
- pyb.Pin.PULL_DOWN : 'PULL_DOWN' }
+ mode_str = {
+ pyb.Pin.IN: "IN",
+ pyb.Pin.OUT_PP: "OUT_PP",
+ pyb.Pin.OUT_OD: "OUT_OD",
+ pyb.Pin.AF_PP: "AF_PP",
+ pyb.Pin.AF_OD: "AF_OD",
+ pyb.Pin.ANALOG: "ANALOG",
+ }
+ pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
for pin_entry in pins_af.PINS_AF:
@@ -42,17 +44,17 @@ def pins():
pin_af = pin.af()
for af_entry in pin_entry[1:]:
if pin_af == af_entry[0]:
- af_str = '%d: %s' % (pin_af, af_entry[1])
+ af_str = "%d: %s" % (pin_af, af_entry[1])
break
else:
- af_str = '%d' % pin_af
+ af_str = "%d" % pin_af
else:
- af_str = ''
+ af_str = ""
row.append(af_str)
for col in range(len(width)):
width[col] = max(width[col], len(row[col]))
rows.append(row)
for row in rows:
for col in range(len(width)):
- print('%-*s ' % (width[col], row[col]), end='')
- print('')
+ print("%-*s " % (width[col], row[col]), end="")
+ print("")