load("//bazel:defs.bzl", "compatible_with_rp2", "incompatible_with_config")

package(default_visibility = ["//visibility:public"])

cc_library(
    name = "pico_async_context",
    srcs = ["async_context_base.c"],
    hdrs = [
        "include/pico/async_context.h",
        "include/pico/async_context_base.h",
    ],
    includes = ["include"],
    target_compatible_with = compatible_with_rp2(),
    deps = [
        "//src/common/pico_time",
        "//src/rp2_common:pico_platform",
    ],
)

cc_library(
    name = "pico_async_context_freertos",
    srcs = ["async_context_freertos.c"],
    hdrs = ["include/pico/async_context_freertos.h"],
    includes = ["include"],
    target_compatible_with = compatible_with_rp2() + incompatible_with_config(
        "//bazel/constraint:pico_freertos_unset",
    ),
    deps = [
        ":pico_async_context",
        "//bazel/config:PICO_FREERTOS_LIB",
        "//src/common/pico_sync",
        "//src/common/pico_time",
        "//src/rp2_common:pico_platform",
        "//src/rp2_common/hardware_irq",
    ],
)

cc_library(
    name = "pico_async_context_poll",
    srcs = ["async_context_poll.c"],
    hdrs = ["include/pico/async_context_poll.h"],
    includes = ["include"],
    target_compatible_with = compatible_with_rp2(),
    deps = [
        ":pico_async_context",
        "//src/common/pico_sync",
        "//src/common/pico_time",
        "//src/rp2_common:pico_platform",
    ],
)

cc_library(
    name = "pico_async_context_threadsafe_background",
    srcs = ["async_context_threadsafe_background.c"],
    hdrs = ["include/pico/async_context_threadsafe_background.h"],
    includes = ["include"],
    target_compatible_with = compatible_with_rp2(),
    deps = [
        ":pico_async_context",
        "//src/common/pico_sync",
        "//src/common/pico_time",
        "//src/rp2_common:pico_platform",
        "//src/rp2_common/hardware_irq",
        "//src/rp2_common/pico_multicore",
    ],
)
