# 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("//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"]) exports_files( [ "main.cc", "vending_machine.cc", "vending_machine.h", ], visibility = ["//pw_async2:__subpackages__"], ) pw_cc_binary( name = "codelab", srcs = [ "main.cc", "vending_machine.cc", "vending_machine.h", ], deps = [ ":hardware", ":sensors", "//pw_async2:dispatcher", "//pw_async2:pendable", "//pw_async2:poll", "//pw_async2:select", "//pw_async2:system_time_provider", "//pw_async2:time_provider", "//pw_chrono:system_clock", "//pw_containers:inline_async_deque", "//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:dispatcher", "//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=0"], 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_async2:dispatcher", "//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:dispatcher", "//pw_async2:pend_func_task", "//pw_async2:poll", "//pw_unit_test", ], )