#ifndef _SCORE_TSK_H_
#define _SCORE_TSK_H_

#include <includes.h>

#define SCORE_TIME_COUNT         3
#define SCORE_COUNT              6

#define SCORE_STATE_OFF         0
#define SCORE_STATE_OK          1
#define SCORE_STATE_FAIL        2
#define SCORE_STATE_SET         3

#define SCORE_QUERY_LEN     8

#define SCORE_EVENT_NONE            0
#define SCORE_EVENT_CHANGE_SPEED    0x01000000
#define SCORE_EVENT_SETUP1          0x02000000
#define SCORE_EVENT_SETUP2          0x02000001
#define SCORE_EVENT_SETUP3          0x02000002
#define SCORE_EVENT_SETUP4          0x02000003
#define SCORE_EVENT_SETUP5          0x02000004
#define SCORE_EVENT_SETUP6          0x02000005
#define SCORE_EVENT_UPDATE_PRICE1          0x02000006
#define SCORE_EVENT_UPDATE_PRICE2          0x02000007
#define SCORE_EVENT_UPDATE_PRICE3          0x02000008

#define SCORE_EVENT_SET_NUMBER      0x03000000

#define SCORE_EVENT_SET_NUMBER1      0x03000000
#define SCORE_EVENT_SET_NUMBER2      0x03000001
#define SCORE_EVENT_SET_NUMBER3      0x03000002
#define SCORE_EVENT_SET_NUMBER4      0x03000003
#define SCORE_EVENT_SET_NUMBER5      0x03000004
#define SCORE_EVENT_SET_NUMBER6      0x03000005

#define SCORE_EVENT_SET_NUMBER_MASK  0x03000000

#define SCORE_EVENT_CHANNEL_MASK     0x0000000F
#define SCORE_EVENT_NUMBER_MASK      0x00003FFF
#define SCORE_EVENT_NUMBER_OFFSET    4
#define SCORE_EVENT_DOT_FLAG         0x00040000
#define SCORE_EVENT_CLEAR_FLAG       0x00080000


#define SCORE_UART_SPEED_COUNT      8
#define K07_RX_TIMEOUT              200
#define K07_SELF_ADDR               254
#define K07_MAX_PACKET_LEN          64
#define K07_REPEAT_COUNT            3


extern CPU_INT32U score_state[SCORE_COUNT];

extern void InitScoreTask(void);
extern void PostScoreEvent(int event);
extern void PostScoreNumber(CPU_INT08U channel, CPU_INT16U number, CPU_INT08U dot);
extern void PostScoreClear(CPU_INT08U channel);

#endif // _SCORE_TSK_H_
