blob: 18a177557117ec6ce2c5d8e5460909d2dc86f038 [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",
Brian Silverman003a4732018-03-11 14:02:15 -0700120 "//frc971/queues:gyro",
121 "//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 = [
177 "loop_output_handler_test_config.json",
178 ],
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
269cc_library(
Brian Silverman7be68ba2020-01-08 22:08:40 -0800270 name = "ADIS16470",
271 srcs = [
272 "ADIS16470.cc",
273 ],
274 hdrs = [
275 "ADIS16470.h",
276 ],
277 restricted_to = ["//tools:roborio"],
278 deps = [
279 ":fpga_time_conversion",
280 ":imu_fbs",
281 "//aos/events:event_loop",
282 "//aos/time",
283 "//third_party:wpilib",
284 "@com_github_google_glog//:glog",
285 "@com_google_absl//absl/types:span",
286 ],
287)
288
289cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700290 name = "ADIS16448",
291 srcs = [
292 "ADIS16448.cc",
293 ],
294 hdrs = [
295 "ADIS16448.h",
296 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -0800297 # This library uses some deprecated parts of the SPI API.
298 copts = ["-Wno-deprecated-declarations"],
Brian Silverman003a4732018-03-11 14:02:15 -0700299 restricted_to = ["//tools:roborio"],
300 deps = [
Brian Silverman7be68ba2020-01-08 22:08:40 -0800301 ":fpga_time_conversion",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700302 ":imu_fbs",
Brian Silverman003a4732018-03-11 14:02:15 -0700303 ":spi_rx_clearer",
Austin Schuh45a549f2019-02-02 15:43:56 -0800304 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700305 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800306 "//aos/events:shm_event_loop",
John Park33858a32018-09-28 23:05:48 -0700307 "//aos/logging",
Austin Schuh45a549f2019-02-02 15:43:56 -0800308 "//aos/time",
Brian Silverman003a4732018-03-11 14:02:15 -0700309 "//frc971/zeroing:averager",
310 "//third_party:wpilib",
311 ],
Brian Silverman5f17a972016-02-28 01:49:32 -0500312)
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500313
314cc_library(
Brian Silverman003a4732018-03-11 14:02:15 -0700315 name = "dma",
316 srcs = [
317 "dma.cc",
318 ],
319 hdrs = [
320 "dma.h",
321 ],
322 restricted_to = ["//tools:roborio"],
323 deps = [
324 "//third_party:wpilib",
325 ],
326)
327
328cc_library(
329 name = "spi_rx_clearer",
330 srcs = [
331 "spi_rx_clearer.cc",
332 ],
333 hdrs = [
334 "spi_rx_clearer.h",
335 ],
336 deps = [
John Park33858a32018-09-28 23:05:48 -0700337 "//aos/logging",
Brian Silverman003a4732018-03-11 14:02:15 -0700338 ],
Brian Silvermanb5b46ca2016-03-13 01:14:17 -0500339)
Sabina Davisadc58542019-02-01 22:23:00 -0800340
341cc_library(
342 name = "sensor_reader",
343 srcs = [
344 "sensor_reader.cc",
345 ],
346 hdrs = [
Austin Schuh45a549f2019-02-02 15:43:56 -0800347 "sensor_reader.h",
Sabina Davisadc58542019-02-01 22:23:00 -0800348 ],
349 restricted_to = ["//tools:roborio"],
350 deps = [
Sabina Davis1ffa4172019-02-01 22:38:33 -0800351 ":dma",
352 ":dma_edge_counting",
Austin Schuh54667ac2019-02-02 16:44:49 -0800353 ":encoder_and_potentiometer",
Brian Silverman7be68ba2020-01-08 22:08:40 -0800354 ":fpga_time_conversion",
Austin Schuh45a549f2019-02-02 15:43:56 -0800355 ":wpilib_interface",
356 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700357 "//aos/events:event_loop",
Austin Schuh217a9782019-12-21 23:02:50 -0800358 "//aos/events:shm_event_loop",
Austin Schuh45a549f2019-02-02 15:43:56 -0800359 "//aos/stl_mutex",
360 "//aos/time",
361 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700362 "//frc971/control_loops:control_loops_fbs",
Austin Schuh45a549f2019-02-02 15:43:56 -0800363 "//third_party:wpilib",
Sabina Davisadc58542019-02-01 22:23:00 -0800364 ],
365)
Sabina Davisd004fd62019-02-02 23:51:46 -0800366
367cc_library(
368 name = "drivetrain_writer",
369 srcs = [
370 "drivetrain_writer.cc",
371 ],
372 hdrs = [
373 "drivetrain_writer.h",
374 ],
375 restricted_to = ["//tools:roborio"],
376 deps = [
377 ":loop_output_handler",
378 "//aos:math",
379 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700380 "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
Sabina Davisd004fd62019-02-02 23:51:46 -0800381 "//third_party:wpilib",
382 ],
383)
Brian Silverman7be68ba2020-01-08 22:08:40 -0800384
385cc_library(
386 name = "fpga_time_conversion",
387 srcs = [
388 "fpga_time_conversion.cc",
389 ],
390 hdrs = [
391 "fpga_time_conversion.h",
392 ],
393 restricted_to = ["//tools:roborio"],
394 deps = [
395 "//aos/time",
396 "//aos/util:compiler_memory_barrier",
397 "//third_party:wpilib",
398 "@com_github_google_glog//:glog",
399 ],
400)