Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
put sbt on PATH; wip.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed May 30, 2024
1 parent 868d137 commit 290643e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: 'sbt'

- name: Install sbt
run: |
wget https://github.com/sbt/sbt/releases/download/v1.9.8/sbt-1.9.8.tgz
tar xf sbt-1.9.8.tgz
echo "$PWD/sbt/bin" >> $GITHUB_PATH
- name: Install Verilator
run: sudo apt-get install -y verilator

- name: Run tests
run: sbt/bin/sbt test
run: sbt test
11 changes: 0 additions & 11 deletions src/main/scala/ee/hrzn/chryse/platform/resource/Disconnected.scala

This file was deleted.

42 changes: 23 additions & 19 deletions src/main/scala/ee/hrzn/chryse/platform/resource/SPIOLED.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,31 @@ import chisel3._
import chisel3.experimental.Param

class SPIOLED extends ResourceBase {
val cs = ResourceData(Output(Bool()), invert = true)
// TODO: There's often a BL/BLK pin pulled high by the OLED which you can
// ground to turn off the backlight.
val cs = ResourceData(Output(Bool()), invert = true) // permitted to be unset
val clock = ResourceData(Output(Clock()))
val copi = ResourceData(Output(Bool()))
val cipo = ResourceData(Input(Bool()))
val wp = ResourceData(Output(Bool()), invert = true)
val hold = ResourceData(Output(Bool()), invert = true)
val cipo = ResourceData(Input(Bool())) // permitted to be unset
val dc = ResourceData(Output(Bool()), invert = true)
val res = ResourceData(Output(Bool()), invert = true)

def setName(name: String): Unit = {
cs.setName(s"${name}_cs")
clock.setName(s"${name}_clock")
copi.setName(s"${name}_copi")
cipo.setName(s"${name}_cipo")
wp.setName(s"${name}_wp")
hold.setName(s"${name}_hold")
dc.setName(s"${name}_dc")
res.setName(s"${name}_res")
}

def withAttributes(attribs: (String, Param)*): this.type = {
cs.withAttributes(attribs: _*)
clock.withAttributes(attribs: _*)
copi.withAttributes(attribs: _*)
cipo.withAttributes(attribs: _*)
wp.withAttributes(attribs: _*)
hold.withAttributes(attribs: _*)
dc.withAttributes(attribs: _*)
res.withAttributes(attribs: _*)
this
}

Expand All @@ -35,29 +37,31 @@ class SPIOLED extends ResourceBase {
clock.setDefaultAttributes(defaultAttributes)
copi.setDefaultAttributes(defaultAttributes)
cipo.setDefaultAttributes(defaultAttributes)
wp.setDefaultAttributes(defaultAttributes)
hold.setDefaultAttributes(defaultAttributes)
dc.setDefaultAttributes(defaultAttributes)
res.setDefaultAttributes(defaultAttributes)
}

def onPins(
csN: Pin,
csN: Pin = null,
clock: Pin,
copi: Pin,
cipo: Pin,
wpN: Pin,
holdN: Pin,
cipo: Pin = null,
dcN: Pin,
resN: Pin,
): this.type = {
this.cs.onPin(csN)
if (csN != null)
this.cs.onPin(csN)
this.clock.onPin(clock)
this.copi.onPin(copi)
this.cipo.onPin(cipo)
this.wp.onPin(wpN)
this.hold.onPin(holdN)
if (cipo != null)
this.cipo.onPin(cipo)
this.dc.onPin(dcN)
this.res.onPin(resN)
this
}

def data: Seq[ResourceData[_ <: Data]] =
Seq(cs, clock, copi, cipo, wp, hold)
Seq(clock, copi, dc, res) ++ Seq(cs, cipo).filter(_.pinId.isDefined)
}

object SPIOLED {
Expand Down

0 comments on commit 290643e

Please sign in to comment.