Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
test_baro.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Antoine Drouin <poinix@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 /*
23  *
24  * test baro using interrupts
25  *
26  */
27 
28 #include BOARD_CONFIG
29 
30 #include "mcu.h"
31 
32 #include "mcu_periph/sys_time.h"
35 
36 static inline void main_init( void );
37 static inline void main_periodic_task( void );
38 static inline void main_event_task( void );
39 
40 static inline void main_on_baro_diff(void);
41 static inline void main_on_baro_abs(void);
42 
43 
44 int main(void) {
45  main_init();
46 
47  while(1) {
51  }
52 
53  return 0;
54 }
55 
56 static inline void main_init( void ) {
57  mcu_init();
59  booz2_analog_init();
60  baro_init();
62 }
63 
64 
65 
66 static inline void main_periodic_task( void ) {
67 
68  RunOnceEvery(2, {baro_periodic();});
69  RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
70  LED_PERIODIC();
71 
72 }
73 
74 
75 
76 static inline void main_event_task( void ) {
78 }
79 
80 
81 static inline void main_on_baro_diff(void) {
82 
83 }
84 
85 static inline void main_on_baro_abs(void) {
86  RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
87 }
void mcu_init(void)
Microcontroller peripherals initialization.
Definition: mcu.c:61
Common barometric sensor implementation.
#define BaroEvent(_b_abs_handler, _b_diff_handler)
Definition: baro_board.h:55
static void main_on_baro_diff(void)
Definition: test_baro.c:81
void baro_init(void)
Definition: baro_board.c:42
static void main_event_task(void)
Definition: test_baro.c:76
void baro_periodic(void)
Definition: baro_board.c:50
int main(void)
Definition: test_baro.c:44
#define mcu_int_enable()
Definition: mcu_arch.h:37
int32_t absolute
Definition: baro.h:41
Architecture independent timing functions.
static void main_init(void)
Definition: test_baro.c:56
int32_t differential
Definition: baro.h:42
int sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
Definition: sys_time.c:37
static bool_t sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
Definition: sys_time.h:111
static void main_periodic_task(void)
Definition: test_baro.c:66
struct Baro baro
Definition: baro_board.c:36
#define LED_PERIODIC()
Definition: led_hw.h:8
Arch independent mcu ( Micro Controller Unit ) utilities.
#define PERIODIC_FREQUENCY
Definition: imu_aspirin2.c:54
static void main_on_baro_abs(void)
Definition: test_baro.c:85