Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
test_baro.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2009 Antoine Drouin <poinix@gmail.com>
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 /*
25  *
26  * test baro using interrupts
27  *
28  */
29 
30 #include BOARD_CONFIG
31 
32 #include "mcu.h"
33 
34 #include "mcu_periph/sys_time.h"
37 
38 static inline void main_init( void );
39 static inline void main_periodic_task( void );
40 static inline void main_event_task( void );
41 
42 static inline void main_on_baro_diff(void);
43 static inline void main_on_baro_abs(void);
44 
45 
46 int main(void) {
47  main_init();
48 
49  while(1) {
53  }
54 
55  return 0;
56 }
57 
58 static inline void main_init( void ) {
59  mcu_init();
61  booz2_analog_init();
62  baro_init();
64 }
65 
66 
67 
68 static inline void main_periodic_task( void ) {
69 
70  RunOnceEvery(2, {baro_periodic();});
71  RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
72  LED_PERIODIC();
73 
74 }
75 
76 
77 
78 static inline void main_event_task( void ) {
80 }
81 
82 
83 static inline void main_on_baro_diff(void) {
84 
85 }
86 
87 static inline void main_on_baro_abs(void) {
88  RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
89 }
void baro_periodic(void)
Definition: baro_board.c:56
#define BaroEvent(_b_abs_handler, _b_diff_handler)
Definition: baro_board.h:22
#define PERIODIC_FREQUENCY
Definition: imu_aspirin2.c:54
#define mcu_int_enable()
Definition: mcu_arch.h:32
static void main_init(void)
Definition: test_baro.c:58
int32_t absolute
Definition: baro.h:42
static void main_periodic_task(void)
Definition: test_baro.c:68
struct Baro baro
Definition: baro_board.c:34
Architecture independent timing functions.
int32_t differential
Definition: baro.h:43
int sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
Definition: sys_time.c:35
void baro_init(void)
Definition: baro_board.c:38
static bool_t sys_time_check_and_ack_timer(tid_t id)
Definition: sys_time.h:90
static void main_on_baro_diff(void)
Definition: test_baro.c:83
#define LED_PERIODIC()
Definition: led_hw.h:8
arch independent mcu ( Micro Controller Unit ) utilities
static void main_on_baro_abs(void)
Definition: test_baro.c:87
static void main_event_task(void)
Definition: test_baro.c:78
int main(void)
Definition: test_baro.c:46
void mcu_init(void)
Definition: mcu.c:57