blob: 75cab98acd1a949d1b78781fd683b2f303796c4a [file] [log] [blame]
Brian Silvermandabdf902017-10-21 15:34:40 -04001load("//motors:macros.bzl", "hex_from_elf")
Brian Silvermanf91524f2017-09-23 13:15:55 -04002load("//tools:environments.bzl", "mcu_cpus")
3
4cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -04005 name = "drivers_station.elf",
6 srcs = [
7 "drivers_station.cc",
8 ],
9 restricted_to = mcu_cpus,
10 deps = [
11 "//motors:util",
12 "//motors/core",
13 "//motors/peripheral:can",
14 "//motors/usb",
15 "//motors/usb:cdc",
16 "//motors/usb:hid",
17 "//motors/usb:interrupt_out",
18 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -040019)
20
21hex_from_elf(
Brian Silvermandabdf902017-10-21 15:34:40 -040022 name = "drivers_station",
23 restricted_to = mcu_cpus,
Brian Silvermanf91524f2017-09-23 13:15:55 -040024)
Brian Silverman4aa83042018-01-05 12:47:31 -080025
26cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -040027 name = "controller.elf",
28 srcs = [
29 "controller.cc",
30 "vtable_trigger.cc",
31 "vtable_wheel.cc",
32 ],
33 restricted_to = mcu_cpus,
34 deps = [
35 ":motor_controls",
36 "//frc971/control_loops/drivetrain:haptic_input_uc",
37 "//motors:motor",
38 "//motors:util",
39 "//motors/core",
40 "//motors/peripheral:adc",
41 "//motors/peripheral:can",
42 "//motors/usb",
43 "//motors/usb:cdc",
44 ],
Brian Silverman6260c092018-01-14 15:21:36 -080045)
46
47hex_from_elf(
Brian Silvermandabdf902017-10-21 15:34:40 -040048 name = "controller",
49 restricted_to = mcu_cpus,
Brian Silverman6260c092018-01-14 15:21:36 -080050)
51
52cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -040053 name = "usb_forward_linux",
54 srcs = [
55 "usb_forward.cc",
56 ],
57 restricted_to = ["//tools:k8"],
58 deps = [
59 # Don't add anything else here. :usb_forward_windows still has to build it
60 # without any other dependencies.
Brian Silverman4f6ba442018-08-05 14:34:58 -070061 "@libusb//:libusb_1_0",
Brian Silvermandabdf902017-10-21 15:34:40 -040062 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080063)
64
65genrule(
Brian Silvermandabdf902017-10-21 15:34:40 -040066 name = "usb_forward_windows",
67 srcs = [
68 "usb_forward.cc",
69 "@libusb_1_0_windows//file",
70 ],
71 outs = [
72 "usb_forward.exe",
73 ],
74 cmd = " ".join([
75 "$(location usb_forward_windows_build.sh)",
76 "$(location usb_forward.cc)",
77 "$(location @libusb_1_0_windows//file)",
78 "$@",
79 ]),
80 output_to_bindir = True,
81 tools = [
82 "usb_forward_windows_build.sh",
Brian Silvermanb80dc9f2018-08-05 14:59:24 -070083 "@mingw_compiler//:all_files",
Brian Silvermandabdf902017-10-21 15:34:40 -040084 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080085)
Brian Silverman6260c092018-01-14 15:21:36 -080086
87cc_library(
Brian Silvermandabdf902017-10-21 15:34:40 -040088 name = "motor_controls",
89 srcs = [
90 "motor_controls.cc",
91 ],
92 hdrs = [
93 "motor_controls.h",
94 ],
95 restricted_to = mcu_cpus,
96 visibility = ["//visibility:public"],
97 deps = [
98 "//motors:math",
99 "//motors:motor",
100 "//motors/peripheral:configuration",
101 "//third_party/eigen",
102 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800103)