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