From 1d44231cd4b4bd0553284803d4b339c222e8dcd2 Mon Sep 17 00:00:00 2001 From: Travis Bottalico Date: Wed, 23 Oct 2019 17:52:26 -0700 Subject: [PATCH] modalai fc-v1: add dshot support --- boards/modalai/fc-v1/default.cmake | 1 + boards/modalai/fc-v1/src/board_config.h | 2 ++ boards/modalai/fc-v1/src/timer_config.c | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/boards/modalai/fc-v1/default.cmake b/boards/modalai/fc-v1/default.cmake index a9e6b88733..8a3698285a 100644 --- a/boards/modalai/fc-v1/default.cmake +++ b/boards/modalai/fc-v1/default.cmake @@ -24,6 +24,7 @@ px4_add_board( camera_trigger differential_pressure # all available differential pressure drivers distance_sensor # all available distance sensor drivers + dshot gps imu/bmi088 # TODO imu/icm42688 diff --git a/boards/modalai/fc-v1/src/board_config.h b/boards/modalai/fc-v1/src/board_config.h index 80848d6e3b..885cc20efe 100644 --- a/boards/modalai/fc-v1/src/board_config.h +++ b/boards/modalai/fc-v1/src/board_config.h @@ -480,6 +480,8 @@ #define BOARD_NUM_IO_TIMERS 5 +#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; + __BEGIN_DECLS /**************************************************************************************************** diff --git a/boards/modalai/fc-v1/src/timer_config.c b/boards/modalai/fc-v1/src/timer_config.c index 41f3e7e149..c7766425d0 100644 --- a/boards/modalai/fc-v1/src/timer_config.c +++ b/boards/modalai/fc-v1/src/timer_config.c @@ -75,6 +75,13 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = { .last_channel_index = 3, .handler = io_timer_handler0, .vectorno = STM32_IRQ_TIM1CC, + .dshot = { + .dma_base = DSHOT_DMA2_BASE, + .channel = DShot_Channel6, + .stream = DShot_Stream5, + .start_ccr_register = TIM_DMABASE_CCR1, + .channels_number = 4u /* CCR1, CCR2, CCR3 and CCR4 */ + } }, { .base = STM32_TIM4_BASE,