Created WPILibRobotBase
To not depend on WPILib interfaces and make version changes easier
Change-Id: I90abb34c50798dd166bf7eadf359de5f635f6d82
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index c07b7f8..caada86 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -172,3 +172,13 @@
'//aos/common/logging:queue_logging',
],
)
+
+cc_library(
+ name = 'wpilib_robot_base',
+ hdrs = [
+ 'wpilib_robot_base.h',
+ ],
+ deps = [
+ '//aos/externals:wpilib',
+ ],
+)
diff --git a/frc971/wpilib/wpilib_robot_base.h b/frc971/wpilib/wpilib_robot_base.h
new file mode 100644
index 0000000..231a21a
--- /dev/null
+++ b/frc971/wpilib/wpilib_robot_base.h
@@ -0,0 +1,30 @@
+#ifndef FRC971_WPILIB_NEWROBOTBASE_H_
+#define FRC971_WPILIB_NEWROBOTBASE_H_
+
+#include "RobotBase.h"
+
+namespace frc971 {
+namespace wpilib {
+
+class WPILibRobotBase {
+public:
+ virtual void Run() = 0;
+};
+
+#define AOS_ROBOT_CLASS(_ClassName_) \
+ START_ROBOT_CLASS(::frc971::wpilib::WPILibAdapterRobot<_ClassName_>)
+
+template <typename T>
+class WPILibAdapterRobot : public RobotBase {
+ public:
+ void StartCompetition() override { robot_.Run(); }
+
+ private:
+ T robot_;
+};
+
+}
+}
+
+#endif // FRC971_WPILIB_NEWROBOTBASE_H_
+