blob: 395765e44082acabe192a91a5a5c065eaf3703eb [file] [log] [blame]
Brian Silverman54dd2fe2018-03-16 23:44:31 -07001load("//motors:macros.bzl", "hex_from_elf")
Brian Silvermanf91524f2017-09-23 13:15:55 -04002load("//tools:environments.bzl", "mcu_cpus")
3
Brian Silverman8d3816a2017-07-03 18:52:15 -07004cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -07005 name = "motor",
6 srcs = [
7 "motor.cc",
8 ],
9 hdrs = [
10 "motor.h",
11 ],
12 restricted_to = mcu_cpus,
13 visibility = ["//visibility:public"],
14 deps = [
15 ":algorithms",
16 ":util",
17 "//motors/core",
18 "//motors/peripheral:adc",
19 "//motors/peripheral:can",
20 "//motors/peripheral:configuration",
21 "//motors/usb:cdc",
22 ],
Brian Silverman8b638692017-06-26 23:10:26 -070023)
24
Brian Silverman8b638692017-06-26 23:10:26 -070025cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070026 name = "util",
27 hdrs = [
28 "util.h",
29 ],
30 restricted_to = mcu_cpus,
31 visibility = ["//visibility:public"],
32 deps = [
33 "//motors/core",
34 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070035)
36
37genrule(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070038 name = "doc",
39 srcs = [
40 "NOTES.md",
41 ],
42 outs = [
43 "NOTES.html",
44 ],
45 cmd = " ".join([
Brian Silverman7297c0c2018-08-05 13:43:00 -070046 "$(location @pandoc)",
Brian Silverman54dd2fe2018-03-16 23:44:31 -070047 "-f",
48 "markdown_github-hard_line_breaks",
49 "-t",
50 "html5",
51 "-o",
52 "$@",
53 "$<",
54 ]),
Brian Silverman7297c0c2018-08-05 13:43:00 -070055 tools = [
56 "@pandoc",
57 "@pandoc//:all_files",
58 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070059)
60
61cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070062 name = "algorithms",
63 srcs = [
64 "algorithms.cc",
65 ],
66 hdrs = [
67 "algorithms.h",
68 ],
69 compatible_with = mcu_cpus,
Brian Silverman8d3816a2017-07-03 18:52:15 -070070)
71
72cc_test(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070073 name = "algorithms_test",
74 srcs = [
75 "algorithms_test.cc",
76 ],
77 deps = [
78 ":algorithms",
79 "//aos/testing:googletest",
80 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070081)
82
83cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070084 name = "math",
85 srcs = [
86 "math.cc",
87 ],
88 hdrs = [
89 "math.h",
90 ],
91 compatible_with = mcu_cpus,
92 visibility = ["//visibility:public"],
Brian Silverman8d3816a2017-07-03 18:52:15 -070093)
94
95cc_test(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070096 name = "math_test",
97 srcs = [
98 "math_test.cc",
99 ],
100 deps = [
101 ":math",
102 "//aos/testing:googletest",
103 "//third_party/googletest:googlemock",
104 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -0700105)
106
Brian Silverman259c4432018-01-15 14:34:21 -0800107cc_binary(
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700108 name = "button_board.elf",
109 srcs = [
110 "button_board.cc",
111 ],
112 restricted_to = mcu_cpus,
113 deps = [
114 ":util",
115 "//motors/core",
116 "//motors/peripheral:adc",
117 "//motors/peripheral:can",
118 "//motors/usb",
119 "//motors/usb:cdc",
120 "//motors/usb:hid",
121 ],
Brian Silverman259c4432018-01-15 14:34:21 -0800122)
123
124hex_from_elf(
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700125 name = "button_board",
126 restricted_to = mcu_cpus,
127)
128
129cc_binary(
130 name = "simple_receiver.elf",
131 srcs = [
132 "simple_receiver.cc",
133 ],
134 restricted_to = mcu_cpus,
135 deps = [
136 ":util",
137 "//motors/core",
138 "//motors/peripheral:adc",
139 "//motors/peripheral:can",
Austin Schuh4fae0fc2018-03-27 23:51:42 -0700140 "//motors/seems_reasonable:drivetrain_lib",
141 "//motors/seems_reasonable:spring",
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700142 "//motors/usb",
143 "//motors/usb:cdc",
144 ],
145)
146
147hex_from_elf(
148 name = "simple_receiver",
149 restricted_to = mcu_cpus,
Brian Silverman259c4432018-01-15 14:34:21 -0800150)