실시간 시계 및 달력  
 More...
#include <RTCCalendar.hpp>
|  | 
| virtual void | getUTCFromHardware (uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *min, uint8_t *sec, uint32_t *subsec=NULL)=0 | 
|  | 
| virtual void | setUTCToHardware (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec, int32_t subsec=0)=0 | 
|  | 
| virtual void | setUTCAlarmToHardware (uint8_t hour, uint8_t min, uint8_t sec)=0 | 
|  | 
실시간 시계 및 달력 
RTCCalendar 는 실시간 시계, 달력, 및 알람 기능을 위해 사용됩니다. 사용자 응용이 이해하기 쉬운 struct tm, 및 time_t를 사용하여 하드웨어에 현재 시간 및 알람 시간을 설정할 수 있습니다. 또한 하드웨어 시간을 struct tm, 또는 time_t로 변환하여 사용할 수 있습니다.
RTCCalendar 를 상속받은 시스템은 시스템 시간을 유지합니다. 시스템 시간은 setDateTime(), setUTC(), 또는 settimeofday() 등을 통해서 설정됩니다. 설정된 시스템 시간은 getDateTime(), getUTC(), 또는 gettimeofday() 등을 통해서 조회할 수 있습니다. 시스템 시간은 전원이 유지되는 한, reboot() 을 통한 소프트웨어 리셋에 상관없이 유지됩니다. MCU 종류별 시스템 시간의 초기화 및 유지는 다음과 같습니다.
◆ getDateTime() [1/2]
      
        
          | time_t RTCCalendar::getDateTime | ( |  | ) |  | 
      
 
현재 로컬 시간을 가져옵니다. 
- Returns
- Unix epoch 형태의 현재 로컬 시간
다음과 같이 사용합니다. 
 
 
◆ getDateTime() [2/2]
      
        
          | void RTCCalendar::getDateTime | ( | struct tm & | t | ) |  | 
      
 
현재 로컬 시간을 가져옵니다. 
- Parameters
- 
  
  
다음과 같이 사용합니다. 
 
 
◆ getTimeDiff()
      
        
          | int16_t RTCCalendar::getTimeDiff | ( |  | ) |  | 
      
 
UTC와 로컬 시간과의 차이를 반환합니다. 
- Returns
- UTC와 로컬 시간과의 차이 (단위: 분) 
 
 
◆ getTimeSinceBoot()
  
  | 
        
          | virtual void RTCCalendar::getTimeSinceBoot | ( | struct timeval * | tv | ) |  |  | pure virtual | 
 
 
◆ getUTC() [1/2]
      
        
          | time_t RTCCalendar::getUTC | ( |  | ) |  | 
      
 
현재 UTC 시간을 가져옵니다. 
- Returns
- Unix epoch 형태의 현재 UTC 시간 
 
 
◆ getUTC() [2/2]
      
        
          | void RTCCalendar::getUTC | ( | struct tm & | t | ) |  | 
      
 
현재 UTC 시간을 가져옵니다. 
- Parameters
- 
  
  
 
 
◆ onDateTimeAlarm()
      
        
          | void RTCCalendar::onDateTimeAlarm | ( | void(*)() | func | ) |  | 
      
 
알람 발생시 호출될 콜백함수를 지정합니다. 
- Parameters
- 
  
  
 
 
◆ setDateTime() [1/2]
      
        
          | void RTCCalendar::setDateTime | ( | struct tm & | t | ) |  | 
      
 
현재 로컬 시간을 설정합니다. 
- Parameters
- 
  
    | [in] | t | 설정할 현재 로컬 시간이 저장된 구조체 |  
 
 
 
◆ setDateTime() [2/2]
      
        
          | void RTCCalendar::setDateTime | ( | time_t | t | ) |  | 
      
 
현재 로컬 시간을 설정합니다. 
- Parameters
- 
  
    | [in] | t | 설정할 현재 로컬 시간 (Unix epoch) |  
 
 
 
◆ setDateTimeAlarm() [1/2]
      
        
          | void RTCCalendar::setDateTimeAlarm | ( | struct tm & | t | ) |  | 
      
 
현재 로컬 시간을 기준으로 알람을 설정합니다. 
- Parameters
- 
  
  
 
 
◆ setDateTimeAlarm() [2/2]
      
        
          | void RTCCalendar::setDateTimeAlarm | ( | time_t | t | ) |  | 
      
 
현재 로컬 시간을 기준으로 알람을 설정합니다. 
- Parameters
- 
  
  
 
 
◆ setTimeAlarm()
      
        
          | error_t RTCCalendar::setTimeAlarm | ( | uint8_t | hour, | 
        
          |  |  | uint8_t | min, | 
        
          |  |  | uint8_t | sec = 0 | 
        
          |  | ) |  |  | 
      
 
현재 로컬 시간을 기준으로 알람을 설정합니다. 
- Parameters
- 
  
    | [in] | hour | 알람을 설정할 시 (hour, 범위: 0~23) |  | [in] | min | 알람을 설정할 분 (minute, 범위: 0~59) |  | [in] | sec | 알람을 설정할 초 (second, 범위: 0~59) |  
 
- Note
- 초 단위는 하드웨어에 따라 지원하지 않을 수 있습니다. 
 
 
◆ setTimeDiff()
      
        
          | void RTCCalendar::setTimeDiff | ( | int16_t | diffMinutes | ) |  | 
      
 
UTC와 로컬 시간과의 차이를 분 단위로 지정합니다. 
- Parameters
- 
  
    | [in] | diffMinutes | UTC와 로컬 시간과의 차이 (단위: 분) |  
 
예를 들어, 한국 표준 시를(Korean Standard Time: GMT+09:00) 로컬 시간으로 사용하기 위해서는 diffMinutes 를 540 (9 * 60) 분으로 지정합니다. 이 차이를 설정하지 않으면 UTC와 로컬 시간의 차이는 0입니다. 즉, UTC로 동작하게 됩니다.
 
 
◆ setUTC() [1/2]
      
        
          | void RTCCalendar::setUTC | ( | struct tm & | t | ) |  | 
      
 
현재 UTC 시간을 설정합니다. 
- Parameters
- 
  
    | [in] | t | 설정할 현재 UTC 시간이 저장된 구조체 |  
 
 
 
◆ setUTC() [2/2]
      
        
          | void RTCCalendar::setUTC | ( | time_t | t | ) |  | 
      
 
현재 UTC 시간을 설정합니다. 
- Parameters
- 
  
    | [in] | t | 설정할 현재 UTC 시간 (Unix epoch) |  
 
 
 
The documentation for this class was generated from the following file: