blob: d00404ef71f3adf1c5b9d50673d698ecaa051ec3 [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 Schuhb402fd42019-04-13 00:02:53 -070031 "controller_adc.cc",
32 "controller_adc.h",
Austin Schuh745e4ed2019-04-07 15:50:16 -070033 "vtable_trigger0.cc",
34 "vtable_trigger1.cc",
35 "vtable_wheel0.cc",
36 "vtable_wheel1.cc",
Brian Silvermandabdf902017-10-21 15:34:40 -040037 ],
38 restricted_to = mcu_cpus,
39 deps = [
40 ":motor_controls",
41 "//frc971/control_loops/drivetrain:haptic_input_uc",
42 "//motors:motor",
43 "//motors:util",
44 "//motors/core",
45 "//motors/peripheral:adc",
46 "//motors/peripheral:can",
Brian Silverman4787a6e2018-10-06 16:00:54 -070047 "//motors/print:usb",
Brian Silvermandabdf902017-10-21 15:34:40 -040048 ],
Brian Silverman6260c092018-01-14 15:21:36 -080049)
50
51hex_from_elf(
Brian Silvermandabdf902017-10-21 15:34:40 -040052 name = "controller",
53 restricted_to = mcu_cpus,
Brian Silverman6260c092018-01-14 15:21:36 -080054)
55
56cc_binary(
Brian Silvermandabdf902017-10-21 15:34:40 -040057 name = "usb_forward_linux",
58 srcs = [
59 "usb_forward.cc",
60 ],
61 restricted_to = ["//tools:k8"],
62 deps = [
63 # Don't add anything else here. :usb_forward_windows still has to build it
64 # without any other dependencies.
Brian Silverman4f6ba442018-08-05 14:34:58 -070065 "@libusb//:libusb_1_0",
Brian Silvermandabdf902017-10-21 15:34:40 -040066 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080067)
68
69genrule(
Brian Silvermandabdf902017-10-21 15:34:40 -040070 name = "usb_forward_windows",
71 srcs = [
72 "usb_forward.cc",
73 "@libusb_1_0_windows//file",
74 ],
75 outs = [
76 "usb_forward.exe",
77 ],
78 cmd = " ".join([
79 "$(location usb_forward_windows_build.sh)",
80 "$(location usb_forward.cc)",
81 "$(location @libusb_1_0_windows//file)",
82 "$@",
83 ]),
84 output_to_bindir = True,
85 tools = [
86 "usb_forward_windows_build.sh",
Brian Silvermanb80dc9f2018-08-05 14:59:24 -070087 "@mingw_compiler//:all_files",
Brian Silvermandabdf902017-10-21 15:34:40 -040088 ],
Brian Silverman4aa83042018-01-05 12:47:31 -080089)
Brian Silverman6260c092018-01-14 15:21:36 -080090
91cc_library(
Brian Silvermandabdf902017-10-21 15:34:40 -040092 name = "motor_controls",
93 srcs = [
94 "motor_controls.cc",
95 ],
96 hdrs = [
97 "motor_controls.h",
98 ],
99 restricted_to = mcu_cpus,
100 visibility = ["//visibility:public"],
101 deps = [
102 "//motors:math",
103 "//motors:motor",
104 "//motors/peripheral:configuration",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700105 "@org_tuxfamily_eigen//:eigen",
Brian Silvermandabdf902017-10-21 15:34:40 -0400106 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800107)