NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
adc.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 typedef enum {
22  ADC_RSSI = 1,
26 } AdcChannel;
27 
28 #define ADC_CHANNEL_COUNT (ADC_CHANNEL_MAX + 1)
29 
30 typedef struct adc_config_s {
31  uint8_t adcChannel; // ADC1_INxx channel number
32  uint8_t dmaIndex; // index into DMA buffer in case of sparse channels
33  bool enabled;
34  uint8_t sampleTime;
35 } adc_config_t;
36 
37 typedef struct drv_adc_config_s {
38  bool enableVBat;
39  bool enableRSSI;
43 
44 void adcInit(drv_adc_config_t *init);
45 uint16_t adcGetChannel(uint8_t channel);
Definition: adc.h:22
Definition: adc.h:30
uint16_t adcGetChannel(uint8_t channel)
Definition: adc.c:57
Definition: adc.h:37
struct adc_config_s adc_config_t
uint8_t sampleTime
Definition: adc.h:34
uint8_t dmaIndex
Definition: adc.h:32
bool enabled
Definition: adc.h:33
Definition: adc.h:21
Definition: adc.h:23
AdcChannel
Definition: adc.h:20
struct drv_adc_config_s drv_adc_config_t
bool enableCurrentMeter
Definition: adc.h:40
void adcInit(drv_adc_config_t *init)
Definition: adc_stm32f10x.c:52
bool enableVBat
Definition: adc.h:38
bool enableRSSI
Definition: adc.h:39
Definition: adc.h:24
uint8_t adcChannel
Definition: adc.h:31
Definition: adc.h:25
bool enableExternal1
Definition: adc.h:41