1# Copyright 2024 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("@rules_cc//cc:cc_binary.bzl", "cc_binary") 16load("@rules_cc//cc:cc_library.bzl", "cc_library") 17load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 18load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 19load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 20 21package( 22 default_visibility = ["//visibility:public"], 23 features = ["-layering_check"], 24) 25 26licenses(["notice"]) 27 28cc_library( 29 name = "pw_spi_linux", 30 srcs = ["spi.cc"], 31 hdrs = ["public/pw_spi_linux/spi.h"], 32 strip_include_prefix = "public", 33 target_compatible_with = [ 34 "@platforms//os:linux", 35 ], 36 deps = [ 37 "//pw_bytes", 38 "//pw_log", 39 "//pw_spi:chip_selector", 40 "//pw_spi:initiator", 41 "//pw_status", 42 ], 43) 44 45cc_binary( 46 name = "pw_spi_linux_cli", 47 srcs = [ 48 "cli.cc", 49 ], 50 target_compatible_with = [ 51 "@platforms//os:linux", 52 ], 53 deps = [ 54 ":pw_spi_linux", 55 "//pw_build:default_link_extra_lib", 56 "//pw_log", 57 "//pw_preprocessor", 58 "//pw_result", 59 ], 60) 61 62pw_cc_test( 63 name = "spi_test", 64 srcs = [ 65 "spi_test.cc", 66 ], 67 target_compatible_with = [ 68 "@platforms//os:linux", 69 ], 70 deps = [":pw_spi_linux"], 71) 72 73sphinx_docs_library( 74 name = "docs", 75 srcs = [ 76 "docs.rst", 77 ], 78 prefix = "pw_spi_linux/", 79 target_compatible_with = incompatible_with_mcu(), 80) 81