1 // See LICENSE for license details.
2 package sifive.blocks.devices.i2c
5 import chisel3.experimental.{withClockAndReset}
6 import sifive.blocks.devices.pinctrl.{Pin, PinCtrl}
7 import sifive.blocks.util.ShiftRegisterInit
10 class I2CPins[T <: Pin](pingen: () => T) extends Bundle {
15 override def cloneType: this.type =
16 this.getClass.getConstructors.head.newInstance(pingen).asInstanceOf[this.type]
18 def fromI2CPort(i2c: I2CPort, clock: Clock, reset: Bool, syncStages: Int = 0) = {
19 withClockAndReset(clock, reset) {
20 scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B)
21 scl.o.oe := i2c.scl.oe
22 i2c.scl.in := ShiftRegisterInit(scl.i.ival, syncStages, Bool(true))
24 sda.outputPin(i2c.sda.out, pue=true.B, ie = true.B)
25 sda.o.oe := i2c.sda.oe
26 i2c.sda.in := ShiftRegisterInit(sda.i.ival, syncStages, Bool(true))