82 DEBUGOUT(
"Time: %.2d:%.2d:%.2d %.2d/%.2d/%.4d\r\n",
94 DEBUGOUT(
" %.2d:%.2d:%.2d (DOY: %.3d)",
110 RTC_EV_TIMESTAMP_T timestamp;
120 if ((sec % 5) == 0) {
125 for (i = 0; i < RTC_EV_CHANNEL_NUM; i++) {
126 if (Chip_RTC_EV_GetChannelStatus(
LPC_RTC, (IP_RTC_EV_CHANNEL_T) i)) {
128 Chip_RTC_EV_GetFirstTimeStamp(
LPC_RTC, (IP_RTC_EV_CHANNEL_T) i, ×tamp);
129 DEBUGOUT(
"Event occurred at channel %.1d: ", i);
131 Chip_RTC_EV_GetLastTimeStamp(
LPC_RTC, (IP_RTC_EV_CHANNEL_T) i, ×tamp);
134 counter = Chip_RTC_EV_GetCounter(
LPC_RTC, (IP_RTC_EV_CHANNEL_T) i);
135 DEBUGOUT(
", Counter = %.1d\r\n", counter);
136 Chip_RTC_EV_ClearChannelStatus(
LPC_RTC, (RTC_EV_CHANNEL_T) i);
140 if (Chip_RTC_EV_GetStatus(
LPC_RTC)) {
160 DEBUGSTR(
"The RTC operates on a 1 Hz clock.\r\n" \
161 "Register writes can take up to 2 cycles.\r\n" \
162 "It will take a few seconds to fully\r\n" \
163 "initialize it and start it running.\r\n\r\n");
165 DEBUGSTR(
"We'll print a timestamp every 5 seconds.\r\n");
166 DEBUGSTR(
"When a positive edge occurred on J5.18 or negative edge occurred on J5.17 pin, " \
167 "the first and last timestamp will be printed out.\r\n");
193 Chip_RTC_EV_Config(
LPC_RTC, RTC_EV_CHANNEL_1, RTC_ERCTRL_POL_POSITIVE | RTC_ERCTRL_INPUT_EN);
194 Chip_RTC_EV_Config(
LPC_RTC, RTC_EV_CHANNEL_2, RTC_ERCTRL_POL_POSITIVE);
195 Chip_RTC_EV_Config(
LPC_RTC, RTC_EV_CHANNEL_3, RTC_ERCTRL_POL_NEGATIVE | RTC_ERCTRL_INPUT_EN);
198 Chip_RTC_EV_SetMode(
LPC_RTC, RTC_EV_MODE_ENABLE_64HZ);
201 NVIC_EnableIRQ((IRQn_Type) RTC_IRQn);