Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
adc.h
Go to the documentation of this file.
1/*
2 * Paparazzi adc functions
3 *
4 * Copyright (C) 2003-2010 The Paparazzi team
5 *
6 * This file is part of Paparazzi.
7 *
8 * Paparazzi is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * Paparazzi is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Paparazzi; see the file COPYING. If not, write to
20 * the Free Software Foundation, 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 *
23 */
24
34#ifndef MCU_PERIPH_ADC_H
35#define MCU_PERIPH_ADC_H
36
37#include <inttypes.h>
38#include "mcu_periph/adc_arch.h"
39
40#define MAX_AV_NB_SAMPLE 0x20
41#define DEFAULT_AV_NB_SAMPLE 0x20
42
53struct adc_buf {
54 uint32_t sum; /* Sum of samples in buffer (avg = sum / av_nb_sample) */
55 uint16_t values[MAX_AV_NB_SAMPLE]; /* Buffer for sample values from ADC */
56 uint8_t head; /* Position index of write head in buffer */
57 uint8_t av_nb_sample; /* Number of samples to use in buffer (used for avg) */
58};
59
70void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample);
71
73void adc_init(void);
74
75#endif
uint32_t sum
Definition adc.h:54
uint8_t head
Definition adc.h:56
void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
Link between ChibiOS ADC drivers and Paparazzi adc_buffers.
Definition adc_arch.c:312
void adc_init(void)
Starts conversions.
Definition adc_arch.c:332
#define MAX_AV_NB_SAMPLE
Definition adc.h:40
uint16_t values[MAX_AV_NB_SAMPLE]
Definition adc.h:55
uint8_t av_nb_sample
Definition adc.h:57
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
Definition adc.h:53
static uint32_t s
uint16_t foo
Definition main_demo5.c:58
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.