Merge "Implement PWM receiving"
diff --git a/motors/packages/B05B-PASK-dual.fp b/motors/packages/B05B-PASK-dual.fp
new file mode 100644
index 0000000..bd226f9
--- /dev/null
+++ b/motors/packages/B05B-PASK-dual.fp
@@ -0,0 +1,21 @@
+# This is the footprint at http://www.jst-mfg.com/product/pdf/eng/ePA-F.pdf.
+Element[0x0 "" "" "" 0 0 0 0 0 100 0x0]
+(
+ # The main pins.
+ Pin[-15748 0 4795 2000 6395 2795 "5" "5" ""]
+ Pin[-7874 0 4795 2000 6395 2795 "4" "4" ""]
+ Pin[0 0 4795 2000 6395 2795 "3" "3" ""]
+ Pin[7874 0 4795 2000 6395 2795 "2" "2" ""]
+ Pin[15748 0 4795 2000 6395 2795 "1" "1" ""]
+
+ # The alignment posts.
+ Pin[21654 -6693 5970 1600 7570 4370 "" "" ""]
+ Pin[21654 6693 5970 1600 7570 4370 "" "" ""]
+
+ ElementLine[17622 -9578 -24622 -9578 800]
+ ElementLine[24622 -2578 24622 2578 800]
+ ElementLine[-24622 -9578 -24622 13957 800]
+ ElementLine[24622 13957 -24622 13957 800]
+ ElementLine[4622 11957 -4622 11957 800]
+ ElementLine[24622 -13957 -24622 -13957 800]
+)
diff --git a/motors/pistol_grip/controller.cc b/motors/pistol_grip/controller.cc
index 9f38eb8..162ac2f 100644
--- a/motors/pistol_grip/controller.cc
+++ b/motors/pistol_grip/controller.cc
@@ -689,8 +689,10 @@
global_motor1.store(&motor1, ::std::memory_order_relaxed);
SIM_SCGC6 |= SIM_SCGC6_PIT;
+ // Workaround for errata e7914.
+ (void)PIT_MCR;
PIT_MCR = 0;
- PIT_LDVAL3 = BUS_CLOCK_FREQUENCY / 1000;
+ PIT_LDVAL3 = (BUS_CLOCK_FREQUENCY / 1000) - 1;
PIT_TCTRL3 = PIT_TCTRL_TIE | PIT_TCTRL_TEN;
// Have them both wait for the GTB signal.