xiaotailang commented on issue #12159:
URL: https://github.com/apache/nuttx/issues/12159#issuecomment-2060229827

   Hi! @acassis Thank you very much for your answer. After examining the 
examples you provided, I noticed that their `file_operations` structures indeed 
implement corresponding `read` and `write` functions. Additionally, upon 
reviewing the `ds1307` implementation in `dsxxxx_rtc_initialize`, I observed 
that it inherits from the implementation in `driver/timer/ds3231.c`. Within 
`ds3231.c`, I encountered the functions `up_rtc_getdatetime` and 
`up_rtc_settime`, which utilize I2C to interact with the RTC. In contrast, the 
`file_operations` for ds1302 do not provide specific implementations but 
instead rely on NuttX system's `xx_rtc_lowerhalf.c` to invoke 
`up_rtc_getdatetime` or `up_rtc_settime`.
   
   This leads me to conclude that NuttX provides a generic management interface 
for RTC devices like the ds1302, such that there is no need to implement the 
`read` and `write` functions within the `file_operations` structure directly 
when calling `i2c_register`. Instead, the system utilizes a pre-established set 
of lower-level functions to handle the RTC interactions over I2C.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to