OSDN Git Service

b92b8d4282d3f3ff6e115db43a516e480004b257
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / src / nxtvm / platform / nxt / bt.h
1 #ifndef BT_H_
2 #define BT_H_
3
4 #include "mytypes.h"
5
6 #define MSG_BEGIN_INQUIRY 0
7 #define MSG_CANCEL_INQUIRY 1
8 #define MSG_CONNECT 2
9 #define MSG_OPEN_PORT 3
10 #define MSG_LOOKUP_NAME 4
11 #define MSG_ADD_DEVICE 5
12 #define MSG_REMOVE_DEVICE 6
13 #define MSG_DUMP_LIST 7
14 #define MSG_CLOSE_CONNECTION 8
15 #define MSG_ACCEPT_CONNECTION 9
16 #define MSG_PIN_CODE 10
17 #define MSG_OPEN_STREAM 11
18 #define MSG_START_HEART 12
19 #define MSG_HEARTBEAT 13
20 #define MSG_INQUIRY_RUNNING 14
21 #define MSG_INQUIRY_RESULT 15
22 #define MSG_INQUIRY_STOPPED 16
23 #define MSG_LOOKUP_NAME_RESULT 17
24 #define MSG_LOOKUP_NAME_FAILURE 18
25 #define MSG_CONNECT_RESULT 19
26 #define MSG_RESET_INDICATION 20
27 #define MSG_REQUEST_PIN_CODE 21
28 #define MSG_REQUEST_CONNECTION 22
29 #define MSG_LIST_RESULT 23
30 #define MSG_LIST_ITEM 24
31 #define MSG_LIST_DUMP_STOPPED 25
32 #define MSG_CLOSE_CONNECTION_RESULT 26
33 #define MSG_PORT_OPEN_RESULT 27
34 #define MSG_SET_DISCOVERABLE 28
35 #define MSG_CLOSE_PORT 29
36 #define MSG_CLOSE_PORT_RESULT 30
37 #define MSG_PIN_CODE_ACK 31
38 #define MSG_DISCOVERABLE_ACK 32
39 #define MSG_SET_FRIENDLY_NAME 33
40 #define MSG_SET_FRIENDLY_NAME_ACK 34
41 #define MSG_GET_LINK_QUALITY 35
42 #define MSG_LINK_QUALITY_RESULT 36
43 #define MSG_SET_FACTORY_SETTINGS 37
44 #define MSG_SET_FACTORY_SETTINGS_ACK 38
45 #define MSG_GET_LOCAL_ADDR 39
46 #define MSG_GET_LOCAL_ADDR_RESULT 40
47 #define MSG_GET_FRIENDLY_NAME 41
48 #define MSG_GET_DISCOVERABLE 42
49 #define MSG_GET_PORT_OPEN 43
50 #define MSG_GET_FRIENDLY_NAME_RESULT 44
51 #define MSG_GET_DISCOVERABLE_RESULT 45
52 #define MSG_GET_PORT_OPEN_RESULT 46
53 #define MSG_GET_VERSION 47
54 #define MSG_GET_VERSION_RESULT 48
55 #define MSG_GET_BRICK_STATUSBYTE_RESULT 49
56 #define MSG_SET_BRICK_STATUSBYTE_RESULT 50
57 #define MSG_GET_BRICK_STATUSBYTE 51
58 #define MSG_SET_BRICK_STATUSBYTE 52
59
60 #define   BT_RX_PIN  AT91C_PIO_PA21
61 #define   BT_TX_PIN  AT91C_PIO_PA22
62 #define   BT_SCK_PIN AT91C_PIO_PA23
63 #define   BT_RTS_PIN AT91C_PIO_PA24
64 #define   BT_CTS_PIN AT91C_PIO_PA25 
65 #define   BT_CS_PIN   AT91C_PIO_PA31
66 #define   BT_RST_PIN  AT91C_PIO_PA11
67 #define   BT_ARM7_CMD_PIN  AT91C_PIO_PA27
68
69 void bt_init(void);
70 void bt_clear_arm7_cmd(void);
71 void bt_set_arm7_cmd(void);
72 void bt_set_reset_high(void);
73 void bt_set_reset_low(void);
74 void bt_start_ad_converter(void);
75 void bt_send(U8 *buf, U32 len);
76 void bt_receive(U8 * buf);
77 U32 bt_get_mode(void);
78
79 #endif /*BT_H_*/