symbol-def #1

Merged
kyle merged 8 commits from kyle/pform into master 2025-04-07 21:41:44 +00:00
1 changed files with 7 additions and 2 deletions
Showing only changes of commit cb504011c8 - Show all commits

View File

@ -15,6 +15,12 @@ Number must be in the range 0 to 99."
(ash (floor x 10) 4) (ash (floor x 10) 4)
(logand (rem x 10) #xf))) (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) (defun rtc-set (h m s)
"(rtc-set hr min sec) "(rtc-set hr min sec)
Set the time on a DS3231 RTC. Times are in BCD, so use 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 0 str)
(write-byte s str) (write-byte s str)
(write-byte m str) (write-byte m str)
(write-byte h str))) (write-byte h str))))
(defun rtc-get () (defun rtc-get ()
(with-i2c (str *rtc-port* #x68) (with-i2c (str *rtc-port* #x68)
@ -49,4 +55,3 @@ Set the time using the RTC."
"(now-rtc) "(now-rtc)
Sets the RTC time using the now function." Sets the RTC time using the now function."
(apply rtc-set (now))) (apply rtc-set (now)))