Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sonar_maxbotix.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2010 Gautier Hattenberger
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
23 
25 #include "mcu_periph/adc.h"
26 
29 
30 static struct adc_buf sonar_adc;
31 
32 void maxbotix_init(void) {
33  sonar_meas = 0;
35 
36  adc_buf_channel(ADC_CHANNEL_SONAR, &sonar_adc, DEFAULT_AV_NB_SAMPLE);
37 }
38 
41 void maxbotix_read(void) {
44 }
45 
simple driver to deal with one maxbotix sensor
unsigned short uint16_t
Definition: types.h:16
bool_t sonar_data_available
uint8_t av_nb_sample
Definition: adc.h:64
arch independent ADC (Analog to Digital Converter) API
uint32_t sum
Definition: adc.h:61
#define FALSE
Definition: imu_chimu.h:141
static struct adc_buf sonar_adc
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
Definition: adc.h:60
void maxbotix_init(void)
#define TRUE
Definition: imu_chimu.h:144
void adc_buf_channel(uint8_t adc_channel __attribute__((unused)), struct adc_buf *s __attribute__((unused)), uint8_t av_nb_sample __attribute__((unused)))
Required by infrared.c:ir_init()
Definition: jsbsim_ir.c:35
void maxbotix_read(void)
Read ADC value to update sonar measurement.
#define DEFAULT_AV_NB_SAMPLE
Definition: adc.h:48
uint16_t sonar_meas