1# Copyright 2020 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_library", 18 "pw_cc_test", 19) 20 21package(default_visibility = ["//visibility:public"]) 22 23licenses(["notice"]) 24 25pw_cc_library( 26 name = "initiator", 27 hdrs = [ 28 "public/pw_spi/initiator.h", 29 ], 30 includes = ["public"], 31 deps = [ 32 "//pw_assert", 33 "//pw_bytes", 34 "//pw_status", 35 ], 36) 37 38pw_cc_library( 39 name = "chip_selector", 40 hdrs = [ 41 "public/pw_spi/chip_selector.h", 42 ], 43 includes = ["public"], 44 deps = [ 45 "//pw_status", 46 ], 47) 48 49pw_cc_library( 50 name = "device", 51 hdrs = [ 52 "public/pw_spi/device.h", 53 ], 54 includes = ["public"], 55 deps = [ 56 ":chip_selector", 57 ":initiator", 58 "//pw_bytes", 59 "//pw_chrono:system_clock", 60 "//pw_status", 61 "//pw_sync:borrow", 62 ], 63) 64 65pw_cc_test( 66 name = "spi_test", 67 srcs = [ 68 "spi_test.cc", 69 ], 70 deps = [ 71 ":device", 72 "//pw_sync:mutex", 73 "//pw_unit_test", 74 ], 75) 76 77# Linux-specific spidev implementation. 78pw_cc_library( 79 name = "linux_spi", 80 srcs = ["linux_spi.cc"], 81 hdrs = ["public/pw_spi/linux_spi.h"], 82 includes = ["public"], 83 deps = [ 84 ":device", 85 "//pw_bytes", 86 "//pw_chrono:system_clock", 87 "//pw_log", 88 "//pw_status", 89 "//pw_sync:borrow", 90 "//pw_sync:mutex", 91 ], 92) 93 94pw_cc_test( 95 name = "linux_spi_test", 96 srcs = ["linux_spi_test.cc"], 97 deps = [ 98 ":device", 99 ":linux_spi", 100 ], 101) 102