This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: make it possible to specify a pin in a resource which is wired m…
…anually by the platform. The use-case being USRMCLK for ECP5 SPI flash clock access. This is different to iCE40's ubtnReset, which is just a feature the (Chryse) platform provides.
- Loading branch information
Showing
15 changed files
with
114 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
src/main/scala/ee/hrzn/chryse/platform/ecp5/ECP5Variant.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
package ee.hrzn.chryse.platform.ecp5 | ||
|
||
sealed trait ECP5Variant { val arg: String } | ||
final case object LFE5U_25F extends ECP5Variant { val arg = "--25k" } | ||
final case object LFE5U_45F extends ECP5Variant { val arg = "--45k" } | ||
final case object LFE5U_85F extends ECP5Variant { val arg = "--85k" } | ||
sealed trait ECP5Variant { | ||
val id: String | ||
val arg: String | ||
} | ||
|
||
final case object LFE5U_25F extends ECP5Variant { | ||
val id = "25f" | ||
val arg = "--25k" | ||
} | ||
|
||
final case object LFE5U_45F extends ECP5Variant { | ||
val id = "45f" | ||
val arg = "--45k" | ||
} | ||
|
||
final case object LFE5U_85F extends ECP5Variant { | ||
val id = "85f" | ||
val arg = "--85k" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ee.hrzn.chryse.platform.ecp5 | ||
|
||
import ee.hrzn.chryse.platform.resource.Pin | ||
import ee.hrzn.chryse.platform.resource.PinPlatform | ||
|
||
import scala.language.implicitConversions | ||
|
||
object USRMCLK { | ||
implicit def usrmclk2Pin(usrmclk: this.type): Pin = | ||
PinPlatform(this) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/main/scala/ee/hrzn/chryse/platform/resource/PinConnected.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ee.hrzn.chryse.platform.resource | ||
|
||
import scala.language.implicitConversions | ||
|
||
sealed trait Pin | ||
|
||
case class PinPlatform(p: Any) extends Pin {} | ||
|
||
sealed trait PinConnected extends Pin | ||
|
||
case class PinString(p: String) extends PinConnected { | ||
override def toString(): String = p | ||
} | ||
|
||
case class PinInt(p: Int) extends PinConnected { | ||
override def toString(): String = s"$p" | ||
} | ||
|
||
object Pin { | ||
def apply(p: String): PinConnected = string2PinConnected(p) | ||
|
||
implicit def string2PinConnected(p: String): PinConnected = PinString(p) | ||
implicit def int2PinConnected(p: Int): PinConnected = PinInt(p) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters