Files
templates/c/ds18b20/CMakeLists.txt
Andrey Kruchinkin 873ac438f3 feat(ds18b20): термометры DS18B20 поверх программной 1-Wire
Перенесён из репозитория ds18b20, который подключался сабмодулем в
KONOR_ds18b20. История библиотеки осталась там; сюда пришло состояние
на момент переезда.

Ядро на C99 без stm32f10x.h и динамической памяти. Порт — пять функций
(Init, DelayUs, Reset, WriteBit, ReadBit); реализация для STM32F1 идёт
в комплекте в ports/stm32f1. Хостовые тесты на модели шины с виртуальными
датчиками проходят: tests/test_ds18b20.c.
2026-08-23 01:15:34 +03:00

36 lines
1.1 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
cmake_minimum_required(VERSION 3.13)
project(ds18b20 C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Переносимое ядро: ни регистров, ни задержек, ни stm32f10x.h.
add_library(ds18b20 STATIC
src/onewire.c
src/ds18b20.c
)
target_include_directories(ds18b20 PUBLIC include)
if(MSVC)
target_compile_options(ds18b20 PRIVATE /W4)
else()
target_compile_options(ds18b20 PRIVATE -Wall -Wextra -Wpedantic)
endif()
# Порты (ports/) сюда не входят: им нужен CMSIS-заголовок целевого МК,
# они подключаются напрямую в проект прошивки.
option(DS18B20_BUILD_TESTS "Собирать тесты на симуляторе шины" ON)
if(DS18B20_BUILD_TESTS)
enable_testing()
add_executable(test_ds18b20
tests/test_ds18b20.c
tests/fake_onewire.c
)
target_link_libraries(test_ds18b20 PRIVATE ds18b20)
target_include_directories(test_ds18b20 PRIVATE tests)
add_test(NAME ds18b20 COMMAND test_ds18b20)
endif()