Skip to content

Commit

Permalink
Merge 651b001 into 757c637
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-B committed Mar 20, 2024
2 parents 757c637 + 651b001 commit c759064
Show file tree
Hide file tree
Showing 23 changed files with 3,264 additions and 327 deletions.
4 changes: 3 additions & 1 deletion conf/airframes/ENAC/quadrotor/cobraV2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

<module name="telemetry" type="xbee_api"/>

<module name="actuators" type="dshot"/>
<module name="actuators" type="dshot">
<configure name="DSHOT_BIDIR" value="TRUE"/>
</module>
<module name="actuators" type="pwm"/>
<module name="switch" type="servo"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_SWITCH_MAX"/>
Expand Down
8 changes: 8 additions & 0 deletions conf/modules/actuators_dshot.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
It might be required to disable by hand some PWM output to avoid conflicts when they are activated by default on a board.
Currently only implemented over ChibiOS.
</description>
<configure name="DSHOT_BIDIR" value="FALSE" description="Bidirectionnal DSHOT for fast rpm feedback"/>
<define name="DSHOT_SPEED" value="600" description="DSHOT speed (150,300,600,1200)"/>
</doc>
<dep>
Expand All @@ -19,8 +20,15 @@
<file name="actuators_dshot.h"/>
</header>
<makefile>
<configure name="DSHOT_BIDIR" default="FALSE"/>
<define name="DSHOT_BIDIR" value="$(DSHOT_BIDIR)"/>
<define name="USE_GPT7" value="TRUE" cond="ifeq ($(DSHOT_BIDIR),TRUE)"/>
<file_arch name="actuators_dshot_arch.c"/>
<file_arch name="esc_dshot.c" cond="ifeq ($(RTOS),chibios)"/>
<file_arch name="dshot_rpmCapture.c" cond="ifeq ($(DSHOT_BIDIR),TRUE)"/>
<file_arch name="dshot_erps.c" cond="ifeq ($(DSHOT_BIDIR),TRUE)"/>
<file_arch name="inputCapture.c" cond="ifeq ($(DSHOT_BIDIR),TRUE)"/>
<file_arch name="timerDmaCache.c" cond="ifeq ($(DSHOT_BIDIR),TRUE)"/>
<file_arch name="hal_stm32_dma.c" dir="mcu_periph" cond="ifeq ($(RTOS),chibios)"/>
<test/>
</makefile>
Expand Down
5 changes: 5 additions & 0 deletions sw/airborne/arch/chibios/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
#if USE_GPT5 || USE_GPT7 || USE_GPT8 || USE_GPT12 || USE_GPT13
#define HAL_USE_GPT TRUE
#define GPT_DRIVER_EXT_FIELDS void *user_data;
#else
#define HAL_USE_GPT FALSE
#endif
#endif

/**
* @brief Enables the I2C subsystem.
Expand Down
4 changes: 4 additions & 0 deletions sw/airborne/arch/chibios/mcu_periph/gpio_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ void gpio_setup_input_pulldown(ioportid_t port, uint16_t gpios)
chSysUnlock();
}

void gpio_setup_pin_af_pullup(ioportid_t port, uint16_t pin, uint8_t af) {
palSetPadMode(port, pin, PAL_MODE_ALTERNATE(af) | PAL_STM32_PUPDR_PULLUP);
}

void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output)
{
chSysLock();
Expand Down
6 changes: 6 additions & 0 deletions sw/airborne/arch/chibios/mcu_periph/gpio_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ extern void gpio_setup_input_pulldown(ioportid_t port, uint16_t gpios);
*/
extern void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output);

/**
* Setup a gpio for input pullup with alternate function.
* This is an STM32 specific helper funtion and should only be used in stm32 code.
*/
void gpio_setup_pin_af_pullup(ioportid_t port, uint16_t pin, uint8_t af);

/**
* Setup a gpio for analog use.
* @param[in] port
Expand Down

0 comments on commit c759064

Please sign in to comment.