Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 755 → Rev 756

/branches/V0.68d Code Redesign killagreg/main.c
58,7 → 58,9
#include "timer0.h"
#include "timer2.h"
#include "uart.h"
#if defined (__AVR_ATmega644P__)
#include "uart1.h"
#endif
#include "menu.h"
#include "ubx.h"
#include "fc.h"
95,7 → 97,7
DDRB = 0x00;
PORTB = 0x00;
for(timer = 0; timer < 1000; timer++); // make some delay
if(PINB & (1<<PINB1)) BoardRelease = 11;
if(PINB & (1<<PINB0)) BoardRelease = 11;
else BoardRelease = 10;
 
// set LED ports as output
127,7 → 129,7
TIMER2_Init();
USART0_Init();
 
#if defined (__AVR_ATmega644p__)
#if defined (__AVR_ATmega644P__)
if (BoardRelease == 11) USART1_Init();
#endif
 
213,10 → 215,9
{
//SPI_TransmitByte(); //#
UpdateMotor=0; // reset Flag, is enabled every 2 ms by isr of timer0
//PORTD |= 0x08;
PORTD |= (1<<PORTD4);
MotorControl();
 
//PORTD &= ~0x08;
PORTD &= ~(1<<PORTD4);
SendMotorData();
ROT_OFF;
if(PcAccess) PcAccess--;
/branches/V0.68d Code Redesign killagreg/makefile
1,7 → 1,7
#--------------------------------------------------------------------
# MCU name
#MCU = atmega644
MCU = atmega644p
MCU = atmega644p
F_CPU = 20000000
#-------------------------------------------------------------------
VERSION_MAJOR = 0
19,12 → 19,12
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
#FUSE_SETTINGS = -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
# -u bei neuen Controllern wieder einspielen
HEX_NAME = MEGA644
HEX_NAME = MEGA644_$(COMPASS)
endif
 
ifeq ($(MCU), atmega644p)
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
HEX_NAME = MEGA644p
HEX_NAME = MEGA644p_$(COMPASS)
endif
 
 
37,12 → 37,10
endif
 
ifeq ($(COMPASS), MM3)
HEX_NAME +=MM3
CFLAGS += -DUSE_MM3
endif
 
ifeq ($(COMPASS), CMPS03)
HEX_NAME +=CMPS03
CFLAGS += -DUSE_CMPS03
endif
 
82,18 → 80,17
 
##########################################################################################################
# List C source files here. (C dependencies are automatically generated.)
SRC = main.c uart.c printf_P.c timer0.c timer2.c analog.c menu.c
SRC += twimaster.c rc.c fc.c GPS.c spi.c eeprom.c
SRC = main.c uart.c printf_P.c timer0.c timer2.c analog.c menu.c
SRC += twimaster.c rc.c fc.c GPS.c spi.c eeprom.c mymath.c ubx.c fifo.c
ifeq ($(MCU), atmega644p)
SRC += uart1.c
endif
ifeq ($(COMPASS), MM3)
SRC +=mm3.c
SRC += mm3.c
endif
ifeq ($(COMPASS), CMPS03)
SRC +=cmps03.c
SRC += cmps03.c
endif
SRC += mymath.c ubx.c fifo.c
ifeq ($(MCU), atmega644p)
SRC += uart1.c
endif
##########################################################################################################
 
 
/branches/V0.68d Code Redesign killagreg/rc.c
36,9 → 36,9
 
// Channel 5,6,7 is decoded to servo signals at pin PD5 (J3), PD4(J4), PD3(J5)
// set as output
DDRD |= (1<<DDD5)|(1<<DDD4)|(1<<DDD3);
DDRD |= (1<<DDD5)|(1<<DDD4);
// low level
PORTD &= ~((1<<PORTD5)|(1<<PORTD4)|(1<<PORTD3));
PORTD &= ~((1<<PORTD5)|(1<<PORTD4));
 
// PD3 can't be used in FC 1.1 if 2nd UART is activated
// becouse TXD1 is at that port
141,7 → 141,7
index++; // next channel
// demux sum signal for channels 5 to 7 to J3, J4, J5
if(index == 5) PORTD |= (1<<PORTD5); else PORTD &= ~(1<<PORTD5);
if(index == 6) PORTD |= (1<<PORTD4); else PORTD &= ~(1<<PORTD4);
//if(index == 6) PORTD |= (1<<PORTD4); else PORTD &= ~(1<<PORTD4);
if(BoardRelease == 10)
{
if(index == 7) PORTD |= (1<<PORTD3); else PORTD &= ~(1<<PORTD3);