NinjaFlight
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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
{
21
ADC_BATTERY
= 0,
22
ADC_RSSI
= 1,
23
ADC_EXTERNAL1
= 2,
24
ADC_CURRENT
= 3,
25
ADC_CHANNEL_MAX
=
ADC_CURRENT
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
;
40
bool
enableCurrentMeter
;
41
bool
enableExternal1
;
42
}
drv_adc_config_t
;
43
44
void
adcInit
(
drv_adc_config_t
*init);
45
uint16_t
adcGetChannel
(uint8_t channel);
ADC_RSSI
Definition:
adc.h:22
adc_config_s
Definition:
adc.h:30
adcGetChannel
uint16_t adcGetChannel(uint8_t channel)
Definition:
adc.c:57
drv_adc_config_s
Definition:
adc.h:37
adc_config_t
struct adc_config_s adc_config_t
adc_config_s::sampleTime
uint8_t sampleTime
Definition:
adc.h:34
adc_config_s::dmaIndex
uint8_t dmaIndex
Definition:
adc.h:32
adc_config_s::enabled
bool enabled
Definition:
adc.h:33
ADC_BATTERY
Definition:
adc.h:21
ADC_EXTERNAL1
Definition:
adc.h:23
AdcChannel
AdcChannel
Definition:
adc.h:20
drv_adc_config_t
struct drv_adc_config_s drv_adc_config_t
drv_adc_config_s::enableCurrentMeter
bool enableCurrentMeter
Definition:
adc.h:40
adcInit
void adcInit(drv_adc_config_t *init)
Definition:
adc_stm32f10x.c:52
drv_adc_config_s::enableVBat
bool enableVBat
Definition:
adc.h:38
drv_adc_config_s::enableRSSI
bool enableRSSI
Definition:
adc.h:39
ADC_CURRENT
Definition:
adc.h:24
adc_config_s::adcChannel
uint8_t adcChannel
Definition:
adc.h:31
ADC_CHANNEL_MAX
Definition:
adc.h:25
drv_adc_config_s::enableExternal1
bool enableExternal1
Definition:
adc.h:41
src
main
drivers
adc.h
Generated on Mon Dec 12 2016 15:48:45 for NinjaFlight by
1.8.7