blob: 41a7c5cc133cfb5fa9a9918caa487507e2a63500 [file]
# Copyright 2025 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@sphinxdocs//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
load("//pw_build:pw_cc_binary.bzl", "pw_cc_binary")
load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
pw_cc_binary(
name = "codelab",
srcs = [
"main.cc",
"vending_machine.cc",
"vending_machine.h",
],
copts = [
"-Wno-unused-parameter",
"-Wno-unused-private-field",
],
deps = [
":hardware",
":sensors",
"//pw_async2",
"//pw_async2:basic_dispatcher",
"//pw_async2:channel",
"//pw_async2:future_timeout",
"//pw_async2:select",
"//pw_async2:system_time_provider",
"//pw_async2:time_provider",
"//pw_chrono:system_clock",
"//pw_log",
"//pw_sync:interrupt_spin_lock",
"//pw_sync:lock_annotations",
],
)
cc_library(
name = "hardware",
srcs = ["hardware.cc"],
hdrs = ["hardware.h"],
implementation_deps = [
"//pw_assert:check",
"//pw_async2",
"//pw_async2/codelab/webui:webui_server",
"//pw_function",
"//pw_log",
"//pw_status",
"//pw_stream:socket_stream",
"//pw_stream:sys_io_stream",
"//pw_string:string",
"//pw_string:util",
],
local_defines = ["PW_ASYNC2_CODELAB_WEBUI=1"],
strip_include_prefix = ".",
target_compatible_with = incompatible_with_mcu(),
)
cc_library(
name = "sensors",
srcs = [
"coin_slot.cc",
"item_drop_sensor.cc",
],
hdrs = [
"coin_slot.h",
"item_drop_sensor.h",
],
strip_include_prefix = ".",
deps = [
"//pw_assert:assert",
"//pw_assert:check",
"//pw_async2",
"//pw_async2:value_future",
"//pw_sync:interrupt_spin_lock",
"//pw_sync:lock_annotations",
],
)
pw_cc_test(
name = "coin_slot_test",
srcs = ["coin_slot_test.cc"],
deps = [
":sensors",
"//pw_async2",
"//pw_async2:testing",
"//pw_unit_test",
],
)
sphinx_docs_library(
name = "docs",
srcs = [
"coin_slot.h",
"docs.rst",
"hardware.h",
"main.cc",
"vending_machine.cc",
"vending_machine.h",
"//pw_async2/codelab/step1:docs",
"//pw_async2/codelab/step2:docs",
"//pw_async2/codelab/step3:docs",
"//pw_async2/codelab/step4:docs",
"//pw_async2/codelab/step5:docs",
],
target_compatible_with = incompatible_with_mcu(),
)