blob: 1256d7fa0ab2694f07bb696d4dce1a3a53205cc0 [file] [log] [blame]
Brian Silverman003a4732018-03-11 14:02:15 -07001package(default_visibility = ["//visibility:public"])
Brian Silverman100534c2015-09-07 15:51:23 -04002
Alex Perrycb7da4b2019-08-28 19:35:56 -07003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Austin Schuh00be38c2019-12-01 18:08:25 -08004load("//aos:config.bzl", "aos_config")
Brian Silverman100534c2015-09-07 15:51:23 -04005
Alex Perrycb7da4b2019-08-28 19:35:56 -07006flatbuffer_cc_library(
7 name = "logging_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -07008 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -07009 "logging.fbs",
Brian Silverman003a4732018-03-11 14:02:15 -070010 ],
Austin Schuhed5b26d2019-12-05 20:51:59 -080011 gen_reflections = 1,
Brian Silverman100534c2015-09-07 15:51:23 -040012)
13
14cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070015 name = "encoder_and_potentiometer",
16 srcs = [
17 "encoder_and_potentiometer.cc",
18 ],
19 hdrs = [
20 "encoder_and_potentiometer.h",
21 ],
22 restricted_to = ["//tools:roborio"],
23 deps = [
24 ":dma",
25 ":dma_edge_counting",
John Park398c74a2018-10-20 21:17:39 -070026 "//aos:init",
Austin Schuh45a549f2019-02-02 15:43:56 -080027 "//aos/logging",
28 "//aos/mutex",
Brian Silverman003a4732018-03-11 14:02:15 -070029 "//third_party:wpilib",
30 ],
Brian Silverman100534c2015-09-07 15:51:23 -040031)
32
33cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070034 name = "dma_edge_counting",
35 srcs = [
36 "dma_edge_counting.cc",
37 ],
38 hdrs = [
39 "dma_edge_counting.h",
40 ],
41 restricted_to = ["//tools:roborio"],
42 deps = [
43 ":dma",
John Park33858a32018-09-28 23:05:48 -070044 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -070045 "//third_party:wpilib",
46 ],
Brian Silverman100534c2015-09-07 15:51:23 -040047)
48
49cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070050 name = "interrupt_edge_counting",
51 srcs = [
52 "interrupt_edge_counting.cc",
53 ],
54 hdrs = [
55 "interrupt_edge_counting.h",
56 ],
57 restricted_to = ["//tools:roborio"],
58 deps = [
John Park398c74a2018-10-20 21:17:39 -070059 "//aos:init",
Austin Schuh45a549f2019-02-02 15:43:56 -080060 "//aos/logging",
61 "//aos/stl_mutex",
62 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -070063 "//third_party:wpilib",
64 ],
Brian Silverman100534c2015-09-07 15:51:23 -040065)
66
67cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070068 name = "buffered_pcm",
69 srcs = [
70 "buffered_pcm.cc",
71 "buffered_solenoid.cc",
72 ],
73 hdrs = [
74 "buffered_pcm.h",
75 "buffered_solenoid.h",
76 ],
77 restricted_to = ["//tools:roborio"],
78 deps = [
John Park33858a32018-09-28 23:05:48 -070079 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -070080 "//third_party:wpilib",
81 ],
Brian Silverman100534c2015-09-07 15:51:23 -040082)
83
84cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070085 name = "gyro_interface",
86 srcs = [
87 "gyro_interface.cc",
88 ],
89 hdrs = [
90 "gyro_interface.h",
91 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080092 # This library uses some deprecated parts of the SPI API.
93 copts = ["-Wno-deprecated-declarations"],
Brian Silverman003a4732018-03-11 14:02:15 -070094 restricted_to = ["//tools:roborio"],
95 deps = [
John Park33858a32018-09-28 23:05:48 -070096 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -080097 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -070098 "//third_party:wpilib",
99 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400100)
101
102cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700103 name = "gyro_sender",
104 srcs = [
105 "gyro_sender.cc",
106 ],
107 hdrs = [
108 "gyro_sender.h",
109 ],
110 restricted_to = ["//tools:roborio"],
111 deps = [
112 ":gyro_interface",
Austin Schuh45a549f2019-02-02 15:43:56 -0800113 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700114 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800115 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700116 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700117 "//aos/robot_state:robot_state_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800118 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700119 "//aos/util:phased_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800120 "//frc971/queues:gyro_fbs",
121 "//frc971/queues:gyro_uid_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700122 "//frc971/zeroing:averager",
123 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400124)
125
Alex Perrycb7da4b2019-08-28 19:35:56 -0700126flatbuffer_cc_library(
127 name = "loop_output_handler_test_fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700128 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700129 "loop_output_handler_test.fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700130 ],
Austin Schuh00be38c2019-12-01 18:08:25 -0800131 gen_reflections = 1,
132)
133
134aos_config(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800135 name = "config",
136 src = "wpilib_config.json",
137 flatbuffers = [
138 ":pdp_values_fbs",
139 ":logging_fbs",
140 ],
141)
142
143aos_config(
Austin Schuh00be38c2019-12-01 18:08:25 -0800144 name = "loop_output_handler_test_config",
145 src = "loop_output_handler_test_config_source.json",
146 flatbuffers = [
147 ":loop_output_handler_test_fbs",
148 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800149 deps = [
150 "//aos/events:config",
151 ],
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700152)
153
Brian Silverman100534c2015-09-07 15:51:23 -0400154cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700155 name = "loop_output_handler",
156 srcs = [
157 "loop_output_handler.cc",
158 ],
159 hdrs = [
160 "loop_output_handler.h",
161 ],
162 deps = [
John Park398c74a2018-10-20 21:17:39 -0700163 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700164 "//aos/events:event_loop",
165 "//aos/robot_state:robot_state_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800166 "//aos/scoped:scoped_fd",
167 "//aos/time",
168 "//aos/util:log_interval",
Brian Silverman003a4732018-03-11 14:02:15 -0700169 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400170)
171
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700172cc_test(
173 name = "loop_output_handler_test",
174 srcs = [
175 "loop_output_handler_test.cc",
176 ],
Austin Schuh00be38c2019-12-01 18:08:25 -0800177 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700178 ":loop_output_handler_test_config",
Austin Schuh00be38c2019-12-01 18:08:25 -0800179 ],
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700180 deps = [
181 ":loop_output_handler",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700182 ":loop_output_handler_test_fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700183 "//aos/events:simulated_event_loop",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700184 "//aos/testing:googletest",
185 "//aos/testing:test_logging",
186 ],
187)
188
Brian Silverman100534c2015-09-07 15:51:23 -0400189cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700190 name = "joystick_sender",
191 srcs = [
192 "joystick_sender.cc",
193 ],
194 hdrs = [
195 "joystick_sender.h",
196 ],
197 restricted_to = ["//tools:roborio"],
198 deps = [
John Park398c74a2018-10-20 21:17:39 -0700199 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700200 "//aos/events:shm_event_loop",
201 "//aos/input:driver_station_data",
Austin Schuh45a549f2019-02-02 15:43:56 -0800202 "//aos/network:team_number",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700203 "//aos/robot_state:joystick_state_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700204 "//third_party:wpilib",
205 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400206)
Brian Silverman811f8ec2015-12-06 01:29:42 -0500207
208cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700209 name = "wpilib_interface",
210 srcs = [
211 "wpilib_interface.cc",
212 ],
213 hdrs = [
214 "wpilib_interface.h",
215 ],
216 restricted_to = ["//tools:roborio"],
217 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700218 "//aos/events:event_loop",
219 "//aos/robot_state:robot_state_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700220 "//third_party:wpilib",
221 ],
Brian Silverman39b339e2016-01-03 13:24:22 -0800222)
223
Alex Perrycb7da4b2019-08-28 19:35:56 -0700224flatbuffer_cc_library(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800225 name = "pdp_values_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700226 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700227 "pdp_values.fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700228 ],
Austin Schuhed5b26d2019-12-05 20:51:59 -0800229 gen_reflections = 1,
Brian Silverman425492b2015-12-30 15:23:55 -0800230)
231
232cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700233 name = "pdp_fetcher",
234 srcs = [
235 "pdp_fetcher.cc",
236 ],
237 hdrs = [
238 "pdp_fetcher.h",
239 ],
240 restricted_to = ["//tools:roborio"],
241 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800242 ":pdp_values_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800243 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700244 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800245 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700246 "//aos/util:phased_loop",
Brian Silverman003a4732018-03-11 14:02:15 -0700247 "//third_party:wpilib",
248 ],
Brian Silverman811f8ec2015-12-06 01:29:42 -0500249)
Campbell Crowleyc0cfb132015-12-30 20:58:02 -0800250
251cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700252 name = "wpilib_robot_base",
253 hdrs = [
254 "wpilib_robot_base.h",
255 ],
256 restricted_to = ["//tools:roborio"],
257 deps = [
258 "//third_party:wpilib",
259 ],
Campbell Crowleyc0cfb132015-12-30 20:58:02 -0800260)
Brian Silverman5f17a972016-02-28 01:49:32 -0500261
Alex Perrycb7da4b2019-08-28 19:35:56 -0700262flatbuffer_cc_library(
263 name = "imu_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700264 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700265 "imu.fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700266 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700267 gen_reflections = 1,
Brian Silverman5f17a972016-02-28 01:49:32 -0500268)
269
Austin Schuhac17fba2020-03-28 15:55:33 -0700270flatbuffer_cc_library(
271 name = "imu_batch_fbs",
272 srcs = [
273 "imu_batch.fbs",
274 ],
275 gen_reflections = 1,
276 includes = [
277 ":imu_fbs_includes",
278 ],
279)
280
Brian Silverman5f17a972016-02-28 01:49:32 -0500281cc_library(
Brian Silverman7be68ba2020-01-08 22:08:40 -0800282 name = "ADIS16470",
283 srcs = [
284 "ADIS16470.cc",
285 ],
286 hdrs = [
287 "ADIS16470.h",
288 ],
289 restricted_to = ["//tools:roborio"],
290 deps = [
291 ":fpga_time_conversion",
Austin Schuhac17fba2020-03-28 15:55:33 -0700292 ":imu_batch_fbs",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800293 ":imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700294 "//aos/containers:sized_array",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800295 "//aos/events:event_loop",
296 "//aos/time",
297 "//third_party:wpilib",
298 "@com_github_google_glog//:glog",
299 "@com_google_absl//absl/types:span",
300 ],
301)
302
303cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700304 name = "ADIS16448",
305 srcs = [
306 "ADIS16448.cc",
307 ],
308 hdrs = [
309 "ADIS16448.h",
310 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -0800311 # This library uses some deprecated parts of the SPI API.
312 copts = ["-Wno-deprecated-declarations"],
Brian Silverman003a4732018-03-11 14:02:15 -0700313 restricted_to = ["//tools:roborio"],
314 deps = [
Brian Silverman7be68ba2020-01-08 22:08:40 -0800315 ":fpga_time_conversion",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700316 ":imu_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700317 ":spi_rx_clearer",
Austin Schuh45a549f2019-02-02 15:43:56 -0800318 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700319 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800320 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700321 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -0800322 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -0700323 "//frc971/zeroing:averager",
324 "//third_party:wpilib",
325 ],
Brian Silverman5f17a972016-02-28 01:49:32 -0500326)
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500327
328cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700329 name = "dma",
330 srcs = [
331 "dma.cc",
332 ],
333 hdrs = [
334 "dma.h",
335 ],
336 restricted_to = ["//tools:roborio"],
337 deps = [
338 "//third_party:wpilib",
339 ],
340)
341
342cc_library(
343 name = "spi_rx_clearer",
344 srcs = [
345 "spi_rx_clearer.cc",
346 ],
347 hdrs = [
348 "spi_rx_clearer.h",
349 ],
350 deps = [
John Park33858a32018-09-28 23:05:48 -0700351 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -0700352 ],
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500353)
Sabina Davisadc58542019-02-01 22:23:00 -0800354
355cc_library(
356 name = "sensor_reader",
357 srcs = [
358 "sensor_reader.cc",
359 ],
360 hdrs = [
Austin Schuh45a549f2019-02-02 15:43:56 -0800361 "sensor_reader.h",
Sabina Davisadc58542019-02-01 22:23:00 -0800362 ],
363 restricted_to = ["//tools:roborio"],
364 deps = [
Sabina Davis1ffa4172019-02-01 22:38:33 -0800365 ":dma",
366 ":dma_edge_counting",
Austin Schuh54667ac2019-02-02 16:44:49 -0800367 ":encoder_and_potentiometer",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800368 ":fpga_time_conversion",
Austin Schuh45a549f2019-02-02 15:43:56 -0800369 ":wpilib_interface",
370 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700371 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800372 "//aos/events:shm_event_loop",
Austin Schuha0c41ba2020-09-10 22:59:14 -0700373 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -0800374 "//aos/stl_mutex",
375 "//aos/time",
376 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700377 "//frc971/control_loops:control_loops_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800378 "//third_party:wpilib",
Sabina Davisadc58542019-02-01 22:23:00 -0800379 ],
380)
Sabina Davisd004fd62019-02-02 23:51:46 -0800381
382cc_library(
383 name = "drivetrain_writer",
384 srcs = [
385 "drivetrain_writer.cc",
386 ],
387 hdrs = [
388 "drivetrain_writer.h",
389 ],
390 restricted_to = ["//tools:roborio"],
391 deps = [
392 ":loop_output_handler",
393 "//aos:math",
394 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700395 "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
Sabina Davisd004fd62019-02-02 23:51:46 -0800396 "//third_party:wpilib",
397 ],
398)
Brian Silverman7be68ba2020-01-08 22:08:40 -0800399
400cc_library(
401 name = "fpga_time_conversion",
402 srcs = [
403 "fpga_time_conversion.cc",
404 ],
405 hdrs = [
406 "fpga_time_conversion.h",
407 ],
408 restricted_to = ["//tools:roborio"],
409 deps = [
410 "//aos/time",
411 "//aos/util:compiler_memory_barrier",
412 "//third_party:wpilib",
413 "@com_github_google_glog//:glog",
414 ],
415)