allow using GPS in PWM input mode. This (obviously) reduces number of available channels by 2.

I heard thats not a problem since tarduino only allows 4RC+2AUX channels anyway! If you want more, upgrade to PPM.
So you use RC3/4 for GPS, and connect the rest of the channels as usual. Channels used for GPS uart are
skipped, so no changes to 'map' are necessary. Simply connect in order.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@212 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2012-09-08 12:53:55 +00:00
parent 4ed57b2696
commit b94c13b1c5
4 changed files with 2703 additions and 2694 deletions

File diff suppressed because it is too large Load Diff

View File

@ -136,7 +136,7 @@ enum {
TYPE_IP = 0x10,
TYPE_IW = 0x20,
TYPE_M = 0x40,
TYPE_S = 0x80,
TYPE_S = 0x80
};
static pwmPortData_t pwmPorts[MAX_PORTS];
@ -477,6 +477,10 @@ bool pwmInit(drv_pwm_config_t *init)
if (setup[i] == 0xFF) // terminator
break;
// skip UART ports for GPS
if (init->useUART && (port == PWM3 || port == PWM4))
continue;
// hacks to allow current functionality
if (mask & (TYPE_IP | TYPE_IW) && !init->enableInput)
mask = 0;

View File

@ -7,6 +7,7 @@
typedef struct drv_pwm_config_t {
bool enableInput;
bool usePPM;
bool useUART;
bool useServos;
bool extraServos; // configure additional 4 channels in PPM mode as servos, not motors
bool airplane; // fixed wing hardware config, lots of servos etc

View File

@ -57,12 +57,30 @@ int main(void)
sensorsSet(SENSOR_ACC);
#endif
if (feature(FEATURE_SPEKTRUM)) {
spektrumInit();
rcReadRawFunc = spektrumReadRawRC;
} else {
// spektrum and GPS are mutually exclusive
// Optional GPS - available in both PPM and PWM input mode, in PWM input, reduces number of available channels by 2.
if (feature(FEATURE_GPS))
gpsInit(cfg.gps_baudrate);
}
#ifdef SONAR
// sonar stuff only works with PPM
if (feature(FEATURE_PPM)) {
if (feature(FEATURE_SONAR))
Sonar_init();
}
#endif
mixerInit(); // this will set useServo var depending on mixer type
// when using airplane/wing mixer, servo/motor outputs are remapped
if (cfg.mixerConfiguration == MULTITYPE_AIRPLANE || cfg.mixerConfiguration == MULTITYPE_FLYING_WING)
pwm_params.airplane = true;
else
pwm_params.airplane = false;
pwm_params.useUART = feature(FEATURE_GPS);
pwm_params.usePPM = feature(FEATURE_PPM);
pwm_params.enableInput = !feature(FEATURE_SPEKTRUM); // disable inputs if using spektrum
pwm_params.useServos = useServo;
@ -96,22 +114,6 @@ int main(void)
if (feature(FEATURE_VBAT))
batteryInit();
if (feature(FEATURE_SPEKTRUM)) {
spektrumInit();
rcReadRawFunc = spektrumReadRawRC;
} else {
// spektrum and GPS are mutually exclusive
// Optional GPS - available only when using PPM, otherwise required pins won't be usable
if (feature(FEATURE_PPM)) {
if (feature(FEATURE_GPS))
gpsInit(cfg.gps_baudrate);
#ifdef SONAR
if (feature(FEATURE_SONAR))
Sonar_init();
#endif
}
}
previousTime = micros();
if (cfg.mixerConfiguration == MULTITYPE_GIMBAL)
calibratingA = 400;