Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file radiot96.c \brief DataRadio T96-SR Radio Driver. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'radiot96.c' |
||
5 | // Title : DataRadio T96-SR Radio Driver |
||
6 | // Author : Pascal Stang - Copyright (C) 2003 |
||
7 | // Created : 09/01/2003 |
||
8 | // Revised : 09/03/2003 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR Series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | // This code is distributed under the GNU Public License |
||
14 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
15 | // |
||
16 | //***************************************************************************** |
||
17 | |||
18 | //----- Include Files --------------------------------------------------------- |
||
19 | #include <avr/io.h> // include I/O definitions (port names, pin names, etc) |
||
20 | #include <avr/interrupt.h> // include interrupt support |
||
21 | |||
22 | #include "global.h" // include our global settings |
||
23 | #include "buffer.h" // include buffer support |
||
24 | #include "timer128.h" // include timer function library |
||
25 | #include "uart2.h" // include software UART driver |
||
26 | #include "stxetx.h" // include STX/ETX protocol library |
||
27 | #include "radiot96.h" |
||
28 | |||
29 | // global variables |
||
30 | |||
31 | // functions |
||
32 | void radioInit(void) |
||
33 | { |
||
34 | // Initialize radio interface |
||
35 | // set baud rate of comm |
||
36 | uartSetBaudRate(COMM_UART, 19200); |
||
37 | // initialize stxetx to use the UART for sending data |
||
38 | #if COMM_UART == 0 |
||
39 | stxetxInit(uart0SendByte); |
||
40 | #else |
||
41 | stxetxInit(uart1SendByte); |
||
42 | #endif |
||
43 | // prepare PTT |
||
44 | cbi(RADIO_PTT_PORT, RADIO_PTT_PIN); |
||
45 | sbi(RADIO_PTT_DDR, RADIO_PTT_PIN); |
||
46 | } |
||
47 | |||
48 | void radioPTT(u08 pttFlag) |
||
49 | { |
||
50 | if(pttFlag) |
||
51 | sbi(RADIO_PTT_PORT, RADIO_PTT_PIN); |
||
52 | else |
||
53 | cbi(RADIO_PTT_PORT, RADIO_PTT_PIN); |
||
54 | } |
||
55 | |||
56 | void radioSend(u08 status, u08 type, u08 datalength, u08* dataptr) |
||
57 | { |
||
58 | radioPTT(TRUE); |
||
59 | timerPause(RADIO_PPT_DELAYMS); |
||
60 | stxetxSend(status, type, datalength, dataptr); |
||
61 | radioPTT(FALSE); |
||
62 | } |
||
63 | |||
64 | cBuffer* radioGetRxBuffer(void) |
||
65 | { |
||
66 | return uartGetRxBuffer(COMM_UART); |
||
67 | } |
Powered by WebSVN v2.8.3