Report
5 years, 11 months ago.

External RTC for LPC11U24

Is there a way to hijack the standard Time API on the LPC11U24 in order to use an external i2c clock? I'd like to be able to use code written for the LPC1768 without re-writing it to use a custom time library.

Comment on this question

1 Answer

5 years, 11 months ago.

I think you might be able to do the following:

I hope that helps,

Adam

I think you indeed will need to modify the mbed library. Small note, you can in the online compiler simply throw away your mbed lib and import: http://mbed.org/users/mbed_official/code/mbed-src/.

posted by Erik Olieman 29 Aug 2013

Thanks! I copied and modified rtc_api.h, rtc_api.c, and rtc_time.c and I was able to read a dummy time. My question would be is this hack very stable? How does that work when both the mbed library, and my hack library supply a version of rtc_api.h and rtc_time.c? Can I be guaranteed my version will always be compiled first? I published the hack library here: http://mbed.org/users/neilt6/code/RTC_Hack/

posted by Neil Thiessen 29 Aug 2013

The linker should give your implementation higher priority since the other comes from a library (mbed). If it was to get confused, it would try to pull in two implementations of the same function and this would cause an error to be thrown from the linker due to duplication definitions. So if something does go wrong you shouldn't get an unstable build, you should get no build at all.

posted by Adam Green 29 Aug 2013