diff --git a/src/main/drivers/timer_def.h b/src/main/drivers/timer_def.h index 6973f87418..82d1939d53 100644 --- a/src/main/drivers/timer_def.h +++ b/src/main/drivers/timer_def.h @@ -277,6 +277,7 @@ #define DEF_TIM_DMA_STR_0__TIM8_CH2 DMA2_ST3 #define DEF_TIM_DMA_STR_1__TIM8_CH2 DMA2_ST2 #define DEF_TIM_DMA_STR_0__TIM8_CH3 DMA2_ST2 +#define DEF_TIM_DMA_STR_1__TIM8_CH3 DMA2_ST4 #define DEF_TIM_DMA_STR_0__TIM8_CH4 DMA2_ST7 #define DEF_TIM_DMA_STR_0__TIM9_CH1 DMA_NONE @@ -331,6 +332,7 @@ #define DEF_TIM_DMA_CHN_0__TIM8_CH2 DMA_Channel_0 #define DEF_TIM_DMA_CHN_1__TIM8_CH2 DMA_Channel_7 #define DEF_TIM_DMA_CHN_0__TIM8_CH3 DMA_Channel_0 +#define DEF_TIM_DMA_CHN_1__TIM8_CH3 DMA_Channel_0 #define DEF_TIM_DMA_CHN_0__TIM8_CH4 DMA_Channel_7 #define DEF_TIM_DMA_CHN_0__TIM9_CH1 0 diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 17172ca887..db9a5ee729 100755 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -2265,11 +2265,9 @@ static void cliFlashRead(char *cmdline) cliPrintf("Reading %u bytes at %u:\r\n", length, address); while (length > 0) { - int bytesRead; + int bytesRead = flashfsReadAbs(address, buffer, length < sizeof(buffer) ? length : sizeof(buffer)); - bytesRead = flashfsReadAbs(address, buffer, length < sizeof(buffer) ? length : sizeof(buffer)); - - for (uint32_t i = 0; i < bytesRead; i++) { + for (int i = 0; i < bytesRead; i++) { cliWrite(buffer[i]); } diff --git a/src/main/target/KAKUTEF4-V1/target.c b/src/main/target/KAKUTEF4-V1/target.c deleted file mode 100644 index 107e9b8da3..0000000000 --- a/src/main/target/KAKUTEF4-V1/target.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of Cleanflight. - * - * Cleanflight is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Cleanflight is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cleanflight. If not, see . - */ - -#include - -#include -#include "drivers/io.h" -#include "drivers/dma.h" -#include "drivers/timer.h" - -const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { - { TIM8, IO_TAG(PC7), TIM_Channel_2, TIM8_CC_IRQn, 0, IOCFG_AF_PP, GPIO_AF_TIM8, NULL, 0, 0 }, // PPM IN - { TIM3, IO_TAG(PB0), TIM_Channel_3, TIM3_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM3, DMA1_Stream7, DMA_Channel_5, DMA1_ST7_HANDLER }, // S1_OUT - { TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM3, DMA1_Stream2, DMA_Channel_5, DMA1_ST2_HANDLER }, // S2_OUT - { TIM2, IO_TAG(PA3), TIM_Channel_4, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2, DMA1_Stream6, DMA_Channel_3, DMA1_ST6_HANDLER }, // S3_OUT - { TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM2, DMA1_Stream1, DMA_Channel_3, DMA1_ST1_HANDLER }, // S4_OUT - { TIM5, IO_TAG(PA1), TIM_Channel_2, TIM5_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM5, DMA1_Stream4, DMA_Channel_6, DMA1_ST4_HANDLER }, // S5_OUT - { TIM8, IO_TAG(PC8), TIM_Channel_3, TIM8_CC_IRQn, 1, IOCFG_AF_PP, GPIO_AF_TIM8, DMA2_Stream4, DMA_Channel_7, DMA2_ST4_HANDLER }, // S6_OUT -}; \ No newline at end of file diff --git a/src/main/target/KAKUTEF4/target.c b/src/main/target/KAKUTEF4/target.c new file mode 100644 index 0000000000..a4fa859d15 --- /dev/null +++ b/src/main/target/KAKUTEF4/target.c @@ -0,0 +1,46 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include + +#include +#include "drivers/io.h" +#include "drivers/dma.h" +#include "drivers/timer.h" +#include "drivers/timer_def.h" + +/* +const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { + { TIM8, IO_TAG(PC7), TIM_Channel_2, 0, GPIO_AF_TIM8, NULL, 0, 0 }, // PPM IN + { TIM3, IO_TAG(PB0), TIM_Channel_3, 1, GPIO_AF_TIM3, DMA1_Stream7, DMA_Channel_5, DMA1_ST7_HANDLER }, // S1_OUT + { TIM3, IO_TAG(PB1), TIM_Channel_4, 1, GPIO_AF_TIM3, DMA1_Stream2, DMA_Channel_5, DMA1_ST2_HANDLER }, // S2_OUT + { TIM2, IO_TAG(PA3), TIM_Channel_4, 1, GPIO_AF_TIM2, DMA1_Stream6, DMA_Channel_3, DMA1_ST6_HANDLER }, // S3_OUT + { TIM2, IO_TAG(PA2), TIM_Channel_3, 1, GPIO_AF_TIM2, DMA1_Stream1, DMA_Channel_3, DMA1_ST1_HANDLER }, // S4_OUT + { TIM5, IO_TAG(PA1), TIM_Channel_2, 1, GPIO_AF_TIM5, DMA1_Stream4, DMA_Channel_6, DMA1_ST4_HANDLER }, // S5_OUT + { TIM8, IO_TAG(PC8), TIM_Channel_3, 1, GPIO_AF_TIM8, DMA2_Stream4, DMA_Channel_7, DMA2_ST4_HANDLER }, // S6_OUT +}; +*/ + +const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { + DEF_TIM(TIM8, CH2, PC7, TIM_USE_PPM, TIMER_INPUT_ENABLED, 0), // PPM IN + DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // S1_OUT - DMA1_ST7 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // S2_OUT - DMA1_ST2 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // S3_OUT - DMA1_ST6 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // S4_OUT - DMA1_ST1 + DEF_TIM(TIM5, CH2, PA1, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 0), // S5_OUT - DMA1_ST4 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // S6_OUT - DMA2_ST4 +}; \ No newline at end of file diff --git a/src/main/target/KAKUTEF4-V1/target.h b/src/main/target/KAKUTEF4/target.h similarity index 100% rename from src/main/target/KAKUTEF4-V1/target.h rename to src/main/target/KAKUTEF4/target.h diff --git a/src/main/target/KAKUTEF4-V1/target.mk b/src/main/target/KAKUTEF4/target.mk similarity index 100% rename from src/main/target/KAKUTEF4-V1/target.mk rename to src/main/target/KAKUTEF4/target.mk