ms4525.c
Go to the documentation of this file.
1 /*
2  ms4525.c : Airpseed Measurement Values
3 
4  Copyright (C) 2016 James Jackson
5 
6  This file is part of BreezySTM32.
7 
8  BreezySTM32 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 3 of the License, or
11  (at your option) any later version.
12 
13  BreezySTM32 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 BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <breezystm32.h>
23 
24 #include "math.h"
25 
26 bool airspeed_present = false;
27 bool barometer_present = false;
28 
29 void setup(void)
30 {
31  delay(500);
33 
35 
36 // barometer_present = ms5611_init();
37 }
38 
39 
40 
42 void loop(void)
43 {
44 // ms5611_async_update();
46 
47  delay(10);
48 
49 // if (ms5611_present())
50  {
51 // ms5611_async_read(&altitude, &pressure, &temperature);
52 // ms4525_set_atm((uint32_t) pressure);
53  }
54  if (ms4525_present())
55  {
56  float velocity, diff_pressure, temp;
57  ms4525_async_read(&diff_pressure, &temp, &velocity);
58 // printf("calibrated = %d\tvel: %d.%d m/s\tdiff_press: %d.%dPa\ttemp:%d.%dK\n",
59  printf("%d.%d,\t%d.%d,\t%d.%d,\t%d.%d\n",
60 // ms4525_calibrated(),
61  (int32_t)velocity, (int32_t)(fabs(velocity)*1000)%1000,
62  (int32_t)diff_pressure, (int32_t)(fabs(diff_pressure)*1000)%1000,
63  (int32_t)temp, (int32_t)(temp*1000)%1000,
64  (int32_t)pressure, (int32_t)(pressure*1000)%1000);
65  }
66  else
67  {
68  printf("no airspeed\n");
69  }
70 }
71 
bool ms4525_init()
Definition: drv_ms4525.c:40
void i2cInit(I2CDevice index)
Definition: drv_i2c.c:420
void loop(void)
Definition: ms4525.c:42
void setup(void)
Definition: ms4525.c:29
float altitude
Definition: ms4525.c:41
float pressure
Definition: ms4525.c:41
float temperature
Definition: ms4525.c:41
bool airspeed_present
Definition: ms4525.c:26
bool barometer_present
Definition: ms4525.c:27
float fabs(float x)
Definition: turbomath.cpp:491
void ms4525_async_read(float *differential_pressure, float *temp)
Definition: drv_ms4525.c:80
bool ms4525_present()
Definition: drv_ms4525.c:62
static volatile int16_t temp
Definition: drv_mpu6050.c:278
void ms4525_async_update()
Definition: drv_ms4525.c:53
void delay(uint32_t ms)
Definition: system.c:101


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:47