;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 2000 - 2002 TIMEX Corporation.
; 
; This document is the property of, and contains information proprietary to
; TIMEX Corporation.  It is to be returned upon request.  Reproduction by any
; means, disclosure, or use of its contents for other than the expressed
; purpose for which it is loaned, without the written consent of TIMEX
; Corporation, is strictly prohibited.
;
; File Name : ctmr.h
;
; Purpose   : Countdown and Interval Timer Header File.
;
; File Change History:
;
;             08/03/2000 HSB - Created ctmr.h for m841
;
;   M851 Development:
;
;             12/11/2001 FSU - Modified for M851.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;==============================================================================
;
; CORE REDEFINITIONS
;
;==============================================================================

;------------------------------------------------------------------------------
; State Redefinitions
;------------------------------------------------------------------------------

CTMRBANNERSTATE                 equ     COREBANNERSTATE
CTMRDEFAULTSTATE                equ     COREDEFAULTSTATE
CTMRSETBANNERSTATE              equ     CORESETBANNERSTATE
CTMRSETSTATE                    equ     CORESETSTATE
CTMRPOPUPSTATE                  equ     COREPOPUPSTATE
CTMRUNUSEDPOPUPSTATE            equ     COREMISCSTATE0


;------------------------------------------------------------------------------
; Event Redefinitions
;------------------------------------------------------------------------------

CTMR_STATEENTRY                 equ     COREEVENT_STATEENTRY
CTMR_TMOUTDONELORES             equ     COREEVENT_TIMEOUTDONE_LOWRES
CTMR_TMOUTDONEHIRES             equ     COREEVENT_TIMEOUTDONE_HIGHRES
CTMR_CROWNHOME                  equ     COREEVENT_CROWN_HOME
CTMR_CROWNSET                   equ     COREEVENT_CROWN_SET1
CTMR_CWPULSES                   equ     COREEVENT_CW_PULSES
CTMR_CCWPULSES                  equ     COREEVENT_CCW_PULSES
CTMR_CWEDGE                     equ     COREEVENT_CW_EDGE_TRAILING 
CTMR_CCWEDGE                    equ     COREEVENT_CCW_EDGE_TRAILING
CTMR_MODEDEPRESS                equ     COREEVENT_SWITCH1DEPRESS
CTMR_STOPRESETDEPRESS           equ     COREEVENT_SWITCH2DEPRESS
CTMR_STARTSPLITDEPRESS          equ     COREEVENT_SWITCH3DEPRESS
CTMR_MODERELEASE                equ     COREEVENT_SWITCH1RELEASE
CTMR_STOPRESETRELEASE           equ     COREEVENT_SWITCH2RELEASE
CTMR_STARTSPLITRELEASE          equ     COREEVENT_SWITCH3RELEASE
CTMR_POPUPCANCEL                equ     COREEVENT_MELODYPOPUPCANCEL
CTMR_DISPUPDTMRRES              equ     COREEVENT_DISPLAY_UPDATE_TMRRES
CTMR_MELODYDONE                 equ     COREEVENT_MELODY_DONE
CTMR_ANYSWITCHDEPRESS           equ     COREEVENT_ANYSWITCHDEPRESS
CTMR_ANYSWITCHRELEASE           equ     COREEVENT_ANYSWITCHRELEASE

;------------------------------------------------------------------------------
; Switch Mask Redefinitions
;------------------------------------------------------------------------------

CTMRSWITCHMASK_MODE             equ     bCORESwitch1
CTMRSWITCHMASK_STOPRESET        equ     bCORESwitch2
CTMRSWITCHMASK_STARTSPLIT       equ     bCORESwitch3
CTMRSWITCHMASK_CW               equ     bCORECWSwitch
CTMRSWITCHMASK_CCW              equ     bCORECCWSwitch
CTMRSWITCHMASK_EL               equ     bCOREELSwitch


;==============================================================================
;
; LCD REDEFINITIONS
;
;==============================================================================

;------------------------------------------------------------------------------
; Large Font Main Dot Matrix Display Positions
;------------------------------------------------------------------------------

CTMRLDMPOSITIONHOUR             equ     LCDBIGCHARDMCOL1
CTMRLDMPOSITIONCOLON            equ     LCDBIGCHARDMCOL15
CTMRLDMPOSITIONMINUTE           equ     LCDBIGCHARDMCOL17
CTMRLDMPOSITIONSECOND           equ     LCDMAINDMLINE2COL32


;------------------------------------------------------------------------------
; L1 Small Font Dot Matrix Display Positions
;------------------------------------------------------------------------------

CTMRDML1POSITIONHOUR            equ     LCDMAINDMLINE1COL1
CTMRDML1POSITIONCOLON           equ     LCDMAINDMLINE1COL13
CTMRDML1POSITIONMINUTE          equ     LCDMAINDMLINE1COL15
CTMRDML1POSITIONDOT             equ     LCDMAINDMLINE1COL27
CTMRDML1POSITIONSECOND          equ     LCDMAINDMLINE1COL29


