• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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")
19load(
20    "sensor.bzl",
21    "pw_sensor_library",
22)
23
24package(
25    default_visibility = ["//visibility:public"],
26    features = ["-layering_check"],
27)
28
29licenses(["notice"])
30
31cc_library(
32    name = "pw_sensor_types",
33    srcs = [],
34    hdrs = [
35        "public/pw_sensor/types.h",
36    ],
37    includes = ["public"],
38    deps = [
39        "//pw_tokenizer",
40    ],
41)
42
43pw_sensor_library(
44    name = "test_constants_lib",
45    srcs = [
46        ":test_sensor1.yaml",
47        ":test_sensor2.yaml",
48    ],
49    generator_includes = ["../"],
50    inputs = [
51        ":attributes.yaml",
52        ":channels.yaml",
53        ":triggers.yaml",
54        ":units.yaml",
55    ],
56    out_header = "public/pw_sensor/generated/sensor_constants.h",
57    deps = [
58        ":pw_sensor_types",
59        "//pw_containers:flat_map",
60    ],
61)
62
63pw_cc_test(
64    name = "constants_test",
65    srcs = [
66        "attributes_test.cc",
67        "channels_test.cc",
68        "triggers_test.cc",
69        "units_test.cc",
70    ],
71    deps = [
72        ":pw_sensor_types",
73        ":test_constants_lib",
74    ],
75)
76
77sphinx_docs_library(
78    name = "docs",
79    srcs = [
80        "docs.rst",
81        "//pw_sensor/py:docs",
82    ],
83    prefix = "pw_sensor/",
84    target_compatible_with = incompatible_with_mcu(),
85)
86