• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 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_library.bzl", "cc_library")
16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
19
20package(
21    default_visibility = ["//visibility:public"],
22)
23
24licenses(["notice"])
25
26cc_library(
27    name = "uart_base",
28    hdrs = [
29        "public/pw_uart/uart_base.h",
30    ],
31    strip_include_prefix = "public",
32    deps = [
33        "//pw_status",
34    ],
35)
36
37cc_library(
38    name = "uart",
39    hdrs = [
40        "public/pw_uart/uart.h",
41    ],
42    strip_include_prefix = "public",
43    deps = [
44        ":uart_base",
45        "//pw_assert:assert",
46        "//pw_bytes",
47        "//pw_chrono:system_clock",
48        "//pw_span",
49        "//pw_status",
50    ],
51)
52
53cc_library(
54    name = "uart_non_blocking",
55    hdrs = [
56        "public/pw_uart/uart_non_blocking.h",
57    ],
58    strip_include_prefix = "public",
59    deps = [
60        ":uart_base",
61        "//pw_bytes",
62        "//pw_function",
63        "//pw_span",
64        "//pw_status",
65    ],
66)
67
68cc_library(
69    name = "blocking_adapter",
70    srcs = [
71        "blocking_adapter.cc",
72    ],
73    hdrs = [
74        "public/pw_uart/blocking_adapter.h",
75    ],
76    implementation_deps = ["//pw_assert:check"],
77    strip_include_prefix = "public",
78    deps = [
79        ":uart",
80        ":uart_non_blocking",
81        "//pw_log",
82        "//pw_status",
83        "//pw_sync:timed_thread_notification",
84    ],
85)
86
87cc_library(
88    name = "stream",
89    hdrs = [
90        "public/pw_uart/stream.h",
91    ],
92    strip_include_prefix = "public",
93    deps = [
94        ":uart",
95        "//pw_stream",
96    ],
97)
98
99pw_cc_test(
100    name = "uart_test",
101    srcs = [
102        "uart_test.cc",
103    ],
104    deps = [
105        ":uart",
106        "//pw_status",
107    ],
108)
109
110pw_cc_test(
111    name = "uart_non_blocking_test",
112    srcs = [
113        "uart_non_blocking_test.cc",
114    ],
115    deps = [
116        ":uart_non_blocking",
117        "//pw_bytes",
118        "//pw_function",
119        "//pw_status",
120    ],
121)
122
123pw_cc_test(
124    name = "blocking_adapter_test",
125    srcs = [
126        "blocking_adapter_test.cc",
127    ],
128    deps = [
129        ":blocking_adapter",
130        "//pw_assert:check",
131        "//pw_bytes",
132        "//pw_log",
133        "//pw_sync:lock_annotations",
134        "//pw_sync:mutex",
135        "//pw_sync:timed_thread_notification",
136        "//pw_thread:test_thread_context",
137        "//pw_thread:thread",
138        "//pw_work_queue",
139    ],
140)
141
142pw_cc_test(
143    name = "stream_test",
144    srcs = [
145        "stream_test.cc",
146    ],
147    deps = [
148        ":stream",
149    ],
150)
151
152sphinx_docs_library(
153    name = "docs",
154    srcs = [
155        "backends.rst",
156        "docs.rst",
157    ],
158    prefix = "pw_uart/",
159    target_compatible_with = incompatible_with_mcu(),
160)
161
162filegroup(
163    name = "doxygen",
164    srcs = [
165        "public/pw_uart/blocking_adapter.h",
166        "public/pw_uart/stream.h",
167        "public/pw_uart/uart.h",
168        "public/pw_uart/uart_base.h",
169        "public/pw_uart/uart_non_blocking.h",
170    ],
171)
172