projects
/
sifive-blocks.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
device pins: Create classes that can be something other than a Pin subclass
[sifive-blocks.git]
/
src
/
main
/
scala
/
devices
/
pwm
/
PWMPeriphery.scala
diff --git
a/src/main/scala/devices/pwm/PWMPeriphery.scala
b/src/main/scala/devices/pwm/PWMPeriphery.scala
index 3754f71ca3dbf562d05f3169ba370e9a5e1335ba..94f65dd760e8c5d75537fc380140492a689526d8 100644
(file)
--- a/
src/main/scala/devices/pwm/PWMPeriphery.scala
+++ b/
src/main/scala/devices/pwm/PWMPeriphery.scala
@@
-13,10
+13,17
@@
class PWMPortIO(val c: PWMParams) extends Bundle {
override def cloneType: this.type = new PWMPortIO(c).asInstanceOf[this.type]
}
override def cloneType: this.type = new PWMPortIO(c).asInstanceOf[this.type]
}
-class PWM
Pins[T <: Pin
] (pingen: ()=> T, val c: PWMParams) extends Bundle {
+class PWM
Signals[T <: Data
] (pingen: ()=> T, val c: PWMParams) extends Bundle {
val pwm: Vec[T] = Vec(c.ncmp, pingen())
val pwm: Vec[T] = Vec(c.ncmp, pingen())
+ override def cloneType: this.type =
+ this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
+}
+
+
+class PWMPins[T <: Pin] (pingen: ()=> T, val c: PWMParams) extends PWMSignals[T](pingen, c) {
+
override def cloneType: this.type =
this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
override def cloneType: this.type =
this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]