Rewrite on libavr
Same driver surface as the yazoalfa version — clock and alarm get/set, alarm interrupts, flag check/clear — plus oscillator-stop detection and die temperature. One source for tiny85 (software I2C) and mega328P (TWI), built against libavr in both generated and reflect mode, byte-identical .text across modes. Errors surface as std::expected instead of being dropped; weekday-rate alarms now really set the DY bit (legacy cleared it); multi-register access is one coherent bus transaction. Legacy stays on master. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
25
CMakeLists.txt
Normal file
25
CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
project(ds3231 LANGUAGES CXX)
|
||||
|
||||
# libavr comes from a local checkout (LIBAVR_ROOT cache/env variable) or,
|
||||
# failing that, straight from the forge. The toolchain file also lives in
|
||||
# that checkout — see CMakePresets.json.
|
||||
include(FetchContent)
|
||||
if(NOT LIBAVR_ROOT AND DEFINED ENV{LIBAVR_ROOT})
|
||||
set(LIBAVR_ROOT $ENV{LIBAVR_ROOT})
|
||||
endif()
|
||||
if(LIBAVR_ROOT)
|
||||
FetchContent_Declare(libavr SOURCE_DIR ${LIBAVR_ROOT})
|
||||
else()
|
||||
FetchContent_Declare(libavr GIT_REPOSITORY git@git.blackmark.me:avr/libavr.git GIT_TAG main)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(libavr)
|
||||
|
||||
add_library(ds3231 INTERFACE)
|
||||
target_include_directories(ds3231 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_link_libraries(ds3231 INTERFACE libavr)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
add_subdirectory(example)
|
||||
endif()
|
||||
Reference in New Issue
Block a user