mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
Separated ADC parameter group code into separate files
This commit is contained in:
parent
a0f6d10b72
commit
725f0dfa26
18 changed files with 131 additions and 50 deletions
61
src/main/pg/adc.c
Normal file
61
src/main/pg/adc.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef USE_ADC
|
||||
|
||||
#include "config/parameter_group.h"
|
||||
#include "config/parameter_group_ids.h"
|
||||
|
||||
#include "drivers/adc_impl.h"
|
||||
#include "drivers/io.h"
|
||||
|
||||
#include "pg/adc.h"
|
||||
|
||||
|
||||
PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0);
|
||||
|
||||
void pgResetFn_adcConfig(adcConfig_t *adcConfig)
|
||||
{
|
||||
adcConfig->device = ADC_DEV_TO_CFG(adcDeviceByInstance(ADC_INSTANCE));
|
||||
|
||||
#ifdef VBAT_ADC_PIN
|
||||
adcConfig->vbat.enabled = true;
|
||||
adcConfig->vbat.ioTag = IO_TAG(VBAT_ADC_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef EXTERNAL1_ADC_PIN
|
||||
adcConfig->external1.enabled = true;
|
||||
adcConfig->external1.ioTag = IO_TAG(EXTERNAL1_ADC_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef CURRENT_METER_ADC_PIN
|
||||
adcConfig->current.enabled = true;
|
||||
adcConfig->current.ioTag = IO_TAG(CURRENT_METER_ADC_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef RSSI_ADC_PIN
|
||||
adcConfig->rssi.enabled = true;
|
||||
adcConfig->rssi.ioTag = IO_TAG(RSSI_ADC_PIN);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif // USE_ADC
|
Loading…
Add table
Add a link
Reference in a new issue