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
test_float.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 #include <math.h>
25 
26 #include BOARD_CONFIG
27 #include "mcu.h"
28 #include "mcu_periph/sys_time.h"
30 #include "led.h"
31 static inline void main_init( void );
32 static inline void main_periodic( void );
33 
34 
35 int main(void) {
36 
37  main_init();
38 
39  while (1) {
41  main_periodic();
42  }
43  return 0;
44 }
45 
46 static inline void main_init( void ) {
47  mcu_init();
49 }
50 
51 static inline void main_periodic( void ) {
52  static float f = 0.1f;
53  f += 0.001;
54  float f1 = sinf(f); // ok
55  static double d = 0.1;
56  d += 0.0025;
57  double d1 = sin(d);
58 
59  float i = sqrt(f); // ok
60  //float i = powf(f1, f1); // nok
61  //float i = atan2(f, f); // ok
62  RunOnceEvery(10, {DOWNLINK_SEND_TEST_FORMAT(DefaultChannel, DefaultDevice, &d1, &i);});
63 
64  uint16_t blaaa = f+d;
65 
66  RunOnceEvery(10, {DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &blaaa);});
67  LED_PERIODIC();
68 }
69 
70 
71 
unsigned short uint16_t
Definition: types.h:16
static uint16_t d1
Definition: baro_MS5534A.c:196
static void main_periodic(void)
Definition: test_float.c:51
#define PERIODIC_FREQUENCY
Definition: imu_aspirin2.c:54
Architecture independent timing functions.
int sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
Definition: sys_time.c:35
static bool_t sys_time_check_and_ack_timer(tid_t id)
Definition: sys_time.h:90
#define LED_PERIODIC()
Definition: led_hw.h:8
arch independent mcu ( Micro Controller Unit ) utilities
int main(void)
Definition: test_float.c:35
arch independent LED (Light Emitting Diodes) API
static void main_init(void)
Definition: test_float.c:46
void mcu_init(void)
Definition: mcu.c:57