+++ /dev/null
-/*******************************************************************
- bluetooth test aplication - bth chat
-
- bth_h8s2638.h - bth chat - write a recieve data to RS232 link
- as recieve data include char is 'a' aplication
- send 'ahoj'
-
- Copyright (C) 2006 by Petr Kovacik petr_kovacik@gmail.com
-
- *******************************************************************/
-#ifdef BTH_LX
-#include <types.h>
-#include <cpu_def.h>
-#include <h8s2638h.h>
-#include <periph/sci_channels.h>
-#include <periph/sci_rs232.h>
-#include <system_def.h>
-#include <assert.h>
-#include "bth_h8s2638.h"
-
-
-#else
-#include "types.h"
-#include <stdio.h>
-#endif
-
-#include "bth_inface.h"
-#include "bth_fce_out.h"
-
-#ifdef BTH_LX
-//*******************************************************
-
-void unhandled_exception(void) __attribute__ ((interrupt_handler));
-/**
- * init - shaddow registers, outputs..
- *
- * Initializes P1 and P3 shaddow registers,
- * sets PJ.1, PJ.2, PJ.3 LED as outputs,
- * initialises interrupt vector.
- */
-void init()
-{
- /* initialises interrupt vector */
- excptvec_initfill(unhandled_exception, 0);
-}
-
-/*Interrupt routines*/
-void unhandled_exception(void)
-{
-};
-//***************************************#define _USE_EXR_LEVELS 1*****************
-#endif
-
-
-
-int main()
-{
- int zz,zn_bth;
-
-
- /********************************************************************************/
-#ifdef BTH_LX
-// *SYS_SYSCR|=(SYSCR_INTM1m);
-// *INT_IPRH=0x34;
-// *INT_IPRK=0x67; /*highest priority SCI 1 and 2*/
-
- *DIO_PEDDR=0xff; /*output gate*/
- *DIO_PEDR=0x60; /*0x0-LED - light all; 0x6 -ENA,ENB=1, LE33CD=0*/
-
- cli();
- init();
- sti();
-
- sci_rs232_setmode(115200, 0, 0, 2); //bth
- sci_rs232_setmode(19200, 0, 0, sci_rs232_chan_default); //PC
-
-#endif
- bth_inface_setup(0); /*init I/O data buffer for bluetooth*/
- bth_init(); /*init bth device*/
-
-
- bth_init_pkt_controll();
- bth_parametr_slave(); /* set up bluetooth device to slave*/
- bth_start_TPU_counter();
-
- do{
- zn_bth=sci_rs232_recch(2);
- }while(bth_get_timer()<3);
- bth_start();
-
- /*
- do{
- zn=sci_rs232_recch(sci_rs232_chan_default);
- zn_bth=sci_rs232_recch(2);
- }while (zn==-1);
- */
-
-
- do{
- zn_bth=sci_rs232_recch(2);
- if(zn_bth!=-1)
- {
- bth_conv_char_text(zn_bth);
- bth_recieve_packet(zn_bth);
- };
-
- if((zz=bth_inface_recch(0))>-1)
- {
- if(zz=='a')
- {
- bth_inface_sendch('a',0); bth_inface_sendch('h',0); bth_inface_sendch('o',0);
- bth_inface_sendch('j',0); bth_inface_sendch('\n',0);
- };
- l2cap_send_data(0, 0);
- sci_rs232_sendch(zz,sci_rs232_chan_default);
- };
- bth_send_queue();
-// sci_rs232_sendch('.',sci_rs232_chan_default);
- }while(1);
- return 0;
-};