Add working simple receiver test code
It makes all the motors spin back and forth, which is hilarious.
Change-Id: I150f07fbd91f71d725efa13d36f94dd2102b86d1
diff --git a/motors/BUILD b/motors/BUILD
index b11df45..3b6433d 100644
--- a/motors/BUILD
+++ b/motors/BUILD
@@ -1,159 +1,183 @@
-load('//motors:macros.bzl', 'hex_from_elf')
+load("//motors:macros.bzl", "hex_from_elf")
load("//tools:environments.bzl", "mcu_cpus")
cc_binary(
- name = 'medium_salsa.elf',
- srcs = [
- 'medium_salsa.cc',
- ],
- deps = [
- ':util',
- ':motor',
- ':motor_controls',
- '//motors/core',
- '//motors/peripheral:can',
- '//motors/peripheral:adc',
- '//motors/usb:legacy',
- ],
- restricted_to = mcu_cpus,
+ name = "medium_salsa.elf",
+ srcs = [
+ "medium_salsa.cc",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":motor",
+ ":motor_controls",
+ ":util",
+ "//motors/core",
+ "//motors/peripheral:adc",
+ "//motors/peripheral:can",
+ "//motors/usb:legacy",
+ ],
)
cc_library(
- name = 'motor',
- visibility = ['//visibility:public'],
- hdrs = [
- 'motor.h',
- ],
- srcs = [
- 'motor.cc',
- ],
- deps = [
- ':algorithms',
- ':util',
- '//motors/core',
- '//motors/peripheral:configuration',
-
- '//motors/peripheral:adc',
- '//motors/peripheral:can',
- '//motors/usb:cdc',
- ],
- restricted_to = mcu_cpus,
+ name = "motor",
+ srcs = [
+ "motor.cc",
+ ],
+ hdrs = [
+ "motor.h",
+ ],
+ restricted_to = mcu_cpus,
+ visibility = ["//visibility:public"],
+ deps = [
+ ":algorithms",
+ ":util",
+ "//motors/core",
+ "//motors/peripheral:adc",
+ "//motors/peripheral:can",
+ "//motors/peripheral:configuration",
+ "//motors/usb:cdc",
+ ],
)
hex_from_elf(
- name = 'medium_salsa',
- restricted_to = mcu_cpus,
+ name = "medium_salsa",
+ restricted_to = mcu_cpus,
)
cc_library(
- name = 'util',
- visibility = ['//visibility:public'],
- hdrs = [
- 'util.h',
- ],
- deps = [
- '//motors/core',
- ],
- restricted_to = mcu_cpus,
+ name = "util",
+ hdrs = [
+ "util.h",
+ ],
+ restricted_to = mcu_cpus,
+ visibility = ["//visibility:public"],
+ deps = [
+ "//motors/core",
+ ],
)
genrule(
- name = 'doc',
- srcs = [
- 'NOTES.md',
- ],
- outs = [
- 'NOTES.html',
- ],
- cmd = ' '.join([
- 'pandoc',
- '-f', 'markdown_github-hard_line_breaks',
- '-t', 'html5',
- '-o', '$@', '$<',
- ]),
+ name = "doc",
+ srcs = [
+ "NOTES.md",
+ ],
+ outs = [
+ "NOTES.html",
+ ],
+ cmd = " ".join([
+ "pandoc",
+ "-f",
+ "markdown_github-hard_line_breaks",
+ "-t",
+ "html5",
+ "-o",
+ "$@",
+ "$<",
+ ]),
)
cc_library(
- name = 'algorithms',
- hdrs = [
- 'algorithms.h',
- ],
- srcs = [
- 'algorithms.cc',
- ],
- compatible_with = mcu_cpus,
+ name = "algorithms",
+ srcs = [
+ "algorithms.cc",
+ ],
+ hdrs = [
+ "algorithms.h",
+ ],
+ compatible_with = mcu_cpus,
)
cc_test(
- name = 'algorithms_test',
- srcs = [
- 'algorithms_test.cc',
- ],
- deps = [
- ':algorithms',
- '//aos/testing:googletest',
- ],
+ name = "algorithms_test",
+ srcs = [
+ "algorithms_test.cc",
+ ],
+ deps = [
+ ":algorithms",
+ "//aos/testing:googletest",
+ ],
)
cc_library(
- name = 'math',
- visibility = ['//visibility:public'],
- hdrs = [
- 'math.h',
- ],
- srcs = [
- 'math.cc',
- ],
- compatible_with = mcu_cpus,
+ name = "math",
+ srcs = [
+ "math.cc",
+ ],
+ hdrs = [
+ "math.h",
+ ],
+ compatible_with = mcu_cpus,
+ visibility = ["//visibility:public"],
)
cc_test(
- name = 'math_test',
- srcs = [
- 'math_test.cc',
- ],
- deps = [
- ':math',
- '//aos/testing:googletest',
- '//third_party/googletest:googlemock',
- ],
+ name = "math_test",
+ srcs = [
+ "math_test.cc",
+ ],
+ deps = [
+ ":math",
+ "//aos/testing:googletest",
+ "//third_party/googletest:googlemock",
+ ],
)
cc_library(
- name = 'motor_controls',
- hdrs = [
- 'motor_controls.h',
- ],
- srcs = [
- 'motor_controls.cc',
- ],
- deps = [
- ':math',
- ':motor',
- '//motors/peripheral:configuration',
- '//third_party/eigen',
- ],
- restricted_to = mcu_cpus,
+ name = "motor_controls",
+ srcs = [
+ "motor_controls.cc",
+ ],
+ hdrs = [
+ "motor_controls.h",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":math",
+ ":motor",
+ "//motors/peripheral:configuration",
+ "//third_party/eigen",
+ ],
)
cc_binary(
- name = 'button_board.elf',
- srcs = [
- 'button_board.cc',
- ],
- deps = [
- ':util',
- '//motors/core',
- '//motors/peripheral:can',
- '//motors/peripheral:adc',
- '//motors/usb',
- '//motors/usb:cdc',
- '//motors/usb:hid',
- ],
- restricted_to = mcu_cpus,
+ name = "button_board.elf",
+ srcs = [
+ "button_board.cc",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":util",
+ "//motors/core",
+ "//motors/peripheral:adc",
+ "//motors/peripheral:can",
+ "//motors/usb",
+ "//motors/usb:cdc",
+ "//motors/usb:hid",
+ ],
)
hex_from_elf(
- name = 'button_board',
- restricted_to = mcu_cpus,
+ name = "button_board",
+ restricted_to = mcu_cpus,
+)
+
+cc_binary(
+ name = "simple_receiver.elf",
+ srcs = [
+ "simple_receiver.cc",
+ ],
+ restricted_to = mcu_cpus,
+ deps = [
+ ":util",
+ "//motors/core",
+ "//motors/peripheral:adc",
+ "//motors/peripheral:can",
+ "//motors/usb",
+ "//motors/usb:cdc",
+ ],
+)
+
+hex_from_elf(
+ name = "simple_receiver",
+ restricted_to = mcu_cpus,
)