blob: 50a4bcea3b9351534576669ea440049d23ed7afc [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([
46 "pandoc",
47 "-f",
48 "markdown_github-hard_line_breaks",
49 "-t",
50 "html5",
51 "-o",
52 "$@",
53 "$<",
54 ]),
Brian Silverman8d3816a2017-07-03 18:52:15 -070055)
56
57cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070058 name = "algorithms",
59 srcs = [
60 "algorithms.cc",
61 ],
62 hdrs = [
63 "algorithms.h",
64 ],
65 compatible_with = mcu_cpus,
Brian Silverman8d3816a2017-07-03 18:52:15 -070066)
67
68cc_test(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070069 name = "algorithms_test",
70 srcs = [
71 "algorithms_test.cc",
72 ],
73 deps = [
74 ":algorithms",
75 "//aos/testing:googletest",
76 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070077)
78
79cc_library(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070080 name = "math",
81 srcs = [
82 "math.cc",
83 ],
84 hdrs = [
85 "math.h",
86 ],
87 compatible_with = mcu_cpus,
88 visibility = ["//visibility:public"],
Brian Silverman8d3816a2017-07-03 18:52:15 -070089)
90
91cc_test(
Brian Silverman54dd2fe2018-03-16 23:44:31 -070092 name = "math_test",
93 srcs = [
94 "math_test.cc",
95 ],
96 deps = [
97 ":math",
98 "//aos/testing:googletest",
99 "//third_party/googletest:googlemock",
100 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -0700101)
102
Brian Silverman259c4432018-01-15 14:34:21 -0800103cc_binary(
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700104 name = "button_board.elf",
105 srcs = [
106 "button_board.cc",
107 ],
108 restricted_to = mcu_cpus,
109 deps = [
110 ":util",
111 "//motors/core",
112 "//motors/peripheral:adc",
113 "//motors/peripheral:can",
114 "//motors/usb",
115 "//motors/usb:cdc",
116 "//motors/usb:hid",
117 ],
Brian Silverman259c4432018-01-15 14:34:21 -0800118)
119
120hex_from_elf(
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700121 name = "button_board",
122 restricted_to = mcu_cpus,
123)
124
125cc_binary(
126 name = "simple_receiver.elf",
127 srcs = [
128 "simple_receiver.cc",
129 ],
130 restricted_to = mcu_cpus,
131 deps = [
132 ":util",
133 "//motors/core",
134 "//motors/peripheral:adc",
135 "//motors/peripheral:can",
Austin Schuh4fae0fc2018-03-27 23:51:42 -0700136 "//motors/seems_reasonable:drivetrain_lib",
137 "//motors/seems_reasonable:spring",
Brian Silverman54dd2fe2018-03-16 23:44:31 -0700138 "//motors/usb",
139 "//motors/usb:cdc",
140 ],
141)
142
143hex_from_elf(
144 name = "simple_receiver",
145 restricted_to = mcu_cpus,
Brian Silverman259c4432018-01-15 14:34:21 -0800146)