refactor: one alarm encoder, named register bits, and the example 14 B smaller

Both alarms' registers come from one encoder that derives DY/DT and the
mask bits from the rate, and the battery checks the bytes each Table 2
row writes instead of restating the enum values. Register addresses and
bits are named, the year register is the year less 2000 rather than a
division, and an alarm day reads back with one decode for both forms.
Over the whole API the image is 10 B smaller on both parts; a rate only
known at run time costs set_alarm1 6 B more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BlackMarkandClaude Opus 5.5 committed 2026-10-23 21:55:02 +02:00
1 parent 4df536d0a5
commit f9bc2cd8e2
4 files changed
+156 -134

No files matched your search

+3 -5
View File
@@ -3,9 +3,9 @@ libavr_format_test()
# The example's size is stated in the README, per chip, and a library advance
# that moves it silently is what this catches.
if(LIBAVR_MCU STREQUAL "atmega328p")
libavr_size_claim_test(clock 1480)
libavr_size_claim_test(clock 1468)
elseif(LIBAVR_MCU STREQUAL "attiny85")
libavr_size_claim_test(clock 1270)
libavr_size_claim_test(clock 1256)
endif()
# The README says the two modes emit the same image, and only a tree with
@@ -21,7 +21,5 @@ add_test(NAME ds3231.consteval
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target consteval_tests)
# A check this host cannot run reads as Skipped rather than Failed: the marker
# a stubbed launcher prints, over every test registered here. Nothing in this
# suite is host-gated today, and this is what keeps that a property of the
# suite rather than of whoever adds the next check.
# a stubbed launcher prints, over every test registered here.
libavr_skip_unverified()