--- /dev/null
+/*******************************************************************
+ bluetooth library
+
+ bth_inface.c - fce for reading and getting and putting chars to a data queue
+
+ Copyright (C) 2006 by Petr Kovacik petr_kovacik@gmail.com
+
+ *******************************************************************/
+
+#include <bth_config.h>
+#ifdef BTH_LX
+#include <types.h>
+
+#else
+#include "types.h"
+#include <stdio.h>
+#endif
+
+#include <stdlib.h>
+#include "bth_inface.h"
+#include "bth_inface.h"
+
+#ifndef CONFIG_BLUETOOTH_LINUX
+#include <periph/sci_rs232.h>
+#endif
+
+/* the number of communication structures i.e. how many channels can be used for communication. It alse specifies howmany
+ independent couples of I/O buffers is here.*/
+/*pocet komunikacnich struktur - tj. pres kolik kanalu je mozno komunikovat,
+ to zaroven znamena, kolik je nezavislych dvojic I/O bufferu*/
+ bth_inface_info_t bth_inface_chan_array[BTH_INFACE_CHANAL];
+
+//-- --- ----- ----- ---- ------ ----- -- ---- --
+//-- --- ----- ----- ---- ------ ----- -- ---- --
+
+/**
+ * fce write one char to in-buffer. Fce return a code of char. If a value is -1 its signal for error
+*/
+int bth_inface_r_isr(int chan, int val)
+{
+ if(bth_inface_que_put(&(bth_inface_chan_array[chan].bth_inface_que_in),val)<0)
+ {return (-1);};
+ return (val);
+}
+
+/**
+ * fce read one char of out-buffer. Fce return a code of char. If is a value -1 than is not new char
+*/
+int bth_inface_t_isr(int chan)
+{
+ short val;
+ if((val=bth_inface_que_get(&(bth_inface_chan_array[chan].bth_inface_que_out)))>=0)
+ {
+ return val;
+ }
+ return (-1);
+}
+
+/**
+ * init buffer for first chanal - 0 (nm. is index of array)
+*/
+int bth_inface_setup(int chan)
+{
+ bth_inface_info_t *bth_inface;
+ bth_inface = &(bth_inface_chan_array[chan]); // the number of communication interfaces bth - PC
+ bth_inface->bth_inface_que_in.buf_beg = bth_inface->bth_inface_buff_in;
+ bth_inface->bth_inface_que_in.buf_end = bth_inface->bth_inface_que_in.buf_beg+BTH_INFACE_BUF_LEN;
+ bth_inface->bth_inface_que_in.ip = bth_inface->bth_inface_que_in.buf_beg;
+ bth_inface->bth_inface_que_in.op = bth_inface->bth_inface_que_in.buf_beg;
+
+ bth_inface->bth_inface_que_out.buf_beg = bth_inface->bth_inface_buff_out;
+ bth_inface->bth_inface_que_out.buf_end = bth_inface->bth_inface_que_out.buf_beg+BTH_INFACE_BUF_LEN;
+ bth_inface->bth_inface_que_out.ip = bth_inface->bth_inface_que_out.buf_beg;
+ bth_inface->bth_inface_que_out.op = bth_inface->bth_inface_que_out.buf_beg;
+
+ return 1;
+}
+
+
+/****************************************************************************/
+/****************************************************************************/
+
+
+/**
+ * init using in your program
+*/
+/*
+int main()
+{
+ bth_inface_setup(0);
+ bth_inface_r_isr(&bth_inface_chan_array[0],'c'); //internal-fce
+ bth_inface_recch(0); //read one char of buffer
+ bth_inface_sendch('a', 0); //write one char to out buffer for chanal 0
+ bth_inface_t_isr(&bth_inface_chan_array[0]); //internal-fce
+
+ return 0;
+};
+*/
+