-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathuowi.h
66 lines (58 loc) · 1.58 KB
/
uowi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
******************************************************************************
* @file uowi.h
* @author Khusainov Timur
* @version 0.0.0.0
* @date 31.10.2012
* @brief
******************************************************************************
* @attention
* <h2><center>© COPYRIGHT [email protected] </center></h2>
******************************************************************************
*/
#ifndef UOWI_H
#define UOWI_H
typedef enum
{
UOWI_STATE_NOINIT = 0,
UOWI_STATE_DETECT_WAIT,
UOWI_STATE_DETECT_COMPLETE,
UOWI_STATE_DETECT_ERROR,
UOWI_STATE_SEND_START,
UOWI_STATE_SEND_WAIT,
UOWI_STATE_SEND_COMPLETE,
UOWI_STATE_SEND_ERROR,
UOWI_STATE_RECV_WAIT,
UOWI_STATE_RECV_COMPLETE,
UOWI_STATE_STATUS_BUSY,
UOWI_STATE_STATUS_EMPTY,
UOWI_STATE_STATUS_ERROR
} tUOWI_State;
extern volatile tUOWI_State UOWI_State;
enum
{
UOWI_CMD_DETECT = (0xf0),
UOWI_CMD_WRITE_BIT0 = (0x00),
UOWI_CMD_WRITE_BIT1 = (0xff),
UOWI_CMD_READ_BIT = (0xff),
UOWI_CMD_READ_STATE = (0xff),
UOWI_RET_DETECT_ERROR = (0xf0),
UOWI_RET_READ_BIT1 = (0xff),
UOWI_RET_STATE_EMPTY = (0xff)
};
enum
{
UOWI_TX_DATA_MAX_LENGTH = (12),
UOWI_RX_DATA_MAX_LENGTH = (16)
};
void UOWI_Init();
void UOWI_StartDetect();
void UOWI_StartSend();
void UOWI_SendData(const uint8_t *pdata, uint16_t txlen, uint16_t rxlen);
void UOWI_RecvData(uint8_t *pdata, uint16_t rxlen);
tUOWI_State UOWI_GetState();
uint8_t UOWI_IsDetect();
uint8_t UOWI_IsSend();
uint8_t UOWI_IsRecv();
uint8_t UOWI_IsBusy();
#endif // UOWI_H