Skip to content

Commit

Permalink
drivers: rtc: add driver for the nxp pcf8523 rtc
Browse files Browse the repository at this point in the history
Add RTC device driver for the NXP PCF8523 Real-Time Clock (RTC) and
calendar.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
  • Loading branch information
henrikbrixandersen authored and carlescufi committed Apr 27, 2023
1 parent 51ba050 commit 11fc5d0
Show file tree
Hide file tree
Showing 4 changed files with 1,018 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/rtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ zephyr_library()

zephyr_library_sources_ifdef(CONFIG_USERSPACE rtc_handlers.c)
zephyr_library_sources_ifdef(CONFIG_RTC_EMUL rtc_emul.c)
zephyr_library_sources_ifdef(CONFIG_RTC_PCF8523 rtc_pcf8523.c)
1 change: 1 addition & 0 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ config RTC_CALIBRATION
calibration.

source "drivers/rtc/Kconfig.emul"
source "drivers/rtc/Kconfig.pcf8523"

endif # RTC
54 changes: 54 additions & 0 deletions drivers/rtc/Kconfig.pcf8523
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# NXP PCF8523 RTC

# Copyright (c) 2019-2023 Henrik Brix Andersen <henrik@brixandersen.dk>
# SPDX-License-Identifier: Apache-2.0

config RTC_PCF8523
bool "NXP PCF8523 RTC driver"
default y
depends on DT_HAS_NXP_PCF8523_ENABLED
select I2C
help
Enable the NXP PCF8523 RTC driver.

if RTC_PCF8523

choice RTC_PCF8523_OFFSET_MODE
prompt "Offset mode"
default RTC_PCF8523_OFFSET_MODE_SLOW
depends on RTC_CALIBRATION
help
Offset register mode selection.

config RTC_PCF8523_OFFSET_MODE_SLOW
bool "Slow"
help
Offset correction is made once per two hours and then correction pulses are applied once
per minute until the programmed correction values have been implemented (MODE = 0).

config RTC_PCF8523_OFFSET_MODE_FAST
bool "Fast"
help
Offset correction is made once per minute and then correction pulses are applied once per
second up to a maximum of 60 pulses. When correction values greater than 60 pulses are
used, additional correction pulses are made in the 59th second (MODE = 1).

endchoice

if RTC_ALARM || RTC_UPDATE

config RTC_PCF8523_THREAD_STACK_SIZE
int "Stack size for the PCF8523 interrupt thread"
default 512
help
Size of the stack used for the thread handling interrupts and dispatching callbacks.

config RTC_PCF8523_THREAD_PRIO
int "Priority for the PCF8523 interrupt thread"
default 0
help
Priority level for the thread handling interrupts and dispatching callbacks.

endif # RTC_ALARM || RTC_UPDATE

endif # RTC_PCF8523
Loading

0 comments on commit 11fc5d0

Please sign in to comment.