started working on code that verifies the PWM outputs are going
diff --git a/bbb_cape/src/cape/digital.h b/bbb_cape/src/cape/digital.h
index 698aeed..2f227a5 100644
--- a/bbb_cape/src/cape/digital.h
+++ b/bbb_cape/src/cape/digital.h
@@ -7,6 +7,8 @@
// For all of the digital functions, a high voltage level on the input reads as
// 1 (and a low to high transition is a positive edge).
+// Encoder inputs 0-7 A and B are mapped to "digital inputs" 12-27 (12 is 0A,
+13 is B, 14 is 1A, etc).
static inline int digital_read(int num) {
switch (num) {
@@ -34,6 +36,38 @@
return !(GPIOA->IDR & (1 << 7));
case 11:
return !(GPIOB->IDR & (1 << 2));
+ case 12: // encoder 0
+ return !(GPIOC->IDR & (1 << 6));
+ case 13:
+ return !(GPIOC->IDR & (1 << 7));
+ case 14: // encoder 1
+ return !(GPIOC->IDR & (1 << 0));
+ case 15:
+ return !(GPIOC->IDR & (1 << 1));
+ case 16: // encoder 2
+ return !(GPIOA->IDR & (1 << 0));
+ case 17:
+ return !(GPIOA->IDR & (1 << 1));
+ case 18: // encoder 3
+ return !(GPIOA->IDR & (1 << 2));
+ case 19:
+ return !(GPIOA->IDR & (1 << 3));
+ case 20: // encoder 4
+ return !(GPIOA->IDR & (1 << 8));
+ case 21:
+ return !(GPIOB->IDR & (1 << 0));
+ case 22: // encoder 5
+ return !(GPIOA->IDR & (1 << 5));
+ case 23:
+ return !(GPIOB->IDR & (1 << 3));
+ case 24: // encoder 6
+ return !(GPIOA->IDR & (1 << 6));
+ case 25:
+ return !(GPIOB->IDR & (1 << 5));
+ case 26: // encoder 7
+ return !(GPIOB->IDR & (1 << 6));
+ case 27:
+ return !(GPIOB->IDR & (1 << 7));
default:
return 0;
}
diff --git a/frc971/output/motor_writer.cc b/frc971/output/motor_writer.cc
index dca221b..d42cc05 100644
--- a/frc971/output/motor_writer.cc
+++ b/frc971/output/motor_writer.cc
@@ -93,6 +93,12 @@
}
claw_old_.Print();
}
+
+ ++output_check_;
+ if (output_check_ == 0) output_check_ = 1;
+ ::frc971::output_check_queue.MakeWithBuilder()
+ .pwm_value(output_check_).Send();
+ SetPWMOutput(10, output_check_);
}
SimpleLogInterval drivetrain_old_ =
@@ -101,6 +107,8 @@
SimpleLogInterval(kOldLogInterval, WARNING, "shooter too old");
SimpleLogInterval claw_old_ =
SimpleLogInterval(kOldLogInterval, WARNING, "claw too old");
+
+ uint8_t output_check_ = 0;
};
constexpr ::aos::time::Time MotorWriter::kOldLogInterval;