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
max11040.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2010 Martin Mueller
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 
30 #include "led.h"
31 #include "mcu_periph/uart.h"
32 #include "messages.h"
34 #include "max11040.h"
35 #include "adcs/max11040_hw.h"
36 
44 
45 
46 void max11040_init( void ) {
49  max11040_count = 0;
50  max11040_buf_in = 0;
51  max11040_buf_out = 0;
52 
54 }
55 
56 void max11040_periodic(void) {
57 #ifdef MAX11040_DEBUG
58  float max11040_values_f[16];
59  int i;
60 
62 // LED_TOGGLE(3);
63  for (i=0; i<16; i++) {
64  /* we assume that the buffer will be full always in this test mode anyway */
65  max11040_values_f[i] = (max11040_values[max11040_buf_in][i] * 2.2) / 8388608.0;
66  }
67 
68  DOWNLINK_SEND_TURB_PRESSURE_VOLTAGE(
70  &max11040_values_f[0],
71  &max11040_values_f[1],
72  &max11040_values_f[2],
73  &max11040_values_f[3],
74  &max11040_values_f[4],
75  &max11040_values_f[5],
76  &max11040_values_f[6],
77  &max11040_values_f[7],
78  &max11040_values_f[8],
79  &max11040_values_f[9],
80  &max11040_values_f[10],
81  &max11040_values_f[11],
82  &max11040_values_f[12],
83  &max11040_values_f[13],
84  &max11040_values_f[14],
85  &max11040_values_f[15] );
87  }
88 #endif
89 }
90 
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define MAX11040_RESET
Definition: max11040.h:20
void max11040_init(void)
Definition: max11040.c:46
volatile uint8_t max11040_data
Definition: max11040.c:38
#define MAXM_NB_CHAN
Definition: max11040.h:7
volatile uint32_t max11040_buf_in
Definition: max11040.c:42
unsigned long uint32_t
Definition: types.h:18
volatile uint32_t max11040_timestamp[MAX11040_BUF_SIZE]
Definition: max11040.c:40
signed long int32_t
Definition: types.h:19
volatile uint8_t max11040_status
Definition: max11040.c:37
void max11040_periodic(void)
Definition: max11040.c:56
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t max11040_count
Definition: max11040.c:41
arch independent LED (Light Emitting Diodes) API
volatile int32_t max11040_values[MAX11040_BUF_SIZE][MAXM_NB_CHAN]
Definition: max11040.c:39
#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:43
void max11040_hw_init(void)
Definition: max11040_hw.c:273