User`s guide

Architecture
5-32 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
T h e n u m b e r o f a v a i l a b le s of t w a r e t i m e r s i s s e t t o 10 u s in g th e m a c r o
NB_TIMER_SOFT. The tick period is set to 2ms using the macro TICK_PERIOD.
These macros are defined in “config.h” and should not be modified.
The software timers are dedicated to MMI applications and dynamically attributed by the
software timer management. Some functions and macros enables the MMI applications
to control these kind of timers.
Table 5-4. Functions and macros controlling the software timers
Table 5-5. Event returned from the software timers
5.4.7 Keyboard
Management
The keyboard management is charged with the debouncing and the generation of
events from actions on keys. It is located in the file “mmi\kbd\keypad.c” and can be con-
figured differently with the help of the file “conf\conf_kbd”.
Only one keyboard event is mailed “EVT_KEY_PRESSED” but its associated parameter
qualify the key actions:
macro KEY_STATUS(param) gets the changing status of a key
(KBD_KEY_PRESSED, KBD_KEY_REPEAT, …).
macro KEY_ID(param) identifies the key whose status has just changed (For key
definition, refer to Section 6.2.6).
Table 5-6. Keyboard messages
Functions or macros Description
ts_alloc() Allocates one of the software timers still available and returns a 8-bit
ID. The ID is equal to “UNDEFINED_TIMER” if failure in allocation.
If success, this ID must be stored by the MMI application in order to
control its attributed timer(s) and to identify from which timers the
event comes from.
Note: No risk of timer identity usurpation after a cold reset since
the value of “UNDEFINED_TIMER” is 0.
ts_set_time(U8 id, U32 delay) Sets the 32-bit delay value, multiple of 2ms (tick period), with the id
of the software timer to configure.
ts_stop(U8 id) Stops the time comparison and the software timer. This prevents the
delivery of overflow events from this timer.
Can only be reactivated with the help of the function “ts_set_time()”.
Ts_free(id) Releases one of the software timers and sets the variable storing
the id to the value UNDEFINED_TIMERin order to prevent from
identity usurpation.
Event Description
EVT_TIMER Returns the 8-bit ID of the software timer that has just overflowed
8-bit parameter value Description
KBD_KEY_PRESSED Key has just been pressed
KBD_KEY_REPEAT Key has been pressed long enough to enter in the repeat mode.
This message is periodically sent while this key stands pressed.
KBD_KEY_LONGPRESSED Key has been pressed long enough to send this message once.
KBD_KEY_RELEASED Key has just been released after a key pressed.
KBD_KEY_REPEAT_RELEASED Key has just been released from a repeat mode.