From 91054ff296c3a7eac8c8a47eee7f1f2b84b933b7 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 28 Mar 2018 16:38:54 +0100 Subject: [PATCH] sort out pwm naming scheme --- src/spec/interfaces.py | 7 +++++-- src/spec/m_class.py | 17 +++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/spec/interfaces.py b/src/spec/interfaces.py index 64cd229..ceceaf9 100644 --- a/src/spec/interfaces.py +++ b/src/spec/interfaces.py @@ -278,8 +278,11 @@ def eint(bankspec, suffix, offs, bank, gpiooffs, gpionum=1, mux=1, spec=None): return Pins('EINT', gpiopins, bankspec, suffix, offs, bank, mux, spec, origsuffix=suffix) -def pwm(bankspec, suffix, offs, bank, mux=1, spec=None): - return Pins('PWM', ['+', ], bankspec, suffix, offs, bank, mux, spec, +def pwm(bankspec, suffix, offs, bank, pwmoffs, pwmnum=1, mux=1, spec=None): + pwmpins = [] + for i in range(pwmoffs, pwmoffs+pwmnum): + pwmpins.append("%d+" % (i)) + return Pins('PWM', pwmpins, bankspec, suffix, offs, bank, mux, spec, origsuffix=suffix) def gpio(bankspec, suffix, offs, bank, gpiooffs, gpionum=1, mux=1, spec=None): diff --git a/src/spec/m_class.py b/src/spec/m_class.py index 9ec198c..34cc91f 100644 --- a/src/spec/m_class.py +++ b/src/spec/m_class.py @@ -50,9 +50,8 @@ def pinspec(): pinmerge(pinouts, quadspi(bankspec, "0", ('B', 4), "B", 2, limit=4)) pinmerge(pinouts, uart(bankspec, "3", ('B', 16), "B", 2)) pinmerge(pinouts, i2c(bankspec, "3", ('B', 18), "B", 2)) - pinmerge(pinouts, pwm(bankspec, "0", ('B', 9), "B", mux=2)) - pinmerge(pinouts, pwm(bankspec, "1", ('B', 20), "B", mux=2)) - pinmerge(pinouts, pwm(bankspec, "2", ('B', 21), "B", mux=2)) + pinmerge(pinouts, pwm(bankspec, "", ('B', 9), "B", 0, 1, mux=2)) + pinmerge(pinouts, pwm(bankspec, "", ('B', 20), "B", 1, 2, mux=2)) pinmerge(pinouts, sdmmc(bankspec, "1", ('B', 22), "B", 2)) pinmerge(pinouts, eint(bankspec, "", ('B', 0), "B", 6, 4, mux=3)) pinmerge(pinouts, flexbus2(bankspec, "0", ('B', 4), "B", 3)) @@ -72,7 +71,7 @@ def pinspec(): pinmerge(pinouts, eint(bankspec, "", ('C', 12), "C", 22, 8, mux=3)) pinmerge(pinouts, uart(bankspec, "2", ('C', 22), "C", 2)) pinmerge(pinouts, i2s(bankspec, "", ('C', 13), "C", 2)) - pinmerge(pinouts, pwm(bankspec, "2", ('C', 21), "C", mux=2)) + pinmerge(pinouts, pwm(bankspec, "", ('C', 21), "C", 2, 1, mux=2)) # Bank D, 72-96 flexspec = { @@ -89,9 +88,7 @@ def pinspec(): pinmerge(pinouts, gpio(bankspec, "", ('D', 0), "D", 0, 24, 0)) pinmerge(pinouts, flexbus1(bankspec, "0", ('D', 0), "D", 1, spec=flexspec)) pinmerge(pinouts, i2c(bankspec, "2", ('D', 17), "D", 2)) - pinmerge(pinouts, pwm(bankspec, "0", ('D', 21), "D", mux=1)) - pinmerge(pinouts, pwm(bankspec, "1", ('D', 22), "D", mux=1)) - pinmerge(pinouts, pwm(bankspec, "2", ('D', 23), "D", mux=1)) + pinmerge(pinouts, pwm(bankspec, "", ('D', 21), "D", 0, 3, mux=1)) pinmerge(pinouts, i2c(bankspec, "1", ('D', 10), "D", 3)) pinmerge(pinouts, i2c(bankspec, "3", ('D', 19), "D", 2)) pinmerge(pinouts, uartfull(bankspec, "0", ('D', 0), "D", 2)) @@ -120,12 +117,12 @@ def pinspec(): pinmerge(pinouts, gpio(bankspec, "", ('F', 0), "F", 0, 10, 0)) pinmerge(pinouts, i2s(bankspec, "", ('F', 0), "F", 1)) pinmerge(pinouts, i2c(bankspec, "1", ('F', 6), "F", 2)) - pinmerge(pinouts, pwm(bankspec, "0", ('F', 8), "F", mux=2)) - pinmerge(pinouts, pwm(bankspec, "1", ('F', 9), "F", mux=2)) + pinmerge(pinouts, pwm(bankspec, "", ('F', 8), "F", 0, 1, mux=2)) + pinmerge(pinouts, pwm(bankspec, "", ('F', 9), "F", 1, 1, mux=2)) pinmerge(pinouts, uart(bankspec, "4", ('F', 8), "F", 1)) pinmerge(pinouts, sdmmc(bankspec, "3", ('F', 0), "F", 2)) pinmerge(pinouts, eint(bankspec, "", ('F', 0), "F", 18, 4, mux=3)) - pinmerge(pinouts, pwm(bankspec, "2", ('F', 4), "F", mux=3)) + pinmerge(pinouts, pwm(bankspec, "", ('F', 4), "F", 2, 1, mux=3)) pinmerge(pinouts, eint(bankspec, "", ('F', 5), "F", 7, 1, mux=3)) pinmerge(pinouts, eint(bankspec, "", ('F', 6), "F", 28, 4, mux=3)) -- 2.30.2