/ * @brief * Configure RTC device * * @details * * @note * * @param[in] dev * Pointer to device descriptor * * @param[in] cmd * RTC control command * * @param[in] args * Arguments * * @return * Error code ******************************************************************************/
| 79 | * Error code |
| 80 | ******************************************************************************/ |
| 81 | static rt_err_t rt_rtc_control(rt_device_t dev, int cmd, void *args) |
| 82 | { |
| 83 | RT_ASSERT(dev != RT_NULL); |
| 84 | |
| 85 | switch (cmd) |
| 86 | { |
| 87 | case RT_DEVICE_CTRL_RTC_GET_TIME: |
| 88 | *(time_t *)args = rtc_time + RTC_CounterGet(); |
| 89 | rtc_debug("RTC: get rtc_time %x + %x\n", rtc_time, RTC_CounterGet()); |
| 90 | break; |
| 91 | |
| 92 | case RT_DEVICE_CTRL_RTC_SET_TIME: |
| 93 | { |
| 94 | rtc_time = *(time_t *)args; |
| 95 | rtc_debug("RTC: set rtc_time %x\n", rtc_time); |
| 96 | |
| 97 | /* Reset counter */ |
| 98 | RTC_CounterReset(); |
| 99 | } |
| 100 | break; |
| 101 | } |
| 102 | |
| 103 | return RT_EOK; |
| 104 | } |
| 105 | |
| 106 | /***************************************************************************//** |
| 107 | * @brief |
nothing calls this directly
no test coverage detected