;------------------------------------------------------------------------------
; Upper Dot Matrix Display Positions
;------------------------------------------------------------------------------

CTMRUPPERDMCOL1                 equ     LCDUPPERDMCOL1 


;------------------------------------------------------------------------------
; 9 Segmet Display Positions
;------------------------------------------------------------------------------

CTMRSEGDIGIT1                   equ     LCDSEGDIGIT1
CTMRSEGDIGIT2                   equ     LCDSEGDIGIT2
CTMRSEGDIGIT3                   equ     LCDSEGDIGIT3
CTMRSEGDIGIT4                   equ     LCDSEGDIGIT4
CTMRSEGDIGIT5                   equ     LCDSEGDIGIT5
CTMRSEGDIGIT6                   equ     LCDSEGDIGIT6

;------------------------------------------------------------------------------
; Miscellaneous
;------------------------------------------------------------------------------

; Initial position where timer name will be displayed.
CTMRNAMEINITIALPOSITION         equ     LCDMAINDMLINE2COL1

;==============================================================================
;
; TIMEOUT DURATION DEFINITIONS (Updated every 8Hz)
;
;==============================================================================

;------------------------------------------------------------------------------
; High Resolution (Updated every 8Hz)
;------------------------------------------------------------------------------

CTMRHIRESTO_250MSECONDS         equ     TIMEOUTHIRES_P250SEC
CTMRHIRESTO_1SECOND             equ     TIMEOUTHIRES_1SEC
CTMRHIRESTO_1P5SECONDS          equ     TIMEOUTHIRES_1P5SEC
CTMRHIRESTO_2SECONDS            equ     TIMEOUTHIRES_2SEC
CTMRHIRESTO_3SECONDS            equ     TIMEOUTHIRES_3SEC

;------------------------------------------------------------------------------
; Low Resolution (Updated every 1Hz)
;------------------------------------------------------------------------------

CTMRLORESTO_10SECONDS           equ     10



;==============================================================================
;
; MISCELLANEOUS DEFINITIONS
;
;==============================================================================

;------------------------------------------------------------------------------
; Timeout Argument.  Indicates which timeout was expired.
;------------------------------------------------------------------------------

CTMRTMOUTHOLDTORESET            equ     0
CTMRTMOUTDELAYBEFORESCANNING    equ     1
CTMRTMOUTSCANNINGENABLED        equ     2
CTMRTMOUTNEXTINTERVAL           equ     3

CTMRTMOUTNULL					equ		0FFh

;------------------------------------------------------------------------------
; Setting Items
;------------------------------------------------------------------------------

CTMRSETMINHOUR                  equ     0
CTMRSETSECOND                   equ     1
CTMRSETACTIONATEND              equ     2

CTMRMAXSETITEMS                 equ     3

CTMRFIRSTSETITEM                equ     CTMRSETMINHOUR
CTMRLASTSETITEM                 equ     CTMRSETACTIONATEND

;------------------------------------------------------------------------------
; Action At End
;------------------------------------------------------------------------------

CTMRSTOPATEND                   equ     0
CTMRREPEATATEND                 equ     1
CTMRCHRONOATEND                 equ     2

CTMRMAXACTIONATENDITEM          equ     3

CTMRFIRSTACTIONATENDITEM        equ     CTMRSTOPATEND
CTMRLASTACTIONATENDITEM         equ     CTMRCHRONOATEND            
                                                                   
CTMRACTIONATENDMASKBITS         equ     (bCTMRActionAtEnd0 | bCTMRActionAtEnd1)

;------------------------------------------------------------------------------
; Offsets to a second, minute, hour data structure.
; The base address is pointing to the seconds data.
;------------------------------------------------------------------------------

CTMRSECONDOFFSET                equ     0
CTMRMINUTEOFFSET                equ     1
CTMRHOUROFFSET                  equ     2

;------------------------------------------------------------------------------
; Popup type that would occur in popup state.
;------------------------------------------------------------------------------

CTMRSTOPATENDALERT              equ     0
CTMRREPEATATENDALERT            equ     1
CTMRINTERVALALERT               equ     2           ; Only in interval timer.



;------------------------------------------------------------------------------
; Miscellaneous
;------------------------------------------------------------------------------

; Indicates to update the display of HMS data.
CTMRUPDATEHMSDATA               equ     (bKTMRSecondUpd | bKTMRMinuteUpd | bKTMRHourUpd)

; Maximum repeat number for a repeat at end action.
CTMRMAXREPEATCOUNT              equ     200

; Number of characters in TMR Name.
CTMRNAMELENGTH                  equ     9               

; Size of each timer record.  This consist of Status flag, HMS data and 9 character name.
CTMRRECORDSIZE                  equ     13

