From cb504011c89ab8e46954f5bfb8ea1a5f37faf544 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Fri, 4 Apr 2025 16:48:43 -0700 Subject: [PATCH] updating rtc code --- lisp/rtc.lsp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/rtc.lsp b/lisp/rtc.lsp index 953fd59..3f4d7a5 100644 --- a/lisp/rtc.lsp +++ b/lisp/rtc.lsp @@ -15,6 +15,12 @@ Number must be in the range 0 to 99." (ash (floor x 10) 4) (logand (rem x 10) #xf))) +(defun rtc-p () + "(rtc-p) +Returns t if the RTC is connected." + (with-i2c (str *rtc-port* #x68) + (streamp str))) + (defun rtc-set (h m s) "(rtc-set hr min sec) Set the time on a DS3231 RTC. Times are in BCD, so use @@ -27,7 +33,7 @@ for 12:34:00." (write-byte 0 str) (write-byte s str) (write-byte m str) - (write-byte h str))) + (write-byte h str)))) (defun rtc-get () (with-i2c (str *rtc-port* #x68) @@ -49,4 +55,3 @@ Set the time using the RTC." "(now-rtc) Sets the RTC time using the now function." (apply rtc-set (now))) -