sumikchakka / jallib

Automatically exported from code.google.com/p/jallib
0 stars 0 forks source link

Refactoring rtcc_hw library #155

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The library 'rtcc_hw', supporting the RTCC module in some 18F PICs, needs to be 
enhanced in a number of ways. For example:
- names of procedures/functions 
- parameter passing 
- functionality esp. for alarm handling 
- documentation (user guidance)

Original issue reported on code.google.com by robhamerling on 7 Apr 2011 at 6:00

GoogleCodeExporter commented 9 years ago
The following changes are planned:
1. Abandon the use of byte*3 variables for date, time and alarmtime and in 
stead use 3 separate byte variables for the parts: no confusion about sequence.
2. Abandon use of 'hhmmss' and 'yymmdd' in function names and use 'time' and 
'date' in stead. 
3. Abandon use of suffixes '_bcd' and '_bin' in names of functions and 
procedures. It should be clear from the purpose of the function or procedure if 
bcd or binary notation is used.
4. Rename functions which return a relative value to rtc_get_secondofday, 
rtc_get_minuteofday, rtc_get_dayofweek (etc, when more functions of such are 
added).
(to be continued)
Rob.

Original comment by robhamerling on 7 Apr 2011 at 7:50

GoogleCodeExporter commented 9 years ago
(continuation of comment #2)
5. Add procedure to disable RTCC module
6. Preserve state of RTCC module (keep disabled or enabled) with calls of
   set_date, _time or _alarm functions
7. Add procedures to get and set alarm date

Original comment by robhamerling on 8 Apr 2011 at 11:21

GoogleCodeExporter commented 9 years ago
A first version of the refactored library is committed under a temporary name: 
rtcc_hw_ng.jal. The sample program 18f26j11_rtcc_hw_kbd_lcd.jal is modified for 
use of the new library. 
Most points of the previous 2 comments have been implemented, and the embedded 
documentation is extended. The procedures and functions for the alarm facility 
have been revised significantly to provide a functionality resembling regular 
alarm-clocks without restrictions to make use of all possibilities of the RTCC 
module.  
Some more tests are needed to check if everything works as designed and all 
desired functional improvements are in place before replacing the old library.  

Original comment by robhamerling on 10 Apr 2011 at 6:57

GoogleCodeExporter commented 9 years ago
Added 2 functions for date caluculations:
 - get_dayofmonth() returns number of days since first of 'this' month: 0..30
 - get_dayofyear() returns number of days since 1st of Jan 'this' year: 0..365 
Library seems complete and tests did not reveal problems: issue closed. 

Original comment by robhamerling on 12 Apr 2011 at 9:53