Added ahal
This is a formatted copy of WPILib's default user-visible C++ API, with
a bit of completely unnecessary functionality stripped out. Most of the
stripping so far is only related to weird threading decisions.
Change-Id: Icbfd949b48cd115561862cb909bcc572aba0e753
diff --git a/frc971/wpilib/ADIS16448.cc b/frc971/wpilib/ADIS16448.cc
index 3696e2f..6c4a6d1 100644
--- a/frc971/wpilib/ADIS16448.cc
+++ b/frc971/wpilib/ADIS16448.cc
@@ -1,6 +1,6 @@
#include "frc971/wpilib/ADIS16448.h"
-#include "InterruptableSensorBase.h"
+#include "frc971/wpilib/ahal/InterruptableSensorBase.h"
#undef ERROR
#include <inttypes.h>
@@ -118,8 +118,8 @@
} // namespace
-ADIS16448::ADIS16448(SPI::Port port, DigitalInput *dio1)
- : spi_(new SPI(port)), dio1_(dio1) {
+ADIS16448::ADIS16448(frc::SPI::Port port, frc::DigitalInput *dio1)
+ : spi_(new frc::SPI(port)), dio1_(dio1) {
// 1MHz is the maximum supported for burst reads, but we
// want to go slower to hopefully make it more reliable.
spi_->SetClockRate(1e5);
@@ -132,8 +132,8 @@
dio1_->SetUpSourceEdge(true, false);
}
-void ADIS16448::SetDummySPI(SPI::Port port) {
- dummy_spi_.reset(new SPI(port));
+void ADIS16448::SetDummySPI(frc::SPI::Port port) {
+ dummy_spi_.reset(new frc::SPI(port));
// Pick the same settings here in case the roboRIO decides to try something
// stupid when switching.
if (dummy_spi_) {
@@ -168,8 +168,8 @@
void ADIS16448::operator()() {
// NI's SPI driver defaults to SCHED_OTHER. Find it's PID with ps, and change
// it to a RT priority of 33.
- PCHECK(system(
- "ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
+ PCHECK(
+ system("ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
"33") == 0);
::aos::SetCurrentThreadName("IMU");
@@ -186,9 +186,9 @@
bool got_an_interrupt = false;
while (run_) {
{
- const InterruptableSensorBase::WaitResult result =
+ const frc::InterruptableSensorBase::WaitResult result =
dio1_->WaitForInterrupt(0.1, !got_an_interrupt);
- if (result == InterruptableSensorBase::kTimeout) {
+ if (result == frc::InterruptableSensorBase::kTimeout) {
LOG(WARNING, "IMU read timed out\n");
InitializeUntilSuccessful();
continue;
@@ -209,7 +209,7 @@
// scenario.
if (!dio1_->Get() ||
dio1_->WaitForInterrupt(0, false) !=
- InterruptableSensorBase::kTimeout) {
+ frc::InterruptableSensorBase::kTimeout) {
LOG(ERROR, "IMU read took too long\n");
continue;
}