Subversion Repositories Projects

Rev

Rev 734 | Rev 762 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 734 Rev 738
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
6
 *   This program is free software; you can redistribute it and/or modify   *
7
 *   it under the terms of the GNU General Public License as published by   *
7
 *   it under the terms of the GNU General Public License as published by   *
8
 *   the Free Software Foundation; either version 2 of the License.         *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
20
 
20
 
21
#define baud 57600
21
#define baud 57600
22
 
22
 
23
#define RXD_BUFFER_LEN          150
23
#define RXD_BUFFER_LEN          150
24
#define TXD_BUFFER_LEN          10 // not needed
24
#define TXD_BUFFER_LEN          20 // not so much needed
-
 
25
 
-
 
26
//#define REQUEST_OSD_DATA "#aoAm==EX\r" 
-
 
27
#define REQUEST_OSD_DATA "#bo?]==EG\r"
-
 
28
#define REQUEST_DBG_DATA "#ad?]==D{\r"
-
 
29
#define REQUEST_FC_VERSION "#av====Dk\r"
-
 
30
#define REQUEST_NC_VERSION "#bv====Dl\r"
25
 
31
 
26
extern volatile uint8_t rxd_buffer_locked;
32
extern volatile uint8_t rxd_buffer_locked;
27
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN];
33
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN];
28
extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN];
34
extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN];
29
extern volatile uint8_t ReceivedBytes;
35
extern volatile uint8_t ReceivedBytes;
30
extern volatile uint8_t *pRxData;
36
extern volatile uint8_t *pRxData;
31
extern volatile uint8_t RxDataLen;
37
extern volatile uint8_t RxDataLen;
32
 
38
 
33
/**
39
/**
34
 * init usart1
40
 * init usart1
35
 */
41
 */
36
void usart1_init();
42
void usart1_init();
37
 
43
 
38
/**
44
/**
39
 * disable the txd pin of usart1
45
 * disable the txd pin of usart1
40
 */
46
 */
41
void usart1_DisableTXD(void);
47
void usart1_DisableTXD(void);
42
 
48
 
43
/**
49
/**
44
 * enable the txd pin of usart1
50
 * enable the txd pin of usart1
45
 */
51
 */
46
void usart1_EnableTXD(void);
52
void usart1_EnableTXD(void);
47
 
53
 
48
/**
54
/**
49
 * send a <string> throught usart1
55
 * send a PGM<string> throught usart1
50
 */
56
 */
51
void usart1_puts(char*);
57
void usart1_puts_pgm(const char*);
52
 
58
 
53
/**
59
/**
54
 * transmit interrupt handler
60
 * transmit interrupt handler
55
 * unused
61
 * unused
56
 */
62
 */
57
ISR(SIG_USART1_DATA);
63
ISR(SIG_USART1_DATA);
58
 
64
 
59
/**
65
/**
60
 * receive data through usart1
66
 * receive data through usart1
61
 * portions taken and adapted from
67
 * portions taken and adapted from
62
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c
68
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c
63
 */
69
 */
64
ISR(SIG_USART1_RECV);
70
ISR(SIG_USART1_RECV);
65
 
71
 
66
/**
72
/**
67
 * Decode the recevied Buffer
73
 * Decode the recevied Buffer
68
 * portions taken and adapted from
74
 * portions taken and adapted from
69
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
75
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
70
 */
76
 */
71
void Decode64(void);
77
void Decode64(void);
72
 
78
 
73
/**
79
/**
74
 * request Data through USART in special MK format by adding checksum and
80
 * request Data through USART in special MK format by adding checksum and
75
 * encode data in modified Base64
81
 * encode data in modified Base64
76
 * portions taken and adapted from
82
 * portions taken and adapted from
77
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
83
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
78
 */
84
 */
79
void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char);
85
//void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char);
80
 
86
 
81
/**
87
/**
82
 * short script to directly send a request thorugh usart including en- and disabling it
88
 * short script to directly send a request thorugh usart including en- and disabling it
83
 * where <address> is the address of the receipient, <label> is which data set to request
89
 * where <address> is the address of the receipient, <label> is which data set to request
84
 * and <ms> represents the milliseconds delay between data
90
 * and <ms> represents the milliseconds delay between data
85
 */
91
 */
86
void usart1_request_mk_data(uint8_t, char, uint8_t);
92
//void usart1_request_mk_data(uint8_t, char, uint8_t);
87
 
93