1307注册代码注释
This commit is contained in:
1 parent
69f409e893
commit
f740550370
1 file changed
+6
-6
@@ -27,7 +27,7 @@
|
|||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <drivers/rtc.h>
|
||||||
|
|
||||||
#define DBG_TAG "DS1307"
|
#define DBG_TAG "DS1307"
|
||||||
#ifdef BRD_RTC_DS1307_DEBUG
|
#ifdef BRD_RTC_DS1307_DEBUG
|
||||||
@@ -215,7 +215,7 @@ static rt_err_t ds1307_write_tm(struct tm *tm)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RTC ops */
|
/* RTC ops *//*
|
||||||
static rt_err_t ds1307_rtc_init(void)
|
static rt_err_t ds1307_rtc_init(void)
|
||||||
{
|
{
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
@@ -272,9 +272,9 @@ static const struct rt_rtc_ops ds1307_rtc_ops =
|
|||||||
RT_NULL,
|
RT_NULL,
|
||||||
ds1307_rtc_get_timeval,
|
ds1307_rtc_get_timeval,
|
||||||
ds1307_rtc_set_timeval,
|
ds1307_rtc_set_timeval,
|
||||||
};
|
};*/
|
||||||
|
|
||||||
static rt_rtc_dev_t ds1307_rtc_dev;
|
//static rt_rtc_dev_t ds1307_rtc_dev;
|
||||||
|
|
||||||
/* Initialization and registration */
|
/* Initialization and registration */
|
||||||
static int rt_hw_ds1307_rtc_init(void)
|
static int rt_hw_ds1307_rtc_init(void)
|
||||||
@@ -297,12 +297,12 @@ static int rt_hw_ds1307_rtc_init(void)
|
|||||||
rt_thread_startup(ds1307.thd_soft_update_sec);
|
rt_thread_startup(ds1307.thd_soft_update_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_err_t result = rt_hw_rtc_register(&ds1307_rtc_dev, "ds1307", RT_DEVICE_FLAG_RDWR, &ds1307);
|
/* rt_err_t result = rt_hw_rtc_register(&ds1307_rtc_dev, "ds1307", RT_DEVICE_FLAG_RDWR, &ds1307);
|
||||||
if (result != RT_EOK)
|
if (result != RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_E("RTC register failed: %d", result);
|
LOG_E("RTC register failed: %d", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
LOG_I("DS1307 RTC initialized successfully on %s", ds1307.iic_name);
|
LOG_I("DS1307 RTC initialized successfully on %s", ds1307.iic_name);
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
|
|||||||
Reference in new issue
Block a user