1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

CC3D - Add sonar.

This also ensures that the PWM mapping does not use the sonar pins when
sonar is enabled in a board agnostic way.
Conflicts:
	src/main/config/config.c
	src/main/drivers/pwm_mapping.h
	src/main/main.c
	src/main/target/CC3D/target.h
This commit is contained in:
Dominic Clifton 2015-01-29 16:33:45 +01:00
parent a370d60595
commit 4ed6fdfea5
13 changed files with 91 additions and 34 deletions

View file

@ -408,29 +408,6 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
continue;
#endif
#ifdef SONAR
// skip Sonar pins
// FIXME - Hack - See sonar.c sonarInit() and sonarHardware_t
if (init->useSonar && timerHardwarePtr->gpio == GPIOB) {
#if defined(SPRACINGF3) || defined(OLIMEXINO)
if (timerHardwarePtr->pin == GPIO_Pin_0 || timerHardwarePtr->pin == GPIO_Pin_1) {
continue;
}
#endif
#if defined(NAZE)
if (init->useParallelPWM) {
if (timerHardwarePtr->pin == GPIO_Pin_8 || timerHardwarePtr->pin == GPIO_Pin_9) {
continue;
}
} else {
if (timerHardwarePtr->pin == GPIO_Pin_0 || timerHardwarePtr->pin == GPIO_Pin_1) {
continue;
}
}
#endif
}
#endif
#ifdef SOFTSERIAL_1_TIMER
if (init->useSoftSerial && timerHardwarePtr->tim == SOFTSERIAL_1_TIMER)
continue;
@ -471,6 +448,17 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
}
#endif
#ifdef SONAR
if (init->sonarGPIOConfig && timerHardwarePtr->gpio == init->sonarGPIOConfig->gpio &&
(
timerHardwarePtr->pin == init->sonarGPIOConfig->triggerPin ||
timerHardwarePtr->pin == init->sonarGPIOConfig->echoPin
)
) {
continue;
}
#endif
// hacks to allow current functionality
if (type == MAP_TO_PWM_INPUT && !init->useParallelPWM)
continue;