trait HasPeripheryI2CBundle {
val i2cs: Vec[I2CPort]
- def toGPIOPins(syncStages: Int = 0): Seq[I2CGPIOPort] = i2cs.map { i =>
- val pin = Module(new I2CGPIOPort(syncStages))
- pin.io.i2c <> i
- pin
+ def I2CtoGPIOPins(syncStages: Int = 0): Seq[I2CPinsIO] = i2cs.map { i =>
+ val pins = Module(new I2CGPIOPort(syncStages))
+ pins.io.i2c <> i
+ pins.io.pins
}
}
trait HasPeripheryPWMBundle {
val pwms: HeterogeneousBag[PWMPortIO]
- def PWMtoGPIOPins(dummy: Int = 1): Seq[PWMGPIOPort] = pwms.map { p =>
- val pin = Module(new PWMGPIOPort(p.c))
- pin.io.pwm <> p
- pin
+ def PWMtoGPIOPins(dummy: Int = 1): Seq[PWMPinsIO] = pwms.map { p =>
+ val pins = Module(new PWMGPIOPort(p.c))
+ pins.io.pwm <> p
+ pins.io.pins
}
}
trait HasPeripherySPIBundle {
val spis: HeterogeneousBag[SPIPortIO]
- def SPItoGPIOPins(syncStages: Int = 0): Seq[SPIGPIOPort] = spis.map { s =>
- val pin = Module(new SPIGPIOPort(s.c, syncStages))
- pin.io.spi <> s
- pin
+ def SPItoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = spis.map { s =>
+ val pins = Module(new SPIGPIOPort(s.c, syncStages))
+ pins.io.spi <> s
+ pins.io.pins
}
}
trait HasPeripherySPIFlashBundle {
val qspi: HeterogeneousBag[SPIPortIO]
+
+ // It is important for SPIFlash that the syncStages is agreed upon, because
+ // internally it needs to realign the input data to the output SCK.
+ // Therefore, we rely on the syncStages parameter.
+ def SPIFlashtoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = qspi.map { s =>
+ val pins = Module(new SPIGPIOPort(s.c, syncStages))
+ pins.io.spi <> s
+ pins.io.pins
+ }
}
trait HasPeripherySPIFlashModuleImp extends LazyMultiIOModuleImp with HasPeripherySPIFlashBundle {