Subversion Repositories Projects

Rev

Rev 1199 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1199 - 1
/****************************************************************************
1437 - 2
 *   Copyright (C) 2011-2012 by Claas Anders "CaScAdE" Rathje               *
1199 - 3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-epilepsy/                 *
5
 *                                                                          *
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   *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
20
 
21
#include "main.h"
22
 
23
#ifndef _USART0_H
24
#define _USART0_H
25
 
26
#ifndef USART0_BAUD
27
#define USART0_BAUD 57600
28
#endif
29
 
30
 
31
#define RXD_BUFFER_LEN          180
32
#define TXD_BUFFER_LEN          20 // not so much needed since only requesting stuff
33
 
34
extern volatile uint8_t rxd_buffer_locked;
35
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN];
36
extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN];
37
extern volatile uint8_t ReceivedBytes;
38
extern volatile uint8_t *pRxData;
39
extern volatile uint8_t RxDataLen;
40
 
41
/**
42
 * init usart0
43
 */
44
void usart0_init();
45
 
46
 
47
/**
48
 * send a single <character> through usart0
49
 */
50
void usart0_putc(unsigned char character);
51
 
52
/**
53
 * send a <string> throught usart0
54
 */
55
void usart0_puts(char *s);
56
 
57
/**
58
 * send a PGM<string> throught usart0
59
 */
60
void usart0_puts_pgm(const char* string);
61
 
62
 
63
/**
64
 * Decode the recevied Buffer
65
 * portions taken and adapted from
66
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
67
 */
68
void Decode64(void);
69
 
70
 
71
/**
72
 * request Data through USART in special MK format by adding checksum and
73
 * encode data in modified Base64
74
 * portions taken and adapted from
75
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c
76
 */
77
void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char);
78
 
79
/**
80
 * short script to directly send a request thorugh usart including en- and disabling it
81
 * where <address> is the address of the receipient, <label> is which data set to request
82
 * and <ms> represents the milliseconds delay between data
83
 */
84
void usart0_request_mk_data(uint8_t, char, uint8_t);
85
 
86
 
87
#endif