Download MC998 Library/API Reference Manual
Transcript
sys_msg is the system message inquiring subroutine which is supposed to be called in
the main loop of message handler. System will enter power saving mode unless there
is unmasked message available.
int sys_msg (unsigned long if_stay_awake);
Parameters:
if_stay_awake : set the power-saving mode while there is no unmasked message
SM_STAY_AWAKE: system frozen but all the peripherals still working.
SM_GOTO_SLEEP: system enters maximum power saving mode but some
peripherals such as UART, IC card sockets would not work.
Return value:
System message word is returned, which could be intepreted by typ_msg_word
Example:
#include “api.h”
typ_msg_word smw;
…….
sm_setting(MSG_KEY_DOWN | MSG_KEY_UP);
while (1) {
/* main loop of message handler */
smw.s_word = sys_msg(SM_GOTO_SLEEP);
if (smw.bits.key_available) {
/* your keydealers here: */
}
if(smw.bits.card_insert) {
/* your IC card 2 dealer here */
}
}
1.3 System Message Mask Setting
sm_setting sets the message mask so that sys_msg would not return on unwanted
messages.
unsigned long sm_setting(unsigned long msg_msk);
Parameters:
msg_msk : message mask is set by bit-OR’ing the following masks:
MSK_KEY_DOWN
MSK_KEY_UP
MSK_KEY_AVAILABLE
MSK_CARD_INSERT
MSK_CARD_GONE
MSK_TIME_OUT
MSK_RF_NEW