Rev 738 | Rev 783 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 738 | Rev 762 | ||
---|---|---|---|
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 | ||
- | 21 | #ifndef _USART1_H |
|
- | 22 | #define _USART1_H |
|
20 | 23 | ||
21 | #define baud 57600 |
24 | #define baud 57600 |
22 | 25 | ||
23 | #define RXD_BUFFER_LEN 150 |
26 | #define RXD_BUFFER_LEN 150 |
24 | #define TXD_BUFFER_LEN 20 // not so much needed |
27 | #define TXD_BUFFER_LEN 20 // not so much needed |
25 | 28 | ||
26 | //#define REQUEST_OSD_DATA "#aoAm==EX\r" |
29 | //#define REQUEST_OSD_DATA "#aoAm==EX\r" |
27 | #define REQUEST_OSD_DATA "#bo?]==EG\r" |
30 | #define REQUEST_OSD_DATA "#bo?]==EG\r" |
28 | #define REQUEST_DBG_DATA "#ad?]==D{\r" |
31 | #define REQUEST_DBG_DATA "#ad?]==D{\r" |
29 | #define REQUEST_FC_VERSION "#av====Dk\r" |
32 | #define REQUEST_FC_VERSION "#av====Dk\r" |
30 | #define REQUEST_NC_VERSION "#bv====Dl\r" |
33 | #define REQUEST_NC_VERSION "#bv====Dl\r" |
31 | 34 | ||
32 | extern volatile uint8_t rxd_buffer_locked; |
35 | extern volatile uint8_t rxd_buffer_locked; |
33 | extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
36 | extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
34 | extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
37 | extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
35 | extern volatile uint8_t ReceivedBytes; |
38 | extern volatile uint8_t ReceivedBytes; |
36 | extern volatile uint8_t *pRxData; |
39 | extern volatile uint8_t *pRxData; |
37 | extern volatile uint8_t RxDataLen; |
40 | extern volatile uint8_t RxDataLen; |
38 | 41 | ||
39 | /** |
42 | /** |
40 | * init usart1 |
43 | * init usart1 |
41 | */ |
44 | */ |
42 | void usart1_init(); |
45 | void usart1_init(); |
43 | 46 | ||
44 | /** |
47 | /** |
45 | * disable the txd pin of usart1 |
48 | * disable the txd pin of usart1 |
46 | */ |
49 | */ |
47 | void usart1_DisableTXD(void); |
50 | void usart1_DisableTXD(void); |
48 | 51 | ||
49 | /** |
52 | /** |
50 | * enable the txd pin of usart1 |
53 | * enable the txd pin of usart1 |
51 | */ |
54 | */ |
52 | void usart1_EnableTXD(void); |
55 | void usart1_EnableTXD(void); |
53 | 56 | ||
54 | /** |
57 | /** |
55 | * send a PGM<string> throught usart1 |
58 | * send a PGM<string> throught usart1 |
56 | */ |
59 | */ |
57 | void usart1_puts_pgm(const char*); |
60 | void usart1_puts_pgm(const char*); |
58 | 61 | ||
59 | /** |
62 | /** |
60 | * transmit interrupt handler |
63 | * transmit interrupt handler |
61 | * unused |
64 | * unused |
62 | */ |
65 | */ |
63 | ISR(SIG_USART1_DATA); |
66 | ISR(SIG_USART1_DATA); |
64 | 67 | ||
65 | /** |
68 | /** |
66 | * receive data through usart1 |
69 | * receive data through usart1 |
67 | * portions taken and adapted from |
70 | * portions taken and adapted from |
68 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c |
71 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c |
69 | */ |
72 | */ |
70 | ISR(SIG_USART1_RECV); |
73 | ISR(SIG_USART1_RECV); |
71 | 74 | ||
72 | /** |
75 | /** |
73 | * Decode the recevied Buffer |
76 | * Decode the recevied Buffer |
74 | * portions taken and adapted from |
77 | * portions taken and adapted from |
75 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
78 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
76 | */ |
79 | */ |
77 | void Decode64(void); |
80 | void Decode64(void); |
78 | 81 | ||
79 | /** |
82 | /** |
80 | * request Data through USART in special MK format by adding checksum and |
83 | * request Data through USART in special MK format by adding checksum and |
81 | * encode data in modified Base64 |
84 | * encode data in modified Base64 |
82 | * portions taken and adapted from |
85 | * portions taken and adapted from |
83 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
86 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
84 | */ |
87 | */ |
85 | //void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
88 | //void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
86 | 89 | ||
87 | /** |
90 | /** |
88 | * short script to directly send a request thorugh usart including en- and disabling it |
91 | * short script to directly send a request thorugh usart including en- and disabling it |
89 | * where <address> is the address of the receipient, <label> is which data set to request |
92 | * where <address> is the address of the receipient, <label> is which data set to request |
90 | * and <ms> represents the milliseconds delay between data |
93 | * and <ms> represents the milliseconds delay between data |
91 | */ |
94 | */ |
92 | //void usart1_request_mk_data(uint8_t, char, uint8_t); |
95 | //void usart1_request_mk_data(uint8_t, char, uint8_t); |
- | 96 | ||
- | 97 | #endif |
|
93 | 98 |