diff --git a/conf/airframes/TUDELFT/tudelft_splash.xml b/conf/airframes/TUDELFT/tudelft_splash.xml index b13a10c994..1632b509fe 100644 --- a/conf/airframes/TUDELFT/tudelft_splash.xml +++ b/conf/airframes/TUDELFT/tudelft_splash.xml @@ -29,7 +29,7 @@ - + @@ -217,7 +217,8 @@ - + +
diff --git a/sw/airborne/boards/px4fmu_4.0.h b/sw/airborne/boards/px4fmu_4.0.h index bcea37bcaa..809192d869 100644 --- a/sw/airborne/boards/px4fmu_4.0.h +++ b/sw/airborne/boards/px4fmu_4.0.h @@ -105,16 +105,16 @@ /* Soft binding Spektrum */ //ok -#define RADIO_CONTROL_POWER_PORT GPIOC -#define RADIO_CONTROL_POWER_PIN GPIO5 -#define RADIO_CONTROL_POWER_ON gpio_set -#define RADIO_CONTROL_POWER_OFF gpio_clear +#define RADIO_CONTROL_POWER_PORT GPIOE +#define RADIO_CONTROL_POWER_PIN GPIO4 //SPEKTRUM POWER +#define RADIO_CONTROL_POWER_ON gpio_clear // yes, inverted +#define RADIO_CONTROL_POWER_OFF gpio_set -#define PERIPHERAL3V3_ENABLE_PORT GPIOE -#define PERIPHERAL3V3_ENABLE_PIN GPIO4 -#define PERIPHERAL3V3_ENABLE_ON gpio_clear // yes, inverted -#define PERIPHERAL3V3_ENABLE_OFF gpio_set +#define PERIPHERAL3V3_ENABLE_PORT GPIOC //VDD_3V3_PERIPHERAL_EN +#define PERIPHERAL3V3_ENABLE_PIN GPIO5 +#define PERIPHERAL3V3_ENABLE_ON gpio_set +#define PERIPHERAL3V3_ENABLE_OFF gpio_clear /* Turn SBUS invert */ //ok diff --git a/sw/airborne/mcu.c b/sw/airborne/mcu.c index 7a970b9f11..77a6b78231 100644 --- a/sw/airborne/mcu.c +++ b/sw/airborne/mcu.c @@ -115,6 +115,10 @@ void mcu_init(void) #if defined RADIO_CONTROL_POWER_PORT gpio_setup_output(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); +#endif +#ifdef PERIPHERAL3V3_ENABLE_PORT + gpio_setup_output(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN); + PERIPHERAL3V3_ENABLE_ON(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN); #endif /* for now this means using spektrum */ #if defined RADIO_CONTROL & defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT & defined RADIO_CONTROL_BIND_IMPL_FUNC & defined SPEKTRUM_BIND_PIN_PORT diff --git a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c index 7034d16a61..4bf435da81 100644 --- a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c +++ b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c @@ -33,41 +33,38 @@ #include "mcu_periph/gpio.h" -void spektrum_soft_bind_init(void) { - gpio_setup_output(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); - RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); - -#ifdef PERIPHERAL3V3_ENABLE_PORT // px4fmu 4 (pixracer) has this - gpio_setup_output(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN); - PERIPHERAL3V3_ENABLE_ON(PERIPHERAL3V3_ENABLE_PORT, PERIPHERAL3V3_ENABLE_PIN); -#endif +void spektrum_soft_bind_init(void) { } -uint8_t bind_soft_value; -void spektrum_soft_bind_click(uint8_t val __attribute__((unused))) -{ +bool bind_soft_value; +void spektrum_soft_bind_click(bool val ) { #ifndef INTER_MCU_AP - send_spektrum_bind(); + send_spektrum_bind(); #else - intermcu_send_spektrum_bind(); + intermcu_send_spektrum_bind(); #endif + bind_soft_value = val; } void send_spektrum_bind(void) { + //power cycle the spektrum +#if defined(RADIO_CONTROL_LED) + LED_OFF(RADIO_CONTROL_LED); +#endif - //power cycle the spektrum - RADIO_CONTROL_POWER_OFF(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); - sys_time_usleep(1000000); - RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); + RADIO_CONTROL_POWER_OFF(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); + sys_time_usleep(100000); + RADIO_CONTROL_POWER_ON(RADIO_CONTROL_POWER_PORT, RADIO_CONTROL_POWER_PIN); +#if defined(RADIO_CONTROL_LED) + LED_ON(RADIO_CONTROL_LED); +#endif + //put to bind mode + RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind() - - //put to bind mode - RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind() - - SpektrumUartInit(); + SpektrumUartInit(); } diff --git a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.h b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.h index 463a568de5..6c88ebb25b 100644 --- a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.h +++ b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.h @@ -29,11 +29,11 @@ #include "std.h" extern void spektrum_soft_bind_init(void); -extern void spektrum_soft_bind_click(uint8_t val); +extern void spektrum_soft_bind_click(bool val); void send_spektrum_bind(void); -extern uint8_t bind_soft_value; +extern bool bind_soft_value; #endif