]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/rtc_api.c
1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 // Enables clock for RTC
23 LPC_SYSCON
->SYSAHBCLKCTRL0
|= (1 << 23);
31 LPC_RTC
->CTRL
|= (1 << 7);
38 LPC_SYSCON
->SYSAHBCLKCTRL0
&= ~(1 << 23);
39 LPC_RTC
->CTRL
&= ~(1 << 7);
42 int rtc_isenabled(void)
44 return (((LPC_RTC
->CTRL
) & 0x80) != 0);
49 return (time_t)LPC_RTC
->COUNT
;
52 void rtc_write(time_t t
)
55 LPC_RTC
->CTRL
&= ~(1 << 7);
61 LPC_RTC
->CTRL
|= (1 << 7);