version 1.4, 2007/04/22 22:48:43
|
version 1.5, 2007/04/22 23:18:05
|
Line 62 void bt_send_cmd(char * cmd)
|
Line 62 void bt_send_cmd(char * cmd)
|
cmd[0] = len; |
cmd[0] = len; |
for(i=1; i<len-2; i++) |
for(i=1; i<len-2; i++) |
sum += cmd[i]; |
sum += cmd[i]; |
|
sum = -sum; |
cmd[i++] = (char)(sum>>8); |
cmd[i++] = (char)(sum>>8); |
cmd[i++] = (char)(sum & 0xff); |
cmd[i++] = (char)(sum & 0xff); |
|
|
bt_send(cmd, len); |
bt_send(cmd, len+1); |
} |
|
|
|
void prep_terminal () |
|
{ |
|
char cmd[30]; |
|
|
|
aic_initialise(); |
|
interrupts_enable(); |
|
systick_init(); |
|
sound_init(); |
|
nxt_avr_init(); |
|
display_init(); |
|
nxt_motor_init(); |
|
i2c_init(); |
|
bt_init(); |
|
cmd[1] = 3; |
|
bt_send_cmd(cmd); // open port query |
|
|
|
display_goto_xy(0,0); |
|
display_clear(1); |
|
|
|
terminal_prepped = 1; |
|
} |
|
|
|
void deprep_terminal () |
|
{ |
|
terminal_prepped = 0; |
|
} |
} |
|
|
void do_bluetooth () |
void do_bluetooth () |
Line 123 void do_bluetooth ()
|
Line 97 void do_bluetooth ()
|
} |
} |
} |
} |
|
|
|
void prep_terminal () |
|
{ |
|
char cmd[30]; |
|
|
|
aic_initialise(); |
|
interrupts_enable(); |
|
systick_init(); |
|
sound_init(); |
|
nxt_avr_init(); |
|
display_init(); |
|
nxt_motor_init(); |
|
i2c_init(); |
|
bt_init(); |
|
cmd[1] = 0x21; strcpy(cmd+2, "Gforth NXT"); bt_send_cmd(cmd); do_bluetooth(); |
|
cmd[1] = 0x1C; cmd[2] = 1; bt_send_cmd(cmd); do_bluetooth(); // make visible |
|
cmd[1] = 0x03; bt_send_cmd(cmd); // open port query |
|
|
|
display_goto_xy(0,0); |
|
display_clear(1); |
|
|
|
terminal_prepped = 1; |
|
} |
|
|
|
void deprep_terminal () |
|
{ |
|
terminal_prepped = 0; |
|
} |
|
|
long key_avail () |
long key_avail () |
{ |
{ |
if(!terminal_prepped) prep_terminal(); |
if(!terminal_prepped) prep_terminal(); |
Line 161 void emit_char(char x)
|
Line 163 void emit_char(char x)
|
needs_update = 0; |
needs_update = 0; |
} else |
} else |
needs_update = 1; |
needs_update = 1; |
bt_send(&x, 1); |
if(bt_mode) |
|
bt_send(&x, 1); |
} |
} |
|
|
void type_chars(char *addr, unsigned int l) |
void type_chars(char *addr, unsigned int l) |