Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 "pprzlink/messages.h"
32 #include "max11040.h"
33 #include "adcs/max11040_hw.h"
34 
42 
43 
44 void max11040_init(void)
45 {
48  max11040_count = 0;
49  max11040_buf_in = 0;
50  max11040_buf_out = 0;
51 
52  max11040_hw_init();
53 }
54 
56 {
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 LED (Light Emitting Diodes) API
volatile uint8_t max11040_data
Definition: max11040.c:36
volatile uint8_t max11040_status
Definition: max11040.c:35
volatile int32_t max11040_values[MAX11040_BUF_SIZE][MAXM_NB_CHAN]
Definition: max11040.c:37
volatile uint32_t max11040_buf_in
Definition: max11040.c:40
void max11040_periodic(void)
Definition: max11040.c:55
volatile uint32_t max11040_buf_out
Definition: max11040.c:41
volatile uint8_t max11040_count
Definition: max11040.c:39
volatile uint32_t max11040_timestamp[MAX11040_BUF_SIZE]
Definition: max11040.c:38
void max11040_init(void)
Definition: max11040.c:44
#define MAX11040_BUF_SIZE
Definition: max11040.h:9
#define MAXM_NB_CHAN
Definition: max11040.h:7
#define MAX11040_RESET
Definition: max11040.h:20
#define MAX11040_IDLE
Definition: max11040.h:28
#define MAX11040_DATA_AVAILABLE
Definition: max11040.h:29
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98