Subversion Repositories MK3Mag


Rev 72 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _UART_H_
#define _UART_H_

#include <inttypes.h>
#include "printf_P.h"

#define NICK 0
#define ROLL 1

#define BAUD_RATE 57600

extern uint16_t DebugData_Timer;

void USART0_Init (void);
void USART0_EnableTXD(void);
void USART0_DisableTXD(void);
void USART0_TransmitTxData(void);
void USART0_ProcessRxData(void);
void USART0_Putchar(char c);
void USART0_Print(int8_t *msg);

#define printf_P(format, args...)   _printf_P(&USART0_Putchar, format , ## args)
#define printf(format, args...)     _printf_P(&USART0_Putchar, PSTR(format) , ## args)

typedef struct
        uint8_t Digital[2];
        uint16_t Analog[32];    // Debugvalues
}  DebugOut_t;

extern DebugOut_t DebugOut;

typedef struct
        int16_t Attitude[2];  // nick and roll angle in 0.1 deg
        uint8_t UserParam[2];
        uint8_t CalState;
        uint8_t Orientation;
}  ExternData_t;

extern ExternData_t  ExternData;

typedef struct
        uint8_t Digital[2];
        uint8_t RemoteButtons;
        int8_t  Nick;
        int8_t  Roll;
        int8_t  Yaw;
        uint8_t Gas;
        int8_t  Height;
        uint8_t free;
        uint8_t Frame;
        uint8_t Config;
}  ExternControl_t;

extern ExternControl_t  ExternControl;

typedef struct
        uint8_t SWMajor;
        uint8_t SWMinor;
        uint8_t ProtoMajor;
        uint8_t ProtoMinor;
        uint8_t SWPatch;
        uint8_t Reserved[5];
}  UART_VersionInfo_t;

extern uint16_t PC_Connected;
extern uint16_t FC_Connected;

#endif //_UART_H_