1 /*******************************************************************
2 bluetooth test aplication - bth chat
4 bth_h8s2638.h - bth chat - write a recieve data to RS232 link
5 as recieve data include char is 'a' aplication
8 Copyright (C) 2006 by Petr Kovacik petr_kovacik@gmail.com
10 *******************************************************************/
15 #include <periph/sci_channels.h>
16 #include <periph/sci_rs232.h>
17 #include <system_def.h>
19 #include "bth_h8s2638.h"
27 #include "bth_inface.h"
28 #include "bth_fce_out.h"
31 //*******************************************************
33 void unhandled_exception(void) __attribute__ ((interrupt_handler));
35 * init - shaddow registers, outputs..
37 * Initializes P1 and P3 shaddow registers,
38 * sets PJ.1, PJ.2, PJ.3 LED as outputs,
39 * initialises interrupt vector.
43 /* initialises interrupt vector */
44 excptvec_initfill(unhandled_exception, 0);
47 /*Interrupt routines*/
48 void unhandled_exception(void)
51 //***************************************#define _USE_EXR_LEVELS 1*****************
61 /********************************************************************************/
63 // *SYS_SYSCR|=(SYSCR_INTM1m);
65 // *INT_IPRK=0x67; /*highest priority SCI 1 and 2*/
67 *DIO_PEDDR=0xff; /*output gate*/
68 *DIO_PEDR=0x60; /*0x0-LED - light all; 0x6 -ENA,ENB=1, LE33CD=0*/
74 sci_rs232_setmode(115200, 0, 0, 2); //bth
75 sci_rs232_setmode(19200, 0, 0, sci_rs232_chan_default); //PC
78 bth_inface_setup(0); /*init I/O data buffer for bluetooth*/
79 bth_init(); /*init bth device*/
82 bth_init_pkt_controll();
83 bth_parametr_slave(); /* set up bluetooth device to slave*/
84 bth_start_TPU_counter();
87 zn_bth=sci_rs232_recch(2);
88 }while(bth_get_timer()<3);
93 zn=sci_rs232_recch(sci_rs232_chan_default);
94 zn_bth=sci_rs232_recch(2);
100 zn_bth=sci_rs232_recch(2);
103 bth_conv_char_text(zn_bth);
104 bth_recieve_packet(zn_bth);
107 if((zz=bth_inface_recch(0))>-1)
111 bth_inface_sendch('a',0); bth_inface_sendch('h',0); bth_inface_sendch('o',0);
112 bth_inface_sendch('j',0); bth_inface_sendch('\n',0);
114 l2cap_send_data(0, 0);
115 sci_rs232_sendch(zz,sci_rs232_chan_default);
118 // sci_rs232_sendch('.',sci_rs232_chan_default);