aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2015-10-26 23:35:48 -0500
committerDavid Barksdale <amatus@amatus.name>2015-10-26 23:35:48 -0500
commit4c22f6308756334d9056feaa47817cb5ea71fd7c (patch)
tree18dc29eb1a551cbff54cd11b41bd183873b47b27
parent4ac8a23e01a028a7062e404e1c53c9b184d6e503 (diff)
Changes to get the LCD working
-rw-r--r--laser-tag badge/laser-tag.brd64
-rw-r--r--laser-tag badge/laser-tag.sch81
-rwxr-xr-xlaser-tag software/CMakeLists.txt1
-rwxr-xr-xlaser-tag software/main.c65
4 files changed, 136 insertions, 75 deletions
diff --git a/laser-tag badge/laser-tag.brd b/laser-tag badge/laser-tag.brd
index 0922d7b..d0cc6c0 100644
--- a/laser-tag badge/laser-tag.brd
+++ b/laser-tag badge/laser-tag.brd
@@ -2584,13 +2584,13 @@ design rules under a new name.</description>
<element name="S4" library="switch" package="SKHMPXE010" value="SKHMPSE010" x="67.31" y="48.26"/>
<element name="U$1" library="Graphics" package="AHA" value="AHA" x="41.275" y="43.815"/>
<element name="Q1" library="transistor-small-signal" package="SOT23" value="2N7002ET1G" x="60.96" y="69.85" rot="MR0"/>
-<element name="J1" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="49.53" y="64.77"/>
+<element name="J1" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="53.975" y="66.675"/>
<element name="J3" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="41.275" y="24.765" rot="R90"/>
-<element name="J6" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="52.705" y="67.31" rot="R90"/>
-<element name="J7" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="51.435" y="67.31" rot="R90"/>
-<element name="J8" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="49.53" y="67.31" rot="R90"/>
-<element name="J9" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="48.26" y="67.31" rot="R90"/>
-<element name="J10" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="46.355" y="67.31" rot="R90"/>
+<element name="J6" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="52.605" y="67.31" rot="R90"/>
+<element name="J7" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="51.135" y="67.31" rot="R90"/>
+<element name="J8" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="49.63" y="67.31" rot="R90"/>
+<element name="J9" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="48.16" y="67.31" rot="R90"/>
+<element name="J10" library="Jumpers" package="JUMPER_SOLDER_1X2_CLOSED" value="JUMPER_SOLDER_1X2_CLOSED" x="46.655" y="67.31" rot="R90"/>
<element name="J2" library="Jumpers" package="JUMPER_SOLDER_1X2_OPEN" value="JUMPER_SOLDER_1X2_OPEN" x="45.72" y="48.895"/>
<element name="PD1" library="Photonics" package="PDB-C156-FLUSH" value="PDB-C156" x="40.64" y="7.62" smashed="yes" rot="R180">
<attribute name="NAME" x="42.545" y="12.065" size="1.27" layer="25" rot="R180"/>
@@ -2795,6 +2795,8 @@ design rules under a new name.</description>
<wire x1="31.115" y1="29.21" x2="31.115" y2="27.94" width="0.254" layer="16"/>
<wire x1="31.115" y1="27.94" x2="29.845" y2="26.67" width="0.254" layer="16"/>
<wire x1="29.845" y1="26.67" x2="29.21" y2="26.67" width="0.254" layer="16"/>
+<contactref element="J7" pad="1"/>
+<wire x1="60.325" y1="38.227" x2="51.135" y2="67.0306" width="0" layer="19" extent="1-16"/>
<wire x1="38.960621875" y1="39.444415625" x2="60.325" y2="38.227" width="0" layer="19" extent="16-16"/>
</signal>
<signal name="PTE0">
@@ -2812,7 +2814,8 @@ design rules under a new name.</description>
<contactref element="U1" pad="1"/>
<wire x1="41.965828125" y1="52.349134375" x2="46.99" y2="57.37330625" width="0.254" layer="16"/>
<contactref element="J1" pad="2"/>
-<wire x1="50.8" y1="64.77" x2="49.8094" y2="64.77" width="0" layer="19" extent="1-16"/>
+<wire x1="54.2544" y1="66.675" x2="54.61" y2="66.3194" width="0.254" layer="1"/>
+<wire x1="54.61" y1="66.3194" x2="54.61" y2="64.77" width="0.254" layer="1"/>
</signal>
<signal name="PTE1">
<contactref element="BREAKOUT1" pad="2"/>
@@ -2826,7 +2829,8 @@ design rules under a new name.</description>
<contactref element="U1" pad="2"/>
<wire x1="42.31938125" y1="51.99558125" x2="47.625" y2="57.3012" width="0.254" layer="16"/>
<contactref element="J1" pad="1"/>
-<wire x1="50.165" y1="63.5" x2="49.2506" y2="64.77" width="0" layer="19" extent="1-16"/>
+<wire x1="53.6956" y1="66.675" x2="52.07" y2="65.0494" width="0.254" layer="1"/>
+<wire x1="52.07" y1="65.0494" x2="52.07" y2="64.77" width="0.254" layer="1"/>
</signal>
<signal name="USB0_DP">
<contactref element="U1" pad="5"/>
@@ -2865,16 +2869,12 @@ design rules under a new name.</description>
<wire x1="44.79425" y1="49.520709375" x2="51.1535375" y2="55.88" width="0.254" layer="16"/>
<wire x1="51.1535375" y1="55.88" x2="53.34" y2="55.88" width="0.254" layer="16"/>
<wire x1="53.34" y1="55.88" x2="54.61" y2="54.61" width="0.254" layer="16"/>
-<contactref element="J6" pad="1"/>
-<wire x1="53.34" y1="55.88" x2="52.705" y2="67.0306" width="0" layer="19" extent="1-16"/>
</signal>
<signal name="PTE21">
<contactref element="U1" pad="10"/>
<contactref element="BREAKOUT1" pad="10"/>
<wire x1="45.147821875" y1="49.167140625" x2="50.590678125" y2="54.61" width="0.254" layer="16"/>
<wire x1="50.590678125" y1="54.61" x2="52.07" y2="54.61" width="0.254" layer="16"/>
-<contactref element="J8" pad="1"/>
-<wire x1="50.590678125" y1="54.61" x2="49.53" y2="67.0306" width="0" layer="19" extent="1-16"/>
</signal>
<signal name="PTE22">
<contactref element="U1" pad="11"/>
@@ -2882,16 +2882,12 @@ design rules under a new name.</description>
<wire x1="45.501371875" y1="48.8135875" x2="50.02778125" y2="53.34" width="0.254" layer="16"/>
<wire x1="50.02778125" y1="53.34" x2="53.34" y2="53.34" width="0.254" layer="16"/>
<wire x1="53.34" y1="53.34" x2="54.61" y2="52.07" width="0.254" layer="16"/>
-<contactref element="J9" pad="1"/>
-<wire x1="50.02778125" y1="53.34" x2="48.26" y2="67.0306" width="0" layer="19" extent="1-16"/>
</signal>
<signal name="PTE23">
<contactref element="U1" pad="12"/>
<contactref element="BREAKOUT1" pad="12"/>
<wire x1="45.854925" y1="48.460034375" x2="49.4648875" y2="52.07" width="0.254" layer="16"/>
<wire x1="49.4648875" y1="52.07" x2="52.07" y2="52.07" width="0.254" layer="16"/>
-<contactref element="J10" pad="1"/>
-<wire x1="49.4648875" y1="52.07" x2="46.355" y2="67.0306" width="0" layer="19" extent="1-16"/>
</signal>
<signal name="VREFH">
<contactref element="U1" pad="14"/>
@@ -2950,8 +2946,6 @@ design rules under a new name.</description>
<contactref element="BREAKOUT1" pad="20"/>
<wire x1="46.208478125" y1="43.333515625" x2="47.631990625" y2="41.91" width="0.254" layer="16"/>
<wire x1="47.631990625" y1="41.91" x2="52.07" y2="41.91" width="0.254" layer="16"/>
-<contactref element="J7" pad="1"/>
-<wire x1="46.208478125" y1="43.333515625" x2="51.435" y2="67.0306" width="0" layer="19" extent="1-16"/>
</signal>
<signal name="PTE25">
<contactref element="BREAKOUT1" pad="21"/>
@@ -3025,6 +3019,9 @@ design rules under a new name.</description>
<wire x1="31.115" y1="62.23" x2="31.115" y2="63.5" width="0.254" layer="16"/>
<wire x1="31.115" y1="63.5" x2="29.845" y2="64.77" width="0.254" layer="16"/>
<wire x1="29.845" y1="64.77" x2="29.21" y2="64.77" width="0.254" layer="16"/>
+<wire x1="44.3944" y1="64.77" x2="29.21" y2="64.77" width="0.254" layer="1"/>
+<contactref element="J10" pad="1"/>
+<wire x1="46.655" y1="67.0306" x2="44.3944" y2="64.77" width="0.254" layer="1"/>
</signal>
<signal name="PTD6">
<contactref element="U1" pad="63"/>
@@ -3036,6 +3033,14 @@ design rules under a new name.</description>
<wire x1="30.48" y1="62.865" x2="29.845" y2="63.5" width="0.254" layer="16"/>
<wire x1="29.845" y1="63.5" x2="27.94" y2="63.5" width="0.254" layer="16"/>
<wire x1="27.94" y1="63.5" x2="26.67" y2="64.77" width="0.254" layer="16"/>
+<wire x1="27.94" y1="63.5" x2="26.67" y2="64.77" width="0.254" layer="1"/>
+<contactref element="J8" pad="1"/>
+<via x="45.72" y="63.5" extent="1-16" drill="0.5"/>
+<wire x1="45.72" y1="63.5" x2="40.64" y2="63.5" width="0.254" layer="16"/>
+<via x="40.64" y="63.5" extent="1-16" drill="0.5"/>
+<wire x1="40.64" y1="63.5" x2="27.94" y2="63.5" width="0.254" layer="1"/>
+<wire x1="49.63" y1="67.0306" x2="46.0994" y2="63.5" width="0.254" layer="1"/>
+<wire x1="46.0994" y1="63.5" x2="45.72" y2="63.5" width="0.254" layer="1"/>
</signal>
<signal name="PTD5">
<contactref element="U1" pad="62"/>
@@ -3044,6 +3049,9 @@ design rules under a new name.</description>
<wire x1="31.115" y1="59.13409375" x2="31.115" y2="60.96" width="0.254" layer="16"/>
<wire x1="31.115" y1="60.96" x2="29.845" y2="62.23" width="0.254" layer="16"/>
<wire x1="29.845" y1="62.23" x2="29.21" y2="62.23" width="0.254" layer="16"/>
+<contactref element="J9" pad="1"/>
+<wire x1="48.16" y1="67.0306" x2="43.3594" y2="62.23" width="0.254" layer="1"/>
+<wire x1="43.3594" y1="62.23" x2="29.21" y2="62.23" width="0.254" layer="1"/>
</signal>
<signal name="PTD4">
<contactref element="U1" pad="61"/>
@@ -3053,6 +3061,12 @@ design rules under a new name.</description>
<wire x1="30.48" y1="60.325" x2="29.845" y2="60.96" width="0.254" layer="16"/>
<wire x1="29.845" y1="60.96" x2="27.94" y2="60.96" width="0.254" layer="16"/>
<wire x1="27.94" y1="60.96" x2="26.67" y2="62.23" width="0.254" layer="16"/>
+<contactref element="J6" pad="1"/>
+<wire x1="52.605" y1="67.0306" x2="51.6144" y2="66.04" width="0.254" layer="1"/>
+<wire x1="51.6144" y1="66.04" x2="50.165" y2="66.04" width="0.254" layer="1"/>
+<wire x1="50.165" y1="66.04" x2="45.085" y2="60.96" width="0.254" layer="1"/>
+<wire x1="45.085" y1="60.96" x2="27.94" y2="60.96" width="0.254" layer="1"/>
+<wire x1="27.94" y1="60.96" x2="26.67" y2="62.23" width="0.254" layer="1"/>
</signal>
<signal name="PTD3">
<contactref element="U1" pad="60"/>
@@ -3353,27 +3367,31 @@ design rules under a new name.</description>
<signal name="N$6">
<contactref element="LCD" pad="17"/>
<contactref element="J6" pad="2"/>
-<wire x1="52.705" y1="67.5894" x2="52.64" y2="69.73" width="0" layer="19" extent="1-1"/>
+<wire x1="52.64" y1="69.73" x2="52.605" y2="69.695" width="0.254" layer="1"/>
+<wire x1="52.605" y1="69.695" x2="52.605" y2="67.5894" width="0.254" layer="1"/>
</signal>
<signal name="N$7">
<contactref element="LCD" pad="16"/>
<contactref element="J7" pad="2"/>
-<wire x1="51.435" y1="67.5894" x2="51.14" y2="69.73" width="0" layer="19" extent="1-1"/>
+<wire x1="51.135" y1="67.5894" x2="51.14" y2="69.73" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$8">
<contactref element="LCD" pad="15"/>
<contactref element="J8" pad="2"/>
-<wire x1="49.53" y1="67.5894" x2="49.64" y2="69.73" width="0" layer="19" extent="1-1"/>
+<wire x1="49.64" y1="69.73" x2="49.63" y2="69.72" width="0.254" layer="1"/>
+<wire x1="49.63" y1="69.72" x2="49.63" y2="67.5894" width="0.254" layer="1"/>
</signal>
<signal name="N$10">
<contactref element="LCD" pad="14"/>
<contactref element="J9" pad="2"/>
-<wire x1="48.26" y1="67.5894" x2="48.14" y2="69.73" width="0" layer="19" extent="1-1"/>
+<wire x1="48.14" y1="69.73" x2="48.16" y2="69.71" width="0.254" layer="1"/>
+<wire x1="48.16" y1="69.71" x2="48.16" y2="67.5894" width="0.254" layer="1"/>
</signal>
<signal name="N$11">
<contactref element="LCD" pad="13"/>
<contactref element="J10" pad="2"/>
-<wire x1="46.355" y1="67.5894" x2="46.64" y2="69.73" width="0" layer="19" extent="1-1"/>
+<wire x1="46.64" y1="69.73" x2="46.655" y2="69.715" width="0.254" layer="1"/>
+<wire x1="46.655" y1="69.715" x2="46.655" y2="67.5894" width="0.254" layer="1"/>
</signal>
</signals>
</board>
diff --git a/laser-tag badge/laser-tag.sch b/laser-tag badge/laser-tag.sch
index 614689d..2e1f4c5 100644
--- a/laser-tag badge/laser-tag.sch
+++ b/laser-tag badge/laser-tag.sch
@@ -9780,12 +9780,6 @@ support interrupts</text>
<instance part="PD2" gate="G$1" x="-20.32" y="91.44" rot="R180"/>
</instances>
<busses>
-<bus name="PTE20,PTE21,PTE22,PTE23,PTE24,PTE31">
-<segment>
-<wire x1="5.08" y1="76.2" x2="5.08" y2="-43.18" width="0.762" layer="92"/>
-<wire x1="5.08" y1="-43.18" x2="33.02" y2="-43.18" width="0.762" layer="92"/>
-</segment>
-</bus>
</busses>
<nets>
<net name="GND" class="0">
@@ -10098,6 +10092,11 @@ support interrupts</text>
<wire x1="-63.5" y1="60.96" x2="-58.42" y2="60.96" width="0.1524" layer="91"/>
<label x="-58.42" y="60.96" size="1.778" layer="95"/>
</segment>
+<segment>
+<pinref part="J7" gate="J" pin="1"/>
+<wire x1="27.94" y1="-35.56" x2="27.94" y2="-33.02" width="0.1524" layer="91"/>
+<label x="27.94" y="-35.56" size="1.778" layer="95" rot="R270"/>
+</segment>
</net>
<net name="PTE0" class="0">
<segment>
@@ -10129,6 +10128,7 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="USB0_DP"/>
<wire x1="10.16" y1="88.9" x2="7.62" y2="88.9" width="0.1524" layer="91"/>
+<junction x="7.62" y="88.9"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="5"/>
@@ -10145,6 +10145,7 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="USB0_DM"/>
<wire x1="10.16" y1="86.36" x2="7.62" y2="86.36" width="0.1524" layer="91"/>
+<junction x="7.62" y="86.36"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="6"/>
@@ -10161,6 +10162,7 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="VREGIN"/>
<wire x1="10.16" y1="81.28" x2="7.62" y2="81.28" width="0.1524" layer="91"/>
+<junction x="7.62" y="81.28"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="8"/>
@@ -10177,73 +10179,45 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="PTE20"/>
<wire x1="10.16" y1="78.74" x2="7.62" y2="78.74" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="78.74" x2="5.08" y2="76.2" width="0.1524" layer="91"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="9"/>
<wire x1="-111.76" y1="50.8" x2="-116.84" y2="50.8" width="0.1524" layer="91"/>
<label x="-116.84" y="50.8" size="1.778" layer="95" rot="R180"/>
</segment>
-<segment>
-<wire x1="25.4" y1="-40.64" x2="22.86" y2="-43.18" width="0.1524" layer="91"/>
-<pinref part="J6" gate="J" pin="1"/>
-<wire x1="25.4" y1="-40.64" x2="25.4" y2="-33.02" width="0.1524" layer="91"/>
-<label x="25.4" y="-33.02" size="1.778" layer="95" rot="R270"/>
-</segment>
</net>
<net name="PTE21" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTE21"/>
<wire x1="10.16" y1="76.2" x2="7.62" y2="76.2" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="76.2" x2="5.08" y2="73.66" width="0.1524" layer="91"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="10"/>
<wire x1="-104.14" y1="50.8" x2="-99.06" y2="50.8" width="0.1524" layer="91"/>
<label x="-99.06" y="50.8" size="1.778" layer="95"/>
</segment>
-<segment>
-<wire x1="30.48" y1="-40.64" x2="27.94" y2="-43.18" width="0.1524" layer="91"/>
-<pinref part="J8" gate="J" pin="1"/>
-<wire x1="30.48" y1="-40.64" x2="30.48" y2="-33.02" width="0.1524" layer="91"/>
-<label x="30.48" y="-33.02" size="1.778" layer="95" rot="R270"/>
-</segment>
</net>
<net name="PTE22" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTE22"/>
<wire x1="10.16" y1="73.66" x2="7.62" y2="73.66" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="73.66" x2="5.08" y2="71.12" width="0.1524" layer="91"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="11"/>
<wire x1="-111.76" y1="48.26" x2="-116.84" y2="48.26" width="0.1524" layer="91"/>
<label x="-116.84" y="48.26" size="1.778" layer="95" rot="R180"/>
</segment>
-<segment>
-<wire x1="33.02" y1="-40.64" x2="30.48" y2="-43.18" width="0.1524" layer="91"/>
-<pinref part="J9" gate="J" pin="1"/>
-<wire x1="33.02" y1="-40.64" x2="33.02" y2="-33.02" width="0.1524" layer="91"/>
-<label x="33.02" y="-33.02" size="1.778" layer="95" rot="R270"/>
-</segment>
</net>
<net name="PTE23" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTE23"/>
<wire x1="10.16" y1="71.12" x2="7.62" y2="71.12" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="71.12" x2="5.08" y2="68.58" width="0.1524" layer="91"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="12"/>
<wire x1="-104.14" y1="48.26" x2="-99.06" y2="48.26" width="0.1524" layer="91"/>
<label x="-99.06" y="48.26" size="1.778" layer="95"/>
</segment>
-<segment>
-<wire x1="35.56" y1="-40.64" x2="33.02" y2="-43.18" width="0.1524" layer="91"/>
-<pinref part="J10" gate="J" pin="1"/>
-<wire x1="35.56" y1="-40.64" x2="35.56" y2="-33.02" width="0.1524" layer="91"/>
-<label x="35.56" y="-33.02" size="1.778" layer="95" rot="R270"/>
-</segment>
</net>
<net name="VREFH" class="0">
<segment>
@@ -10302,7 +10276,7 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="PTE31"/>
<wire x1="10.16" y1="53.34" x2="7.62" y2="53.34" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="53.34" x2="5.08" y2="50.8" width="0.1524" layer="91"/>
+<junction x="7.62" y="53.34"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="19"/>
@@ -10310,31 +10284,21 @@ support interrupts</text>
<label x="-116.84" y="38.1" size="1.778" layer="95" rot="R180"/>
</segment>
<segment>
-<wire x1="-12.7" y1="-10.16" x2="2.54" y2="-10.16" width="0.1524" layer="91"/>
-<wire x1="2.54" y1="-10.16" x2="5.08" y2="-7.62" width="0.1524" layer="91"/>
-<label x="-12.7" y="-10.16" size="1.778" layer="95"/>
+<label x="-12.7" y="-22.86" size="1.778" layer="95" rot="R180"/>
<pinref part="Q1" gate="G$1" pin="G"/>
<wire x1="-10.16" y1="-22.86" x2="-12.7" y2="-22.86" width="0.1524" layer="91"/>
-<wire x1="-12.7" y1="-10.16" x2="-12.7" y2="-22.86" width="0.1524" layer="91"/>
</segment>
</net>
<net name="PTE24" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTE24"/>
<wire x1="10.16" y1="50.8" x2="7.62" y2="50.8" width="0.1524" layer="91"/>
-<wire x1="7.62" y1="50.8" x2="5.08" y2="48.26" width="0.1524" layer="91"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="20"/>
<wire x1="-104.14" y1="38.1" x2="-99.06" y2="38.1" width="0.1524" layer="91"/>
<label x="-99.06" y="38.1" size="1.778" layer="95"/>
</segment>
-<segment>
-<wire x1="27.94" y1="-40.64" x2="25.4" y2="-43.18" width="0.1524" layer="91"/>
-<pinref part="J7" gate="J" pin="1"/>
-<wire x1="27.94" y1="-40.64" x2="27.94" y2="-33.02" width="0.1524" layer="91"/>
-<label x="27.94" y="-33.02" size="1.778" layer="95" rot="R270"/>
-</segment>
</net>
<net name="PTE25" class="0">
<segment>
@@ -10351,6 +10315,7 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="PTA1"/>
<wire x1="10.16" y1="43.18" x2="7.62" y2="43.18" width="0.1524" layer="91"/>
+<junction x="7.62" y="43.18"/>
</segment>
<segment>
<pinref part="BREAKOUT1" gate="A" pin="23"/>
@@ -10436,45 +10401,69 @@ support interrupts</text>
<segment>
<pinref part="U1" gate="A" pin="PTA7"/>
<wire x1="116.84" y1="99.06" x2="119.38" y2="99.06" width="0.1524" layer="91"/>
+<junction x="119.38" y="99.06"/>
</segment>
<segment>
<pinref part="BREAKOUT2" gate="A" pin="32"/>
<wire x1="-63.5" y1="22.86" x2="-58.42" y2="22.86" width="0.1524" layer="91"/>
<label x="-58.42" y="22.86" size="1.778" layer="95"/>
</segment>
+<segment>
+<pinref part="J10" gate="J" pin="1"/>
+<wire x1="35.56" y1="-35.56" x2="35.56" y2="-33.02" width="0.1524" layer="91"/>
+<label x="35.56" y="-35.56" size="1.778" layer="95" rot="R270"/>
+</segment>
</net>
<net name="PTD6" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTD6/LLWU_P15"/>
<wire x1="116.84" y1="96.52" x2="119.38" y2="96.52" width="0.1524" layer="91"/>
+<junction x="119.38" y="96.52"/>
</segment>
<segment>
<pinref part="BREAKOUT2" gate="A" pin="31"/>
<wire x1="-71.12" y1="22.86" x2="-76.2" y2="22.86" width="0.1524" layer="91"/>
<label x="-76.2" y="22.86" size="1.778" layer="95" rot="R180"/>
</segment>
+<segment>
+<pinref part="J8" gate="J" pin="1"/>
+<wire x1="30.48" y1="-35.56" x2="30.48" y2="-33.02" width="0.1524" layer="91"/>
+<label x="30.48" y="-35.56" size="1.778" layer="95" rot="R270"/>
+</segment>
</net>
<net name="PTD5" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTD5"/>
<wire x1="116.84" y1="93.98" x2="119.38" y2="93.98" width="0.1524" layer="91"/>
+<junction x="119.38" y="93.98"/>
</segment>
<segment>
<pinref part="BREAKOUT2" gate="A" pin="30"/>
<wire x1="-63.5" y1="25.4" x2="-58.42" y2="25.4" width="0.1524" layer="91"/>
<label x="-58.42" y="25.4" size="1.778" layer="95"/>
</segment>
+<segment>
+<pinref part="J9" gate="J" pin="1"/>
+<wire x1="33.02" y1="-35.56" x2="33.02" y2="-33.02" width="0.1524" layer="91"/>
+<label x="33.02" y="-35.56" size="1.778" layer="95" rot="R270"/>
+</segment>
</net>
<net name="PTD4" class="0">
<segment>
<pinref part="U1" gate="A" pin="PTD4/LLWU_P14"/>
<wire x1="116.84" y1="91.44" x2="119.38" y2="91.44" width="0.1524" layer="91"/>
+<junction x="119.38" y="91.44"/>
</segment>
<segment>
<pinref part="BREAKOUT2" gate="A" pin="29"/>
<wire x1="-71.12" y1="25.4" x2="-76.2" y2="25.4" width="0.1524" layer="91"/>
<label x="-76.2" y="25.4" size="1.778" layer="95" rot="R180"/>
</segment>
+<segment>
+<pinref part="J6" gate="J" pin="1"/>
+<wire x1="25.4" y1="-35.56" x2="25.4" y2="-33.02" width="0.1524" layer="91"/>
+<label x="25.4" y="-35.56" size="1.778" layer="95" rot="R270"/>
+</segment>
</net>
<net name="PTD3" class="0">
<segment>
diff --git a/laser-tag software/CMakeLists.txt b/laser-tag software/CMakeLists.txt
index f04d332..26be541 100755
--- a/laser-tag software/CMakeLists.txt
+++ b/laser-tag software/CMakeLists.txt
@@ -94,6 +94,7 @@ ADD_EXECUTABLE(hello_world
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/startup.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/startup.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/lpuart/fsl_lpuart_irq.c"
+ "${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/spi/fsl_spi_irq.c"
"${ProjDirPath}/main.c"
"${ProjDirPath}/fsl_lptmr_irq.c"
)
diff --git a/laser-tag software/main.c b/laser-tag software/main.c
index 60098c5..0001608 100755
--- a/laser-tag software/main.c
+++ b/laser-tag software/main.c
@@ -39,6 +39,7 @@
#include "fsl_os_abstraction.h"
#include "fsl_pit_driver.h"
#include "fsl_smc_hal.h"
+#include "fsl_spi_master_driver.h"
////////////////////////////
@@ -102,15 +103,23 @@ static const smc_power_mode_config_t g_idlePowerMode = {
/* LCD backlight GPIO pin */
static const gpio_output_pin_user_config_t g_lcdBacklight = {
- .pinName = GPIO_MAKE_PIN(GPIOE_IDX, 31U),
+ .pinName = GPIO_MAKE_PIN(GPIOE_IDX, 31),
.config.outputLogic = 1,
.config.slewRate = kPortSlowSlewRate,
.config.driveStrength = kPortLowDriveStrength,
};
+/* LCD A0 GPIO pin */
+static const gpio_output_pin_user_config_t g_lcdA0 = {
+ .pinName = GPIO_MAKE_PIN(GPIOD_IDX, 6),
+ .config.outputLogic = 0,
+ .config.slewRate = kPortSlowSlewRate,
+ .config.driveStrength = kPortLowDriveStrength,
+};
+
/* Switch1 GPIO pin */
static const gpio_input_pin_user_config_t g_switch1 = {
- .pinName = GPIO_MAKE_PIN(GPIOA_IDX, 1U),
+ .pinName = GPIO_MAKE_PIN(GPIOA_IDX, 1),
.config.isPullEnable = true,
.config.pullSelect = kPortPullUp,
.config.interrupt = kPortIntEitherEdge,
@@ -162,6 +171,14 @@ static lpuart_user_config_t g_lpuartConfig = {
.bitCountPerChar = kLpuart9BitsPerChar,
};
+/* LCD SPI config */
+static spi_master_user_config_t g_spi1Config = {
+ .bitsPerSec = 100000, // 100 kbps
+ .polarity = kSpiClockPolarity_ActiveLow,
+ .phase = kSpiClockPhase_SecondEdge,
+ .direction = kSpiMsbFirst,
+ .bitCount = kSpi8BitMode,
+};
///////
// Code
@@ -170,6 +187,7 @@ static cmp_state_t g_cmpState;
static dma_channel_t g_chan;
static lpuart_state_t g_lpuartState;
static uint8_t rxBuff[1];
+static spi_master_state_t g_spi1State;
/*!
* @brief LPTMR interrupt call back function.
@@ -225,8 +243,11 @@ static void lpuartRxCallback(uint32_t instance, void *lpuartState)
int main (void)
{
/* enable clock for PORTs */
- //CLOCK_SYS_EnablePortClock(PORTA_IDX);
+ CLOCK_SYS_EnablePortClock(PORTA_IDX);
+ //CLOCK_SYS_EnablePortClock(PORTB_IDX);
//CLOCK_SYS_EnablePortClock(PORTC_IDX);
+ CLOCK_SYS_EnablePortClock(PORTD_IDX);
+ CLOCK_SYS_EnablePortClock(PORTE_IDX);
/* Set allowed power mode, allow all. */
SMC_HAL_SetProtection(SMC, kAllowPowerModeAll);
@@ -240,9 +261,6 @@ int main (void)
LPTMR_DRV_SetTimerPeriodUs(LPTMR0_IDX, 100000);
LPTMR_DRV_InstallCallback(LPTMR0_IDX, lptmr_call_back);
- /* Initialize LCD backlight LED GPIO */
- GPIO_DRV_OutputPinInit(&g_lcdBacklight);
-
/* Initialize PIT */
PIT_DRV_Init(0, false);
PIT_DRV_InitChannel(0, 0, &g_pitChan0);
@@ -292,6 +310,41 @@ int main (void)
LPUART_DRV_InstallRxCallback(1, lpuartRxCallback, rxBuff, NULL, true);
PORT_HAL_SetMuxMode(g_portBase[GPIOE_IDX], 1, kPortMuxAlt3);
+ /* Setup LCD */
+ GPIO_DRV_OutputPinInit(&g_lcdBacklight);
+ GPIO_DRV_OutputPinInit(&g_lcdA0);
+ PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 4, kPortMuxAlt2); // CS
+ PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 5, kPortMuxAlt2); // SCL
+ PORT_HAL_SetMuxMode(g_portBase[GPIOD_IDX], 7, kPortMuxAlt5); // SI
+ SPI_DRV_MasterInit(1, &g_spi1State);
+ uint32_t baud;
+ SPI_DRV_MasterConfigureBus(1, &g_spi1Config, &baud);
+ uint8_t buff[] = {
+ 0x80, 0x21, // Set electronic "volume" to 33/63
+ 0x2f, // Set power control: booster on, regulator on, follower on
+ 0xaf, // Display ON
+ 0x40, // Set display line start address to 0
+ //0xa5, // all points ON
+ };
+ SPI_DRV_MasterTransferBlocking(1, NULL, buff, NULL, sizeof(buff), 1000);
+
+ // Try to write something to the display
+ int i;
+ for (i = 0; i < 4; ++i) {
+ int j;
+ uint8_t buff[] = {
+ 0xb + i, // Set page address to i
+ 0x00, 0x10 // Set column address to 0
+ };
+ GPIO_DRV_ClearPinOutput(g_lcdA0.pinName);
+ SPI_DRV_MasterTransferBlocking(1, NULL, buff, NULL, sizeof(buff), 1000);
+ GPIO_DRV_SetPinOutput(g_lcdA0.pinName);
+ for (j = 0; j < 128; ++j) {
+ uint8_t byte = 0x33;
+ SPI_DRV_MasterTransferBlocking(1, NULL, &byte, NULL, 1, 1000);
+ }
+ }
+
/* We're done, everything else is triggered through interrupts */
for(;;) {
#ifndef DEBUG