1# Copyright 2021 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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_unit_test/test.gni") 20 21config("public_include_path") { 22 include_dirs = [ "public" ] 23} 24 25group("pw_spi") { 26 deps = [ 27 ":chip_selector", 28 ":chip_selector_digital_out", 29 ":device", 30 ":initiator", 31 ] 32} 33 34pw_source_set("initiator") { 35 public_configs = [ ":public_include_path" ] 36 public = [ "public/pw_spi/initiator.h" ] 37 public_deps = [ 38 "$dir_pw_assert", 39 "$dir_pw_bytes", 40 "$dir_pw_status", 41 ] 42} 43 44pw_source_set("responder") { 45 public_configs = [ ":public_include_path" ] 46 public = [ "public/pw_spi/responder.h" ] 47 public_deps = [ 48 "$dir_pw_bytes", 49 "$dir_pw_function", 50 "$dir_pw_status", 51 ] 52} 53 54pw_source_set("chip_selector") { 55 public_configs = [ ":public_include_path" ] 56 public = [ "public/pw_spi/chip_selector.h" ] 57 public_deps = [ "$dir_pw_status" ] 58} 59 60pw_source_set("chip_selector_digital_out") { 61 public_configs = [ ":public_include_path" ] 62 public = [ "public/pw_spi/chip_selector_digital_out.h" ] 63 public_deps = [ 64 ":chip_selector", 65 "$dir_pw_digital_io", 66 "$dir_pw_status", 67 ] 68} 69 70pw_source_set("device") { 71 public_configs = [ ":public_include_path" ] 72 public = [ "public/pw_spi/device.h" ] 73 public_deps = [ 74 ":chip_selector", 75 ":initiator", 76 "$dir_pw_bytes", 77 "$dir_pw_status", 78 "$dir_pw_sync:borrow", 79 ] 80} 81 82pw_source_set("mock") { 83 public_configs = [ ":public_include_path" ] 84 public = [ 85 "public/pw_spi/chip_selector_mock.h", 86 "public/pw_spi/initiator_mock.h", 87 ] 88 sources = [ "initiator_mock.cc" ] 89 public_deps = [ 90 ":chip_selector", 91 ":initiator", 92 "$dir_pw_bytes", 93 "$dir_pw_containers:to_array", 94 ] 95 deps = [ 96 "$dir_pw_assert", 97 "$dir_pw_containers", 98 "$dir_pw_unit_test", 99 ] 100} 101 102pw_test_group("tests") { 103 tests = [ 104 ":spi_test", 105 ":initiator_mock_test", 106 ] 107} 108 109pw_test("spi_test") { 110 sources = [ "spi_test.cc" ] 111 deps = [ 112 ":device", 113 ":responder", 114 "$dir_pw_sync:mutex", 115 ] 116} 117 118pw_test("initiator_mock_test") { 119 sources = [ "initiator_mock_test.cc" ] 120 deps = [ 121 ":mock", 122 "$dir_pw_containers", 123 ] 124} 125 126pw_doc_group("docs") { 127 sources = [ 128 "backends.rst", 129 "docs.rst", 130 ] 131} 132