From 77df75f4ed62ffdad216599fd84286b3b81586d6 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Fri, 22 Sep 2017 16:38:37 -0700 Subject: [PATCH] GPIO Pins needs clone type. --- src/main/scala/devices/gpio/GPIOPins.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/scala/devices/gpio/GPIOPins.scala b/src/main/scala/devices/gpio/GPIOPins.scala index e2f279e..8572923 100644 --- a/src/main/scala/devices/gpio/GPIOPins.scala +++ b/src/main/scala/devices/gpio/GPIOPins.scala @@ -11,9 +11,15 @@ import sifive.blocks.devices.pinctrl.{Pin} // type of pad this connects to. class GPIOSignals[T <: Data] (pingen: ()=> T, c: GPIOParams) extends Bundle { val pins = Vec(c.width, pingen()) + + override def cloneType: this.type = + this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type] } -class GPIOPins[T <: Pin] (pingen: ()=> T, c: GPIOParams) extends GPIOSignals[T](pingen, c) +class GPIOPins[T <: Pin] (pingen: ()=> T, c: GPIOParams) extends GPIOSignals[T](pingen, c) { + override def cloneType: this.type = + this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type] +} object GPIOPinsFromPort {