|
| 1 | +/* |
| 2 | + * This file is part of INAV Project. |
| 3 | + * |
| 4 | + * This Source Code Form is subject to the terms of the Mozilla Public |
| 5 | + * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 6 | + * You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 | + * |
| 8 | + * Alternatively, the contents of this file may be used under the terms |
| 9 | + * of the GNU General Public License Version 3, as described below: |
| 10 | + * |
| 11 | + * This file is free software: you may copy, redistribute and/or modify |
| 12 | + * it under the terms of the GNU General Public License as published by the |
| 13 | + * Free Software Foundation, either version 3 of the License, or (at your |
| 14 | + * option) any later version. |
| 15 | + * |
| 16 | + * This file is distributed in the hope that it will be useful, but |
| 17 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 19 | + * Public License for more details. |
| 20 | + * |
| 21 | + * You should have received a copy of the GNU General Public License |
| 22 | + * along with this program. If not, see http://www.gnu.org/licenses/. |
| 23 | + */ |
| 24 | + |
| 25 | +#include <stdint.h> |
| 26 | + |
| 27 | +#include "platform.h" |
| 28 | + |
| 29 | +#include "drivers/bus.h" |
| 30 | +#include "drivers/io.h" |
| 31 | +#include "drivers/pwm_mapping.h" |
| 32 | +#include "drivers/timer.h" |
| 33 | +#include "drivers/sensor.h" |
| 34 | + |
| 35 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro1_mpu6000, DEVHW_MPU6000, GYRO1_SPI_BUS, GYRO1_CS_PIN, GYRO1_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_1_MPU6000_ALIGN); |
| 36 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro1_icm42688, DEVHW_ICM42605, GYRO1_SPI_BUS, GYRO1_CS_PIN, GYRO1_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_1_ICM42605_ALIGN); |
| 37 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro1_icm45686, DEVHW_ICM45686, GYRO1_SPI_BUS, GYRO1_CS_PIN, GYRO1_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_1_ICM42605_ALIGN); |
| 38 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro2_mpu6000, DEVHW_MPU6000, GYRO2_SPI_BUS, GYRO2_CS_PIN, GYRO2_EXTI_PIN, 1, DEVFLAGS_NONE, IMU_2_MPU6000_ALIGN); |
| 39 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro2_icm42688, DEVHW_ICM42605, GYRO2_SPI_BUS, GYRO2_CS_PIN, GYRO2_EXTI_PIN, 1, DEVFLAGS_NONE, IMU_2_ICM42605_ALIGN); |
| 40 | +BUSDEV_REGISTER_SPI_TAG(busdev_gyro2_icm45686, DEVHW_ICM45686, GYRO2_SPI_BUS, GYRO2_CS_PIN, GYRO2_EXTI_PIN, 1, DEVFLAGS_NONE, IMU_2_ICM42605_ALIGN); |
| 41 | + |
| 42 | +timerHardware_t timerHardware[] = { |
| 43 | + DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 |
| 44 | + DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 |
| 45 | + DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 |
| 46 | + DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 |
| 47 | + |
| 48 | + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 4), // S5 |
| 49 | + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 5), // S6 |
| 50 | + DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 6), // S7 |
| 51 | + DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 DMA_NONE |
| 52 | + |
| 53 | + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 11), // S9 |
| 54 | + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 12), // S10 |
| 55 | + |
| 56 | + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 13), // S11 |
| 57 | + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE |
| 58 | + |
| 59 | + DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO | TIM_USE_LED, 0, 14), // RGB_LED |
| 60 | + |
| 61 | + DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0), // BEEPER |
| 62 | +}; |
| 63 | + |
| 64 | +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); |
0 commit comments