View Full Version : ICCProp - Imagecraft C Library for MAXIM DS1302 Real Time Clock
03-31-2009, 08:46 PM
Attached is my first attempt at a library for ICC.
Also attached separately is the readme.txt file that list all of the functions and parameters.
There are 31 functions in total. I have tried to cover all of the capabilities of the DS1302
including burst mode reads and writes of the clock an RAM areas.
I put extra effort into documenting the source code both for myself and others that might
want to use or improve upon the library.
The code has not been particularly optimized for size or speed, but that shouldn't matter
much for RTC use.
For those of you with ICC and a DS1302 (or a PPDB!), please give it a workout before I
include it in the OBEX.
04-01-2009, 01:20 AM
Nice effort. I have a PPDB specifically for C dev and will give it a shot tomorrow ... have other plans today.
Are you looking at writing driver libs for other PPDB devices? I don't want to unintentionally duplicate your efforts.
One thing you (and other developers) should seriously consider since the library will be included in ICC at some point is having separate .c modules for the accessor functions and/or creating macros for the simpler ones. ICC will link code "on demand" but only to .c module granularity ... that is, if one function in a module is used, all functions are included in the image. I keep forgetting this too.
Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
04-01-2009, 04:49 AM
I haven't yet decided what device library I'll work on next, but you raise an interesting point about duplicating efforts. I guess even the worst case of having multiple libraries to choose from isn't so bad. ;)
I did give some thought about the granularity of this library, but I wanted to get something posted for review as quickly as possible. I'm going to convert many of the simple functions to macros in the next version.
Beyond that, how do you recommend separating functions into modules that the end user can make sense of?
Is there a good "standard" way to tie separate .c modules together so the end user doesn't have to remember what functions are in what modules?
BTW, I already found one small bug in the ds1302_setDateTime() function which sometimes doesn't retain the trickle charge setting properly. It's fixed already for the next posted version.
Post Edited (CSmith) : 3/31/2009 8:54:18 PM GMT