blob: 21472f83119ac87ee483cd7481038f3a8a805ef4 [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",
Brian Silverman003a4732018-03-11 14:02:15 -070028 "//third_party:wpilib",
29 ],
Brian Silverman100534c2015-09-07 15:51:23 -040030)
31
32cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070033 name = "dma_edge_counting",
34 srcs = [
35 "dma_edge_counting.cc",
36 ],
37 hdrs = [
38 "dma_edge_counting.h",
39 ],
40 restricted_to = ["//tools:roborio"],
41 deps = [
42 ":dma",
John Park33858a32018-09-28 23:05:48 -070043 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -070044 "//third_party:wpilib",
45 ],
Brian Silverman100534c2015-09-07 15:51:23 -040046)
47
48cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070049 name = "interrupt_edge_counting",
50 srcs = [
51 "interrupt_edge_counting.cc",
52 ],
53 hdrs = [
54 "interrupt_edge_counting.h",
55 ],
56 restricted_to = ["//tools:roborio"],
57 deps = [
John Park398c74a2018-10-20 21:17:39 -070058 "//aos:init",
Austin Schuh45a549f2019-02-02 15:43:56 -080059 "//aos/logging",
60 "//aos/stl_mutex",
61 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -070062 "//third_party:wpilib",
63 ],
Brian Silverman100534c2015-09-07 15:51:23 -040064)
65
66cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070067 name = "buffered_pcm",
68 srcs = [
69 "buffered_pcm.cc",
70 "buffered_solenoid.cc",
71 ],
72 hdrs = [
73 "buffered_pcm.h",
74 "buffered_solenoid.h",
75 ],
76 restricted_to = ["//tools:roborio"],
77 deps = [
John Park33858a32018-09-28 23:05:48 -070078 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -070079 "//third_party:wpilib",
80 ],
Brian Silverman100534c2015-09-07 15:51:23 -040081)
82
83cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -070084 name = "gyro_interface",
85 srcs = [
86 "gyro_interface.cc",
87 ],
88 hdrs = [
89 "gyro_interface.h",
90 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080091 # This library uses some deprecated parts of the SPI API.
92 copts = ["-Wno-deprecated-declarations"],
Brian Silverman003a4732018-03-11 14:02:15 -070093 restricted_to = ["//tools:roborio"],
94 deps = [
John Park33858a32018-09-28 23:05:48 -070095 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -080096 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -070097 "//third_party:wpilib",
98 ],
Brian Silverman100534c2015-09-07 15:51:23 -040099)
100
101cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700102 name = "gyro_sender",
103 srcs = [
104 "gyro_sender.cc",
105 ],
106 hdrs = [
107 "gyro_sender.h",
108 ],
109 restricted_to = ["//tools:roborio"],
110 deps = [
111 ":gyro_interface",
Austin Schuh45a549f2019-02-02 15:43:56 -0800112 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700113 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800114 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700115 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700116 "//aos/robot_state:robot_state_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800117 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700118 "//aos/util:phased_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800119 "//frc971/queues:gyro_fbs",
120 "//frc971/queues:gyro_uid_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700121 "//frc971/zeroing:averager",
122 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400123)
124
Alex Perrycb7da4b2019-08-28 19:35:56 -0700125flatbuffer_cc_library(
126 name = "loop_output_handler_test_fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700127 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700128 "loop_output_handler_test.fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700129 ],
Austin Schuh00be38c2019-12-01 18:08:25 -0800130 gen_reflections = 1,
131)
132
133aos_config(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800134 name = "config",
135 src = "wpilib_config.json",
136 flatbuffers = [
137 ":pdp_values_fbs",
138 ":logging_fbs",
139 ],
140)
141
142aos_config(
Austin Schuh00be38c2019-12-01 18:08:25 -0800143 name = "loop_output_handler_test_config",
144 src = "loop_output_handler_test_config_source.json",
145 flatbuffers = [
146 ":loop_output_handler_test_fbs",
147 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800148 deps = [
149 "//aos/events:config",
150 ],
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700151)
152
Brian Silverman100534c2015-09-07 15:51:23 -0400153cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700154 name = "loop_output_handler",
155 srcs = [
156 "loop_output_handler.cc",
157 ],
158 hdrs = [
159 "loop_output_handler.h",
160 ],
161 deps = [
John Park398c74a2018-10-20 21:17:39 -0700162 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700163 "//aos/events:event_loop",
164 "//aos/robot_state:robot_state_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800165 "//aos/scoped:scoped_fd",
166 "//aos/time",
167 "//aos/util:log_interval",
Brian Silverman003a4732018-03-11 14:02:15 -0700168 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400169)
170
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700171cc_test(
172 name = "loop_output_handler_test",
173 srcs = [
174 "loop_output_handler_test.cc",
175 ],
Austin Schuh00be38c2019-12-01 18:08:25 -0800176 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700177 ":loop_output_handler_test_config",
Austin Schuh00be38c2019-12-01 18:08:25 -0800178 ],
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700179 deps = [
180 ":loop_output_handler",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700181 ":loop_output_handler_test_fbs",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700182 "//aos/events:simulated_event_loop",
Austin Schuhbd1fe9c2019-06-29 16:35:48 -0700183 "//aos/testing:googletest",
184 "//aos/testing:test_logging",
185 ],
186)
187
Brian Silverman100534c2015-09-07 15:51:23 -0400188cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700189 name = "joystick_sender",
190 srcs = [
191 "joystick_sender.cc",
192 ],
193 hdrs = [
194 "joystick_sender.h",
195 ],
196 restricted_to = ["//tools:roborio"],
197 deps = [
John Park398c74a2018-10-20 21:17:39 -0700198 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700199 "//aos/events:shm_event_loop",
200 "//aos/input:driver_station_data",
Austin Schuh45a549f2019-02-02 15:43:56 -0800201 "//aos/network:team_number",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700202 "//aos/robot_state:joystick_state_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700203 "//third_party:wpilib",
204 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400205)
Brian Silverman811f8ec2015-12-06 01:29:42 -0500206
207cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700208 name = "wpilib_interface",
209 srcs = [
210 "wpilib_interface.cc",
211 ],
212 hdrs = [
213 "wpilib_interface.h",
214 ],
215 restricted_to = ["//tools:roborio"],
216 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700217 "//aos/events:event_loop",
218 "//aos/robot_state:robot_state_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700219 "//third_party:wpilib",
220 ],
Brian Silverman39b339e2016-01-03 13:24:22 -0800221)
222
Alex Perrycb7da4b2019-08-28 19:35:56 -0700223flatbuffer_cc_library(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800224 name = "pdp_values_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700225 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700226 "pdp_values.fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700227 ],
Austin Schuhed5b26d2019-12-05 20:51:59 -0800228 gen_reflections = 1,
Brian Silverman425492b2015-12-30 15:23:55 -0800229)
230
231cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700232 name = "pdp_fetcher",
233 srcs = [
234 "pdp_fetcher.cc",
235 ],
236 hdrs = [
237 "pdp_fetcher.h",
238 ],
239 restricted_to = ["//tools:roborio"],
240 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800241 ":pdp_values_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800242 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800244 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700245 "//aos/util:phased_loop",
Brian Silverman003a4732018-03-11 14:02:15 -0700246 "//third_party:wpilib",
247 ],
Brian Silverman811f8ec2015-12-06 01:29:42 -0500248)
Campbell Crowleyc0cfb132015-12-30 20:58:02 -0800249
250cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700251 name = "wpilib_robot_base",
252 hdrs = [
253 "wpilib_robot_base.h",
254 ],
255 restricted_to = ["//tools:roborio"],
256 deps = [
257 "//third_party:wpilib",
258 ],
Campbell Crowleyc0cfb132015-12-30 20:58:02 -0800259)
Brian Silverman5f17a972016-02-28 01:49:32 -0500260
Alex Perrycb7da4b2019-08-28 19:35:56 -0700261flatbuffer_cc_library(
262 name = "imu_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700263 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700264 "imu.fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700265 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700266 gen_reflections = 1,
Brian Silverman5f17a972016-02-28 01:49:32 -0500267)
268
Austin Schuhac17fba2020-03-28 15:55:33 -0700269flatbuffer_cc_library(
270 name = "imu_batch_fbs",
271 srcs = [
272 "imu_batch.fbs",
273 ],
274 gen_reflections = 1,
275 includes = [
276 ":imu_fbs_includes",
277 ],
278)
279
Brian Silverman5f17a972016-02-28 01:49:32 -0500280cc_library(
Brian Silverman7be68ba2020-01-08 22:08:40 -0800281 name = "ADIS16470",
282 srcs = [
283 "ADIS16470.cc",
284 ],
285 hdrs = [
286 "ADIS16470.h",
287 ],
288 restricted_to = ["//tools:roborio"],
289 deps = [
290 ":fpga_time_conversion",
Austin Schuhac17fba2020-03-28 15:55:33 -0700291 ":imu_batch_fbs",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800292 ":imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700293 "//aos/containers:sized_array",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800294 "//aos/events:event_loop",
295 "//aos/time",
296 "//third_party:wpilib",
297 "@com_github_google_glog//:glog",
298 "@com_google_absl//absl/types:span",
299 ],
300)
301
302cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700303 name = "ADIS16448",
304 srcs = [
305 "ADIS16448.cc",
306 ],
307 hdrs = [
308 "ADIS16448.h",
309 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -0800310 # This library uses some deprecated parts of the SPI API.
311 copts = ["-Wno-deprecated-declarations"],
Brian Silverman003a4732018-03-11 14:02:15 -0700312 restricted_to = ["//tools:roborio"],
313 deps = [
Brian Silverman7be68ba2020-01-08 22:08:40 -0800314 ":fpga_time_conversion",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700315 ":imu_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700316 ":spi_rx_clearer",
Austin Schuh45a549f2019-02-02 15:43:56 -0800317 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700318 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800319 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700320 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -0800321 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -0700322 "//frc971/zeroing:averager",
323 "//third_party:wpilib",
324 ],
Brian Silverman5f17a972016-02-28 01:49:32 -0500325)
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500326
327cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700328 name = "dma",
329 srcs = [
330 "dma.cc",
331 ],
332 hdrs = [
333 "dma.h",
334 ],
335 restricted_to = ["//tools:roborio"],
336 deps = [
337 "//third_party:wpilib",
338 ],
339)
340
341cc_library(
342 name = "spi_rx_clearer",
343 srcs = [
344 "spi_rx_clearer.cc",
345 ],
346 hdrs = [
347 "spi_rx_clearer.h",
348 ],
349 deps = [
John Park33858a32018-09-28 23:05:48 -0700350 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -0700351 ],
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500352)
Sabina Davisadc58542019-02-01 22:23:00 -0800353
354cc_library(
355 name = "sensor_reader",
356 srcs = [
357 "sensor_reader.cc",
358 ],
359 hdrs = [
Austin Schuh45a549f2019-02-02 15:43:56 -0800360 "sensor_reader.h",
Sabina Davisadc58542019-02-01 22:23:00 -0800361 ],
362 restricted_to = ["//tools:roborio"],
363 deps = [
Sabina Davis1ffa4172019-02-01 22:38:33 -0800364 ":dma",
365 ":dma_edge_counting",
Austin Schuh54667ac2019-02-02 16:44:49 -0800366 ":encoder_and_potentiometer",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800367 ":fpga_time_conversion",
Austin Schuh45a549f2019-02-02 15:43:56 -0800368 ":wpilib_interface",
369 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700370 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800371 "//aos/events:shm_event_loop",
Austin Schuha0c41ba2020-09-10 22:59:14 -0700372 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -0800373 "//aos/stl_mutex",
374 "//aos/time",
375 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700376 "//frc971/control_loops:control_loops_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800377 "//third_party:wpilib",
Sabina Davisadc58542019-02-01 22:23:00 -0800378 ],
379)
Sabina Davisd004fd62019-02-02 23:51:46 -0800380
381cc_library(
382 name = "drivetrain_writer",
383 srcs = [
384 "drivetrain_writer.cc",
385 ],
386 hdrs = [
387 "drivetrain_writer.h",
388 ],
389 restricted_to = ["//tools:roborio"],
390 deps = [
391 ":loop_output_handler",
392 "//aos:math",
393 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700394 "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
Sabina Davisd004fd62019-02-02 23:51:46 -0800395 "//third_party:wpilib",
396 ],
397)
Brian Silverman7be68ba2020-01-08 22:08:40 -0800398
399cc_library(
400 name = "fpga_time_conversion",
401 srcs = [
402 "fpga_time_conversion.cc",
403 ],
404 hdrs = [
405 "fpga_time_conversion.h",
406 ],
407 restricted_to = ["//tools:roborio"],
408 deps = [
409 "//aos/time",
410 "//aos/util:compiler_memory_barrier",
411 "//third_party:wpilib",
412 "@com_github_google_glog//:glog",
413 ],
414)