blob: 5bdda2549a501a49589f0d23cea8a8d0151464aa [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",
Brian Silverman4787a6e2018-10-06 16:00:54 -070014 "//motors/print:usb",
Brian Silvermandabdf902017-10-21 15:34:40 -040015 "//motors/usb",
16 "//motors/usb:cdc",
17 "//motors/usb:hid",
18 "//motors/usb:interrupt_out",
19 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -040020)
21
22hex_from_elf(
Brian Silvermandabdf902017-10-21 15:34:40 -040023 name = "drivers_station",
24 restricted_to = mcu_cpus,
Brian Silvermanf91524f2017-09-23 13:15:55 -040025)
Brian Silverman4aa83042018-01-05 12:47:31 -080026
27cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -040028 name = "controller.elf",
29 srcs = [
30 "controller.cc",
Austin Schuh745e4ed2019-04-07 15:50:16 -070031 "vtable_trigger0.cc",
32 "vtable_trigger1.cc",
33 "vtable_wheel0.cc",
34 "vtable_wheel1.cc",
Brian Silvermandabdf902017-10-21 15:34:40 -040035 ],
36 restricted_to = mcu_cpus,
37 deps = [
38 ":motor_controls",
39 "//frc971/control_loops/drivetrain:haptic_input_uc",
40 "//motors:motor",
41 "//motors:util",
42 "//motors/core",
43 "//motors/peripheral:adc",
44 "//motors/peripheral:can",
Brian Silverman4787a6e2018-10-06 16:00:54 -070045 "//motors/print:usb",
Brian Silvermandabdf902017-10-21 15:34:40 -040046 ],
Brian Silverman6260c092018-01-14 15:21:36 -080047)
48
49hex_from_elf(
Brian Silvermandabdf902017-10-21 15:34:40 -040050 name = "controller",
51 restricted_to = mcu_cpus,
Brian Silverman6260c092018-01-14 15:21:36 -080052)
53
54cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -040055 name = "usb_forward_linux",
56 srcs = [
57 "usb_forward.cc",
58 ],
59 restricted_to = ["//tools:k8"],
60 deps = [
61 # Don't add anything else here. :usb_forward_windows still has to build it
62 # without any other dependencies.
Brian Silverman4f6ba442018-08-05 14:34:58 -070063 "@libusb//:libusb_1_0",
Brian Silvermandabdf902017-10-21 15:34:40 -040064 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080065)
66
67genrule(
Brian Silvermandabdf902017-10-21 15:34:40 -040068 name = "usb_forward_windows",
69 srcs = [
70 "usb_forward.cc",
71 "@libusb_1_0_windows//file",
72 ],
73 outs = [
74 "usb_forward.exe",
75 ],
76 cmd = " ".join([
77 "$(location usb_forward_windows_build.sh)",
78 "$(location usb_forward.cc)",
79 "$(location @libusb_1_0_windows//file)",
80 "$@",
81 ]),
82 output_to_bindir = True,
83 tools = [
84 "usb_forward_windows_build.sh",
Brian Silvermanb80dc9f2018-08-05 14:59:24 -070085 "@mingw_compiler//:all_files",
Brian Silvermandabdf902017-10-21 15:34:40 -040086 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080087)
Brian Silverman6260c092018-01-14 15:21:36 -080088
89cc_library(
Brian Silvermandabdf902017-10-21 15:34:40 -040090 name = "motor_controls",
91 srcs = [
92 "motor_controls.cc",
93 ],
94 hdrs = [
95 "motor_controls.h",
96 ],
97 restricted_to = mcu_cpus,
98 visibility = ["//visibility:public"],
99 deps = [
100 "//motors:math",
101 "//motors:motor",
102 "//motors/peripheral:configuration",
103 "//third_party/eigen",
104 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800105)