- #include "My_head.h"
- #include "key.h"
- /*************************************************/
- extern BYTE Bh_Into_Consume(void);
- BYTE Do_BhConNextKey_Even_12(BYTE Key)
- {
- BYTE i;
- if(Key > KEY_MAX-1)return(Key);
- Stop_Timer(WAIT_PRESSKEY_Tevent);
- Set_TimerEvent(WAIT_PRESSKEY_Tevent,WAIT_PRESSKEY_TIME);
- switch(Key)
- {
- case KEY_0 : Key =0; break;
- case KEY_1 : Key =1; break;
- case KEY_2 : Key =2; break;
- case KEY_3 : Key =3; break;
- case KEY_4 : Key =4; break;
- case KEY_5 : Key =5; break;
- case KEY_6 : Key =6; break;
- case KEY_7 : Key =7; break;
- case KEY_8 : Key =8; break;
- case KEY_9 : Key =9; break;
- //case KEY_FUN:Key =19;break;
- case KEY_ENTER1:
- case KEY_ENTER2:if((i=Bh_Into_Consume())!=SUCCESS)
- {
- do_buzzer(BUZZER_ERROR);
- Dis_Err(i);
- Stop_Timer(DISPLAY_DELAYEVENT_Tevent);//msut!!
- Set_TimerEvent(DISPLAY_DELAYEVENT_Tevent,DISPLAY_DELAYEVENT_TIME);
- Set_TimerEvent(WAIT_CARD_Tevent,WAIT_CARDCONSUME_TIME);//(1)
- SetCurState(IDEL_STATUS);
- return(FAILURE);
- }
- return(0);
- case KEY_CANCEL:Renew_To_AllInit();
- return(0);
- case KEY_BACK: if(!My_Back_Key())
- {
- Renew_To_AllInit();
- return(0);
- }
- My_Dis_KeyBuf();
- return(0);
- default:return(Key);
- }
- if(!My_Save_Key(Key))do_buzzer(BUZZER_ALARM);
- else My_Dis_KeyBuf();
- return(SUCCESS);
- }
- BYTE Bh_Into_Consume(void)
- {
- Bh_Money pdata bh_money;
- BYTE i;
- if(thekey.key_count>4)
- {
- return(KEY_VALERR_CODE);
- }
- thekey.key_val = 0L;
- for(i=0;i<thekey.key_count;i++) //Count_BhCode()
- {
- thekey.key_val *= 10;
- thekey.key_val += thekey.key_buf[i];
- }
- if((thekey.key_val<0L)||(thekey.key_val>100))
- {
- return(BH_CODE_ERR);
- }
- if((i=ReadBh_Money_From_Memory(&bh_money,thekey.key_val))!=SUCCESS)
- {
- return(i);
- }
- thekey.key_val=bh_money.money;
- if(thekey.key_val<1)
- {
- return(BH_CODE_ERR);
- }
- KeyVal_Tobuf();
- Dis_KeyBuf();
- Dis_consume_Led(TRUE);
- Do_DisLed_Flash(0xff,0x00,25);
- //Stop_Timer(DIS_CLOCKEVENT_Tevent);
- Set_TimerEvent(WAIT_CARD_Tevent,WAIT_CARDCONSUME_TIME);
- Stop_Timer(WAIT_EXIT_Tevent);
- Set_TimerEvent(WAIT_EXIT_Tevent,WAIT_EXIT_TIME);
- SetCurState(CONSUME_STATUS);
- return(SUCCESS);
- }