version 1.6, 2007/04/23 21:42:59
|
version 1.7, 2007/04/24 20:18:57
|
Line 94 void do_bluetooth ()
|
Line 94 void do_bluetooth ()
|
cmd[1] = 0xB; // open stream |
cmd[1] = 0xB; // open stream |
cmd[2] = handle; |
cmd[2] = handle; |
bt_send_cmd(cmd); |
bt_send_cmd(cmd); |
display_char('#'); display_update(); |
|
while (*AT91C_US1_TNCR != 0); |
while (*AT91C_US1_TNCR != 0); |
// while(!(*AT91C_PIOA_PDSR & BT_BC4_CMD_PIN)); |
// while(!(*AT91C_PIOA_PDSR & BT_BC4_CMD_PIN)); |
bt_set_arm7_cmd(); |
bt_set_arm7_cmd(); |
display_char('!'); display_update(); |
display_char(')'); display_update(); |
bt_mode = 1; |
bt_mode = 1; |
|
// bt_send("Hello Bluetooth\n", 16); |
} else { |
} else { |
display_char('('); display_update(); |
display_char('('); display_update(); |
} |
} |
Line 126 void prep_terminal ()
|
Line 126 void prep_terminal ()
|
do { |
do { |
bt_receive(cmd); |
bt_receive(cmd); |
} while((cmd[0] != 3) && (cmd[1] != 0x14)); |
} while((cmd[0] != 3) && (cmd[1] != 0x14)); |
cmd[1] = 0x21; strcpy(cmd+2, "Gforth NXT"); bt_send_cmd(cmd); do_bluetooth(); |
// cmd[1] = 0x21; strcpy(cmd+2, "NXT"); bt_send_cmd(cmd); do_bluetooth(); |
cmd[1] = 0x1C; cmd[2] = 1; bt_send_cmd(cmd); do_bluetooth(); // make visible |
cmd[1] = 0x1C; cmd[2] = 1; bt_send_cmd(cmd); do_bluetooth(); // make visible |
cmd[1] = 0x36; cmd[2] = 1; bt_send_cmd(cmd); do_bluetooth(); // don't break stream mode |
cmd[1] = 0x36; cmd[2] = 1; bt_send_cmd(cmd); do_bluetooth(); // don't break stream mode |
cmd[1] = 0x03; bt_send_cmd(cmd); // open port query |
cmd[1] = 0x03; bt_send_cmd(cmd); // open port query |
Line 168 Cell getkey()
|
Line 168 Cell getkey()
|
} |
} |
|
|
while(!key_avail()); |
while(!key_avail()); |
|
|
while((key=bt_getkey())==0); |
while((key=bt_getkey())==0); |
display_char(key); display_update(); |
display_char(key); display_update(); |
|
|
Line 184 void emit_char(char x)
|
Line 184 void emit_char(char x)
|
needs_update = 0; |
needs_update = 0; |
} else |
} else |
needs_update = 1; */ |
needs_update = 1; */ |
if(bt_mode) |
if(bt_mode) bt_send(&x, 1); |
bt_send(&x, 1); |
|
} |
} |
|
|
void type_chars(char *addr, unsigned int l) |
void type_chars(char *addr, unsigned int l) |
{ |
{ |
if(bt_mode) |
if(bt_mode) bt_send(addr, l); |
bt_send(addr, l); |
|
/* int i; |
/* int i; |
for(i=0; i<l; i++) |
for(i=0; i<l; i++) |
emit_char(addr[i]); */ |
emit_char(addr[i]); */ |