mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
SPRacingF3 - Add sonar support.
This commit is contained in:
parent
07bcf204e1
commit
1de9fa4db6
4 changed files with 17 additions and 0 deletions
|
@ -758,6 +758,12 @@ void validateAndFixConfig(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(SPRACINGF3) && defined(SONAR)
|
||||
if (feature(FEATURE_RX_PARALLEL_PWM) && feature(FEATURE_SONAR) ) {
|
||||
featureClear(FEATURE_SONAR);
|
||||
}
|
||||
#endif
|
||||
|
||||
useRxConfig(&masterConfig.rxConfig);
|
||||
|
||||
serialConfig_t *serialConfig = &masterConfig.serialConfig;
|
||||
|
|
|
@ -69,6 +69,15 @@ void sonarInit(void)
|
|||
.exti_irqn = EXTI1_IRQn
|
||||
};
|
||||
hcsr04_init(&sonarHardware);
|
||||
#elif defined(SPRACINGF3)
|
||||
static const sonarHardware_t const sonarHardware = {
|
||||
.trigger_pin = Pin_0, // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
.echo_pin = Pin_1, // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
.exti_line = EXTI_Line1,
|
||||
.exti_pin_source = EXTI_PinSource1,
|
||||
.exti_irqn = EXTI1_IRQn
|
||||
};
|
||||
hcsr04_init(&sonarHardware);
|
||||
#else
|
||||
#error Sonar not defined for target
|
||||
#endif
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#define USE_FLASHFS
|
||||
#define USE_FLASH_M25P16
|
||||
|
||||
#define SONAR
|
||||
#define BEEPER
|
||||
#define LED0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue