blob: 7b89edb4b18ec8edcc388027170a511b7a26124d [file] [log] [blame]
zongqiang.zhang0c6a0882019-08-07 14:48:21 +08001//пªÆÕË®¿Ø³ÌÐò
2#include "stdio.h"
3#include "stdlib.h"
4#include "string.h"
5#include "sp_config.h"
6#include "sp_display.h"
7#include "sp_data.h"
8#include "sp_util.h"
9#include "sp_consume.h"
10#include "sp_communicate.h"
11
12static sp_pos_t POS;
13
14int main(void)
15{
16 uint32 tick = 0;
17 uint32 lasttick = 0;
18 sp_cardworkstate_t cardWorkState;
19 MEMCLEAR(&POS, sizeof(POS));
20 MEMCLEAR(&cardWorkState, sizeof(cardWorkState));
21 sp_init();
22 sp_key_init();
23 Delay_ms(DELAY_TIME1s);
24 sp_load_config(&POS);
25
26 show_home(&POS);
27
28 while(1)
29 {
30 tick = sp_get_ticker();
31 sp_feed_dog();
32 sp_valve_control();
33 sp_confirm_paymode(&POS, &cardWorkState);
34 sp_communicate(&POS);
35 if(POS.paymode == PAYMODE_QRCODE)
36 {
zongqiang.zhangcb1f2692019-11-26 17:17:14 +080037 sp_qrcode_handle(&POS, &cardWorkState);
zongqiang.zhang0c6a0882019-08-07 14:48:21 +080038 }
39 else
40 {
41 if(tick - lasttick >= DELAY_TIME100ms)
42 {
43 lasttick = tick;
44 sp_test_card_state(&POS, &cardWorkState, tick);
45 sp_card_handle(&POS, &cardWorkState);
46 }
47 }
48 }
49}