Rev 21 |
Blame |
Last modification |
View Log
| RSS feed
#ifndef _UART_H
#define _UART_H
#define MAX_SENDE_BUFF 150
#define MAX_EMPFANGS_BUFF 150
extern unsigned char DebugGetAnforderung;
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
extern unsigned volatile char UebertragungAbgeschlossen;
extern unsigned volatile char PC_DebugTimeout;
extern unsigned volatile char NeueKoordinateEmpfangen;
extern unsigned char MeineSlaveAdresse;
extern unsigned char PcZugriff;
extern int Debug_Timer;
extern void UART_Init (void);
extern int uart_putchar (char c);
extern void boot_program_page (uint32_t page, uint8_t *buf);
extern void DatenUebertragung(void);
extern void DecodeNMEA(void);
extern unsigned char MotorTest[4];
struct str_DebugOut
{
unsigned char Digital[13];
unsigned int AnzahlZyklen;
unsigned int Zeit;
unsigned char Sekunden;
unsigned int Analog[16]; // Debugwerte
};
extern struct str_DebugOut DebugOut;
#define _B1(bit) (1 << (bit))
#define _B0(bit) (0 << (bit))
typedef struct {
long x; // in cm (+ = north)
long y; // in cm (+ = east)
long z; // in cm
long vx;
long vy;
long vz;
//long groundSpeed;
//long heading;
uint8_t state; // status of data: 0 = invlid; 1 = valid
uint8_t noSV; // number of sats
} gpsInfo_t;
extern gpsInfo_t lockedPos; // stored position to fly to
extern gpsInfo_t actualPos; // measured position (last gps record)
extern void GPSscanData (void);
extern void GPSupdate(void);
extern void GPSsaveTarget (uint8_t mode);
struct str_Debug
{
unsigned char Digital[2];
unsigned char RemoteTasten;
unsigned int Analog[4];
};
extern struct str_Debug DebugIn;
struct str_VersionInfo
{
unsigned char Hauptversion;
unsigned char Nebenversion;
unsigned char PCKompatibel;
unsigned char Rserved[7];
};
extern struct str_VersionInfo VersionInfo;
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
//#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle
#define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
#if defined (__AVR_ATmega128__)
# define USR UCSR0A
# define UCR UCSR0B
# define UDR UDR0
# define UBRR UBRR0L
# define EICR EICRB
#endif
#if defined (__AVR_ATmega32__)
# define USR UCSRA
# define UCR UCSRB
# define UBRR UBRRL
# define EICR EICRB
# define INT_VEC_RX SIG_UART_RECV
# define INT_VEC_TX SIG_UART_TRANS
#endif
#if defined (__AVR_ATmega644__)
# define USR UCSR0A
# define UCR UCSR0B
# define UDR UDR0
# define UBRR UBRR0L
# define EICR EICR0B
# define TXEN TXEN0
# define RXEN RXEN0
# define RXCIE RXCIE0
# define TXCIE TXCIE0
# define U2X U2X0
# define UCSRB UCSR0B
# define UDRE UDRE0
# define INT_VEC_RX SIG_USART_RECV
# define INT_VEC_TX SIG_USART_TRANS
#endif
#endif //_UART_H