Rev 387 | Rev 728 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 387 | Rev 389 | ||
---|---|---|---|
1 | /**************************************************************************** |
1 | /**************************************************************************** |
2 | * Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje * |
2 | * Copyright (C) 2009 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 150 |
24 | #define TXD_BUFFER_LEN 150 |
25 | 25 | ||
26 | extern volatile uint8_t rxd_buffer_locked; |
26 | extern volatile uint8_t rxd_buffer_locked; |
27 | extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
27 | extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
28 | extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
28 | extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
29 | extern volatile uint8_t ReceivedBytes; |
29 | extern volatile uint8_t ReceivedBytes; |
30 | extern volatile uint8_t *pRxData; |
30 | extern volatile uint8_t *pRxData; |
31 | extern volatile uint8_t RxDataLen; |
31 | extern volatile uint8_t RxDataLen; |
32 | - | ||
33 | extern |
- | |
34 | 32 | ||
35 | /** |
33 | /** |
36 | * init usart1 |
34 | * init usart1 |
37 | */ |
35 | */ |
38 | void usart1_init(); |
36 | void usart1_init(); |
39 | 37 | ||
40 | /** |
38 | /** |
41 | * disable the txd pin of usart1 |
39 | * disable the txd pin of usart1 |
42 | */ |
40 | */ |
43 | void usart1_DisableTXD(void); |
41 | void usart1_DisableTXD(void); |
44 | 42 | ||
45 | /** |
43 | /** |
46 | * enable the txd pin of usart1 |
44 | * enable the txd pin of usart1 |
47 | */ |
45 | */ |
48 | void usart1_EnableTXD(void); |
46 | void usart1_EnableTXD(void); |
49 | 47 | ||
50 | /** |
48 | /** |
51 | * send a <string> throught usart1 |
49 | * send a <string> throught usart1 |
52 | */ |
50 | */ |
53 | void usart1_puts(char*); |
51 | void usart1_puts(char*); |
54 | 52 | ||
55 | /** |
53 | /** |
56 | * transmit interrupt handler |
54 | * transmit interrupt handler |
57 | * unused |
55 | * unused |
58 | */ |
56 | */ |
59 | SIGNAL(SIG_USART1_DATA); |
57 | ISR(SIG_USART1_DATA); |
60 | 58 | ||
61 | /** |
59 | /** |
62 | * receive data through usart1 |
60 | * receive data through usart1 |
63 | * portions taken and adapted from |
61 | * portions taken and adapted from |
64 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c |
62 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c |
65 | */ |
63 | */ |
66 | ISR(SIG_USART1_RECV); |
64 | ISR(SIG_USART1_RECV); |
67 | 65 | ||
68 | /** |
66 | /** |
69 | * Decode the recevied Buffer |
67 | * Decode the recevied Buffer |
70 | * portions taken and adapted from |
68 | * portions taken and adapted from |
71 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
69 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
72 | */ |
70 | */ |
73 | void Decode64(void); |
71 | void Decode64(void); |
74 | 72 | ||
75 | /** |
73 | /** |
76 | * request Data through USART in special MK format by adding checksum and |
74 | * request Data through USART in special MK format by adding checksum and |
77 | * encode data in modified Base64 |
75 | * encode data in modified Base64 |
78 | * portions taken and adapted from |
76 | * portions taken and adapted from |
79 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
77 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
80 | */ |
78 | */ |
81 | void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
79 | void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
82 | 80 | ||
83 | /** |
81 | /** |
84 | * short script to directly send a request thorugh usart including en- and disabling it |
82 | * short script to directly send a request thorugh usart including en- and disabling it |
85 | * where <address> is the address of the receipient, <label> is which data set to request |
83 | * where <address> is the address of the receipient, <label> is which data set to request |
86 | * and <ms> represents the milliseconds delay between data |
84 | * and <ms> represents the milliseconds delay between data |
87 | */ |
85 | */ |
88 | void usart1_request_mk_data(uint8_t, char, uint8_t); |
86 | void usart1_request_mk_data(uint8_t, char, uint8_t); |
89 | 87 |