Subversion Repositories FlightCtrl

Rev

Rev 685 | Blame | Last modification | View Log | RSS feed

#ifndef _UART_H
#define _UART_H

#define TXD_BUFFER_LEN  150
#define RXD_BUFFER_LEN  150

#define DUB_KEY_UP     4
#define DUB_KEY_DOWN   8
#define DUB_KEY_RIGHT  32
#define DUB_KEY_LEFT   16
#define DUB_KEY_FIRE   64

#include <inttypes.h>

void BearbeiteRxDaten(void);

extern unsigned char DebugGetAnforderung;

//Baud rate of the USART
#define USART0_BAUD 57600


extern void USART0_Init (void);

extern unsigned volatile char txd_buffer[TXD_BUFFER_LEN];
extern unsigned volatile char rxd_buffer[RXD_BUFFER_LEN];

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 unsigned char RemotePollDisplayLine;
extern int Debug_Timer;

extern int16_t uart_putchar (int8_t c);
extern void boot_program_page (uint32_t page, uint8_t *buf);
extern void DatenUebertragung(void);

extern void BearbeiteRxDaten(void);
extern unsigned char MotorTest[4];
extern unsigned char DubWiseKeys[4];
struct str_DebugOut
{
 unsigned char Digital[2];
 unsigned int Analog[32];    // Debugwerte
};

extern struct str_DebugOut    DebugOut;

struct str_ExternControl
{
 uint8_t        Digital[2];
 uint8_t        RemoteButtons;
 int8_t         Pitch;
 int8_t         Roll;
 int8_t         Yaw;
 uint8_t        Gas;
 int8_t         Hight;
 uint8_t        free;
 uint8_t        Frame;
 uint8_t        Config;
};
extern struct str_ExternControl   ExternControl;

struct str_VersionInfo
{
  unsigned char Hauptversion;
  unsigned char Nebenversion;
  unsigned char PCKompatibel;
  unsigned char Rserved[7];
};
extern struct str_VersionInfo VersionInfo;


#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