mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Corrections - too many initialisers, and ADC
This commit is contained in:
parent
58105c25ac
commit
953c8da179
6 changed files with 65 additions and 22 deletions
|
@ -118,7 +118,7 @@ void adcInit(drv_adc_config_t *init)
|
||||||
|
|
||||||
const adcDevice_t adc = adcHardware[device];
|
const adcDevice_t adc = adcHardware[device];
|
||||||
|
|
||||||
for (int i = 0; i < ADC_CHANNEL_COUNT; i++) {
|
for (int i = 0; i < ADC_CHANNEL_COUNT; i++) {
|
||||||
if (!adcConfig[i].tag)
|
if (!adcConfig[i].tag)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ void adcInit(drv_adc_config_t *init)
|
||||||
RCC_ADCCLKConfig(RCC_PCLK2_Div8); // 9MHz from 72MHz APB2 clock(HSE), 8MHz from 64MHz (HSI)
|
RCC_ADCCLKConfig(RCC_PCLK2_Div8); // 9MHz from 72MHz APB2 clock(HSE), 8MHz from 64MHz (HSI)
|
||||||
RCC_ClockCmd(adc.rccADC, ENABLE);
|
RCC_ClockCmd(adc.rccADC, ENABLE);
|
||||||
|
|
||||||
dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC_BATT + i, 0);
|
dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, 0);
|
||||||
|
|
||||||
DMA_DeInit(adc.DMAy_Channelx);
|
DMA_DeInit(adc.DMAy_Channelx);
|
||||||
DMA_InitTypeDef DMA_InitStructure;
|
DMA_InitTypeDef DMA_InitStructure;
|
||||||
|
|
|
@ -158,7 +158,7 @@ void adcInit(drv_adc_config_t *init)
|
||||||
RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div256); // 72 MHz divided by 256 = 281.25 kHz
|
RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div256); // 72 MHz divided by 256 = 281.25 kHz
|
||||||
RCC_ClockCmd(adc.rccADC, ENABLE);
|
RCC_ClockCmd(adc.rccADC, ENABLE);
|
||||||
|
|
||||||
dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC_BATT + i, 0);
|
dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, 0);
|
||||||
|
|
||||||
DMA_DeInit(adc.DMAy_Channelx);
|
DMA_DeInit(adc.DMAy_Channelx);
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void adcInit(drv_adc_config_t *init)
|
||||||
|
|
||||||
RCC_ClockCmd(adc.rccADC, ENABLE);
|
RCC_ClockCmd(adc.rccADC, ENABLE);
|
||||||
|
|
||||||
dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC_BATT + i, 0);
|
dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, 0);
|
||||||
|
|
||||||
DMA_DeInit(adc.DMAy_Streamx);
|
DMA_DeInit(adc.DMAy_Streamx);
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ void adcInit(drv_adc_config_t *init)
|
||||||
|
|
||||||
|
|
||||||
RCC_ClockCmd(adc.rccADC, ENABLE);
|
RCC_ClockCmd(adc.rccADC, ENABLE);
|
||||||
dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC_BATT + i, 0);
|
dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, 0);
|
||||||
|
|
||||||
ADCHandle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV8;
|
ADCHandle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV8;
|
||||||
ADCHandle.Init.ContinuousConvMode = ENABLE;
|
ADCHandle.Init.ContinuousConvMode = ENABLE;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Cleanflight is free software: you can redistribute it and/or modify
|
* Cleanflight is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation,either version 3 of the License,or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Cleanflight is distributed in the hope that it will be useful,
|
* Cleanflight is distributed in the hope that it will be useful,
|
||||||
|
@ -12,24 +12,51 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
* along with Cleanflight. If not,see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
const char * const ownerNames[OWNER_TOTAL_COUNT] = {
|
const char * const ownerNames[OWNER_TOTAL_COUNT] = {
|
||||||
"FREE", "PWM", "PPM", "MOTOR", "SERVO", "LED",
|
"FREE",
|
||||||
"ADC", "ADC_BATT", "ADC_CURR", "ADC_EXT", "ADC_RSSI",
|
"PWM",
|
||||||
"SERIAL_TX", "SERIAL_RX",
|
"PPM",
|
||||||
"DEBUG", "TIMER",
|
"MOTOR",
|
||||||
"SONAR_TRIGGER", "SONAR_ECHO",
|
"SERVO",
|
||||||
|
"LED",
|
||||||
|
"ADC",
|
||||||
|
"ADC_BATT",
|
||||||
|
"ADC_CURR",
|
||||||
|
"ADC_EXT",
|
||||||
|
"ADC_RSSI",
|
||||||
|
"SERIAL_TX",
|
||||||
|
"SERIAL_RX",
|
||||||
|
"DEBUG",
|
||||||
|
"TIMER",
|
||||||
|
"SONAR_TRIGGER",
|
||||||
|
"SONAR_ECHO",
|
||||||
"SYSTEM",
|
"SYSTEM",
|
||||||
"SPI_SCK", "SPI_MISO", "SPI_MOSI",
|
"SPI_SCK",
|
||||||
"I2C_SDA", "I2C_SCL",
|
"SPI_MISO",
|
||||||
"SDCARD_CS", "FLASH_CS", "BARO_CS", "MPU_CS", "OSD_CS", "RX_SPI_CS", "SPI_CS",
|
"SPI_MOSI",
|
||||||
"MPU_EXTI", "BARO_EXTI",
|
"I2C_SDA",
|
||||||
"USB", "USB_DETECT", "BEEPER", "OSD", "SDCARD_DETECT",
|
"I2C_SCL",
|
||||||
|
"SDCARD_CS",
|
||||||
|
"FLASH_CS",
|
||||||
|
"BARO_CS",
|
||||||
|
"MPU_CS",
|
||||||
|
"OSD_CS",
|
||||||
|
"RX_SPI_CS",
|
||||||
|
"SPI_CS",
|
||||||
|
"MPU_EXTI",
|
||||||
|
"BARO_EXTI",
|
||||||
|
"USB",
|
||||||
|
"USB_DETECT",
|
||||||
|
"BEEPER",
|
||||||
|
"OSD",
|
||||||
|
"SDCARD_DETECT",
|
||||||
"RX_BIND",
|
"RX_BIND",
|
||||||
"INVERTER", "LED_STRIP",
|
"INVERTER",
|
||||||
|
"LED_STRIP",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RESOURCE_INDEX(x) (x + 1)
|
|
||||||
#define RESOURCE_SOFT_OFFSET 10
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OWNER_FREE = 0,
|
OWNER_FREE = 0,
|
||||||
OWNER_PWMINPUT,
|
OWNER_PWMINPUT,
|
||||||
|
@ -38,6 +51,7 @@ typedef enum {
|
||||||
OWNER_MPU_EXTI,
|
OWNER_MPU_EXTI,
|
||||||
OWNER_BARO_EXTI,
|
OWNER_BARO_EXTI,
|
||||||
OWNER_USB,
|
OWNER_USB,
|
||||||
|
OWNER_USB_DETECT,
|
||||||
OWNER_BEEPER,
|
OWNER_BEEPER,
|
||||||
OWNER_OSD,
|
OWNER_OSD,
|
||||||
OWNER_SDCARD_DETECT,
|
OWNER_SDCARD_DETECT,
|
||||||
|
@ -49,3 +63,5 @@ typedef enum {
|
||||||
|
|
||||||
extern const char * const ownerNames[OWNER_TOTAL_COUNT];
|
extern const char * const ownerNames[OWNER_TOTAL_COUNT];
|
||||||
|
|
||||||
|
#define RESOURCE_INDEX(x) (x + 1)
|
||||||
|
#define RESOURCE_SOFT_OFFSET 10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue