Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
max11040.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Martin Mueller
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 
28 #include "led.h"
29 #include "mcu_periph/uart.h"
30 #include "messages.h"
32 #include "max11040.h"
33 #include "adcs/max11040_hw.h"
34 
42 
43 
44 void max11040_init( void ) {
47  max11040_count = 0;
48  max11040_buf_in = 0;
49  max11040_buf_out = 0;
50 
52 }
53 
54 void max11040_periodic(void) {
55 #ifdef MAX11040_DEBUG
56  float max11040_values_f[16];
57  int i;
58 
60 // LED_TOGGLE(3);
61  for (i=0; i<16; i++) {
62  /* we assume that the buffer will be full always in this test mode anyway */
63  max11040_values_f[i] = (max11040_values[max11040_buf_in][i] * 2.2) / 8388608.0;
64  }
65 
66  DOWNLINK_SEND_TURB_PRESSURE_VOLTAGE(
68  &max11040_values_f[0],
69  &max11040_values_f[1],
70  &max11040_values_f[2],
71  &max11040_values_f[3],
72  &max11040_values_f[4],
73  &max11040_values_f[5],
74  &max11040_values_f[6],
75  &max11040_values_f[7],
76  &max11040_values_f[8],
77  &max11040_values_f[9],
78  &max11040_values_f[10],
79  &max11040_values_f[11],
80  &max11040_values_f[12],
81  &max11040_values_f[13],
82  &max11040_values_f[14],
83  &max11040_values_f[15] );
85  }
86 #endif
87 }
88 
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define MAX11040_RESET
Definition: max11040.h:20
void max11040_init(void)
Definition: max11040.c:44
volatile uint8_t max11040_data
Definition: max11040.c:36
#define MAXM_NB_CHAN
Definition: max11040.h:7
volatile uint32_t max11040_buf_in
Definition: max11040.c:40
unsigned long uint32_t
Definition: types.h:18
volatile uint32_t max11040_timestamp[MAX11040_BUF_SIZE]
Definition: max11040.c:38
signed long int32_t
Definition: types.h:19
volatile uint8_t max11040_status
Definition: max11040.c:35
void max11040_periodic(void)
Definition: max11040.c:54
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t max11040_count
Definition: max11040.c:39
arch independent LED (Light Emitting Diodes) API
volatile int32_t max11040_values[MAX11040_BUF_SIZE][MAXM_NB_CHAN]
Definition: max11040.c:37
#define MAX11040_DATA_AVAILABLE
Definition: max11040.h:29
#define MAX11040_BUF_SIZE
Definition: max11040.h:9
#define MAX11040_IDLE
Definition: max11040.h:28
volatile uint32_t max11040_buf_out
Definition: max11040.c:41
void max11040_hw_init(void)
Definition: max11040_hw.c:276