- def fromI2CPort(i2c: I2CPort, syncStages: Int = 0) = {
- scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B)
- scl.o.oe := i2c.scl.oe
- i2c.scl.in := ShiftRegisterInit(scl.i.ival, syncStages, Bool(true))
+ override def cloneType: this.type =
+ this.getClass.getConstructors.head.newInstance(pingen).asInstanceOf[this.type]
+}
+
+class I2CPins[T <: Pin](pingen: () => T) extends I2CSignals[T](pingen) {
+ override def cloneType: this.type =
+ this.getClass.getConstructors.head.newInstance(pingen).asInstanceOf[this.type]
+
+ def fromPort(i2c: I2CPort, clock: Clock, reset: Bool, syncStages: Int = 0) = {
+ withClockAndReset(clock, reset) {
+ scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B)
+ scl.o.oe := i2c.scl.oe
+ i2c.scl.in := SyncResetSynchronizerShiftReg(scl.i.ival, syncStages, init = Bool(true),
+ name = Some("i2c_scl_sync"))