Make all the serialization code build for the Teensy too
Change-Id: Ib3442220581553d78bb30e42818203959d987d85
diff --git a/y2019/jevois/BUILD b/y2019/jevois/BUILD
index 9304e8e..97a1d61 100644
--- a/y2019/jevois/BUILD
+++ b/y2019/jevois/BUILD
@@ -37,6 +37,7 @@
"--output=$(location jevois_crc.c)",
]),
]),
+ compatible_with = mcu_cpus,
tools = [
"//third_party/pycrc:pycrc_main",
],
@@ -50,6 +51,7 @@
hdrs = [
"jevois_crc.h",
],
+ compatible_with = mcu_cpus,
deps = [
"//third_party/GSL",
],
@@ -69,6 +71,19 @@
)
cc_library(
+ name = "structures_mcu",
+ hdrs = [
+ "structures.h",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ "//aos/containers:sized_array",
+ "//aos/time:time_mcu",
+ "//third_party/eigen",
+ ],
+)
+
+cc_library(
name = "spi",
srcs = [
"spi.cc",
@@ -88,6 +103,24 @@
)
cc_library(
+ name = "spi_mcu",
+ srcs = [
+ "spi.cc",
+ ],
+ hdrs = [
+ "spi.h",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":jevois_crc",
+ ":structures_mcu",
+ "//aos/util:bitpacking",
+ "//third_party/GSL",
+ "//third_party/optional",
+ ],
+)
+
+cc_library(
name = "uart",
srcs = [
"uart.cc",
@@ -108,6 +141,26 @@
],
)
+cc_library(
+ name = "uart_mcu",
+ srcs = [
+ "uart.cc",
+ ],
+ hdrs = [
+ "uart.h",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":cobs_mcu",
+ ":jevois_crc",
+ ":structures_mcu",
+ "//aos/containers:sized_array",
+ "//aos/util:bitpacking",
+ "//third_party/GSL",
+ "//third_party/optional",
+ ],
+)
+
cc_test(
name = "uart_test",
srcs = [
@@ -141,6 +194,17 @@
],
)
+cc_library(
+ name = "cobs_mcu",
+ hdrs = [
+ "cobs.h",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ "//third_party/GSL",
+ ],
+)
+
cc_test(
name = "cobs_test",
srcs = [
diff --git a/y2019/jevois/cobs.h b/y2019/jevois/cobs.h
index 22590d9..112873d 100644
--- a/y2019/jevois/cobs.h
+++ b/y2019/jevois/cobs.h
@@ -6,8 +6,13 @@
#include <algorithm>
#include <array>
-#include "aos/logging/logging.h"
#include "third_party/GSL/include/gsl/gsl"
+#ifdef __linux__
+#include "aos/logging/logging.h"
+#else
+#define CHECK(...)
+#define CHECK_LE(...)
+#endif
// This file contains code for encoding and decoding Consistent Overhead Byte
// Stuffing data. <http://www.stuartcheshire.org/papers/cobsforton.pdf> has
diff --git a/y2019/jevois/spi.cc b/y2019/jevois/spi.cc
index 28df8cf..abc1780 100644
--- a/y2019/jevois/spi.cc
+++ b/y2019/jevois/spi.cc
@@ -1,9 +1,14 @@
#include "y2019/jevois/spi.h"
-#include "aos/logging/logging.h"
#include "aos/util/bitpacking.h"
#include "third_party/GSL/include/gsl/gsl"
#include "y2019/jevois/jevois_crc.h"
+#ifdef __linux__
+#include "aos/logging/logging.h"
+#else
+#define CHECK(...)
+#define CHECK_GE(...)
+#endif
// SPI transfer format (6x 8 bit frames):
// 1. 1-byte brightness for each beacon channel.
diff --git a/y2019/jevois/structures.h b/y2019/jevois/structures.h
index fcc268e..28da405 100644
--- a/y2019/jevois/structures.h
+++ b/y2019/jevois/structures.h
@@ -11,6 +11,7 @@
#include "aos/containers/sized_array.h"
#include "aos/time/time.h"
+#include "third_party/GSL/include/gsl/gsl"
namespace frc971 {
namespace jevois {
diff --git a/y2019/jevois/uart.cc b/y2019/jevois/uart.cc
index 0db59a5..3621da8 100644
--- a/y2019/jevois/uart.cc
+++ b/y2019/jevois/uart.cc
@@ -2,10 +2,15 @@
#include <array>
-#include "aos/logging/logging.h"
#include "aos/util/bitpacking.h"
#include "third_party/GSL/include/gsl/gsl"
#include "y2019/jevois/jevois_crc.h"
+#ifdef __linux__
+#include "aos/logging/logging.h"
+#else
+#define CHECK(...)
+#define CHECK_GE(...)
+#endif
namespace frc971 {
namespace jevois {
@@ -50,8 +55,7 @@
return result;
}
-tl::optional<Frame> UartUnpackToTeensy(
- gsl::span<const char> encoded_buffer) {
+tl::optional<Frame> UartUnpackToTeensy(gsl::span<const char> encoded_buffer) {
std::array<char, uart_to_teensy_size()> buffer;
if (static_cast<size_t>(
CobsDecode<uart_to_teensy_size()>(encoded_buffer, &buffer).size()) !=
diff --git a/y2019/jevois/uart.h b/y2019/jevois/uart.h
index 87dcc97..2a4acec 100644
--- a/y2019/jevois/uart.h
+++ b/y2019/jevois/uart.h
@@ -2,6 +2,7 @@
#define Y2019_JEVOIS_UART_H_
#include "aos/containers/sized_array.h"
+#include "third_party/GSL/include/gsl/gsl"
#include "third_party/optional/tl/optional.hpp"
#include "y2019/jevois/cobs.h"
#include "y2019/jevois/structures.h"