/branches/dongfang_FC_fixedwing/arduino_atmega328/README.txt |
---|
5,7 → 5,8 |
PB0/ICP1 PPM receiver signal in |
PB1,2 Digital outputs (output.c) |
PB3,4,5 Left free for SPI use |
PB3,4 Left free for SPI use |
PB5 Green Arduino LED (use as LED2). |
PB6,7 Xtal |
PC0,1,2,3 unused |
20,8 → 21,8 |
PD3/OC2B: CLK of 4017 change B3 |
PD4: RESET of 4017 |
PD5 Beeper |
PD6,7 LEDs |
PD6 Red LED |
PD7 unusd |
ADC6 Battery voltage divider |
ADC7 Airspeed sensor |
/branches/dongfang_FC_fixedwing/arduino_atmega328/commands.h |
---|
2,6 → 2,7 |
#define _COMMANDS_H |
#include <inttypes.h> |
#define COMMAND_NONE 0 |
#define COMMAND_GYROCAL 1 |
#define COMMAND_CHMOD 2 |
/branches/dongfang_FC_fixedwing/arduino_atmega328/controlMixer.c |
---|
54,7 → 54,7 |
int16_t targetvalue; |
for (i=0; i < VARIABLE_COUNT; i++) { |
targetvalue = RC_getVariable(i); |
if (i<2) debugOut.analog[18+i] = targetvalue; |
// if (i<2) debugOut.analog[18+i] = targetvalue; |
if (targetvalue < 0) |
targetvalue = 0; |
if (variables[i] < targetvalue && variables[i] < 255) |
/branches/dongfang_FC_fixedwing/arduino_atmega328/main.c |
---|
114,7 → 114,7 |
} else { |
debugOut.digital[0] &= ~DEBUG_MAINLOOP_TIMER; |
} |
J4HIGH; |
PD2HIGH; |
// This is probably the correct order: |
// The attitude computation should not depend on anything from control (except maybe the estimation of control activity level) |
// The control may depend on attitude - for example, attitude control uses pitch and roll angles, compass control uses yaw angle etc. |
123,7 → 123,7 |
controlMixer_periodicTask(); |
commands_handleCommands(); |
flight_control(); |
J4LOW; |
PD2LOW; |
// Allow Serial Data Transmit if motors must not updated or motors are not running |
if (!runFlightControl || !isFlying) { |
/branches/dongfang_FC_fixedwing/arduino_atmega328/output.h |
---|
3,18 → 3,10 |
#include <avr/io.h> |
#define J3HIGH PORTD |= (1<<PORTD5) |
#define J3LOW PORTD &= ~(1<<PORTD5) |
#define J3TOGGLE PORTD ^= (1<<PORTD5) |
#define PD2HIGH PORTD |= (1<<PORTD2) |
#define PD2LOW PORTD &= ~(1<<PORTD2) |
#define PD2TOGGLE PORTD ^= (1<<PORTD2) |
#define J4HIGH PORTD |= (1<<PORTD2) |
#define J4LOW PORTD &= ~(1<<PORTD2) |
#define J4TOGGLE PORTD ^= (1<<PORTD2) |
#define J5HIGH PORTD |= (1<<PORTD3) |
#define J5LOW PORTD &= ~(1<<PORTD3) |
#define J5TOGGLE PORTD ^= (1<<PORTD3) |
// invert means: An "1" bit in digital debug data make a LOW on the output. |
#define DIGITAL_DEBUG_INVERT 0 |
/branches/dongfang_FC_fixedwing/arduino_atmega328/rc.c |
---|
92,7 → 92,6 |
//sync gap? (3.5 ms < signal < 25.6 ms) |
if (signal > TIME(3.5)) { |
// never happens... |
index = 0; |
} else { // within the PPM frame |
if (index < MAX_CHANNELS) { // PPM24 supports 12 channels |
/branches/dongfang_FC_fixedwing/arduino_atmega328/rc.h |
---|
29,14 → 29,6 |
// Set this for a full stick range of about -1024..1024. |
#define RC_SCALING 1 |
/* |
int16_t RC_getPitch (void); |
int16_t RC_getYaw (void); |
int16_t RC_getRoll (void); |
uint16_t RC_getThrottle (void); |
uint8_t RC_hasNewRCData (void); |
*/ |
// void RC_periodicTask(void); |
void RC_periodicTaskAndPRYT(int16_t* PRYT); |
uint8_t RC_getArgument(void); |