Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 29
}
}
4.4.10 Set State Handler
The Set State Handler defines the setting function of an application. It is advised that the handler disable
popups for the duration of the set state.
Use ring edge events if the data being set only has a few selection. Use ring pulse events to track the
number of pulses detected in a predetermines time frame.
Use the acceleration routines to convert the raw pulses detected by the system to predetermined accelerated
values. This allows for fast setting of data. Below is a sample code fragment the uses acceleration to
update data.
case COREEVENT_CW_PULSES:
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ; CW PULSE EVENT
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ; CHIME SUB-OPTION
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// We will be adjusting only the hour data.
// The minute data remains at zero.
// We use the utility to convert the data in COREEventArgument
// into accelerated data. The accelerated data is stored in
// KRESMinBuffer.
UTLACCELERATION_1MIN;
AReg = KRESMinBuffer;
// point to the current hour data of the current time structure
// being displayed
HLReg = OPTTimeStructurePtr;
++HLReg;
BReg = *HLReg;
// go to decimal math operations since our data is in packed BCD.
UTL_DECIMAL_MATH_MODE;
// add the current hour with the accelerated data.
AReg += BReg;
// check if we are still within hour maximum limits. if over,
// then we should wraparound the data.
if( AReg >= OPT_MAX_HOUR )
{
AReg -= OPT_MAX_HOUR;
}
// restore default math operation mode
UTL_BINARY_MATH_MODE;
// store the new hour data into the structure
*HLReg = AReg;
// display the new data and request blinking
goto optSetDisplayRefreshTimeOnly;