Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
tfmini_i2c.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 OpenUAS <noreply@openuas.org>
3  * Thanks to Michal Podhradsky for SF11 work done
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
23 
31 #ifndef TFMINI_I2C_H
32 #define TFMINI_I2C_H
33 
34 #include "stdbool.h"
35 #include "mcu_periph/i2c.h"
36 
40 };
41 
42 struct TFMiniI2C {
43  struct i2c_transaction trans;
48  float dist;
49  float offset;
50  bool update_agl;
51  bool compensate_rotation; //< Do or not compensate for range value when main body is rotated
52 };
53 
54 extern struct TFMiniI2C tfmini_i2c;
55 
56 extern void tfmini_i2c_init(void);
57 extern void tfmini_i2c_event(void);
58 extern void tfmini_i2c_periodic(void);
59 extern void tfmini_i2c_downlink(void);
60 
61 #endif /* TFMINI_I2C_H */
I2C transaction structure.
Definition: i2c.h:93
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
float offset
offset to what one considers a zero distance to sensor in [m]
Definition: tfmini_i2c.h:49
struct TFMiniI2C tfmini_i2c
Definition: tfmini_i2c.c:125
void tfmini_i2c_downlink(void)
Definition: tfmini_i2c.c:247
void tfmini_i2c_init(void)
Set the default values at initialization.
Definition: tfmini_i2c.c:142
void tfmini_i2c_periodic(void)
Get the ranger current distance value.
Definition: tfmini_i2c.c:196
void tfmini_i2c_event(void)
Ranger event function Basically just check the progress of the transation to prevent overruns during ...
Definition: tfmini_i2c.c:167
bool update_agl
Do or don't update AGL ABI message.
Definition: tfmini_i2c.h:50
uint8_t addr
Definition: tfmini_i2c.h:44
bool compensate_rotation
Definition: tfmini_i2c.h:51
TFMiniI2CStatus
Definition: tfmini_i2c.h:37
@ TFMINI_I2C_PARSE
Definition: tfmini_i2c.h:39
@ TFMINI_I2C_ACQUIRE
Definition: tfmini_i2c.h:38
uint16_t raw_dist
raw non scaled value from sensor
Definition: tfmini_i2c.h:46
uint16_t strength
strength of reflect signal, not implemented ATM
Definition: tfmini_i2c.h:47
float dist
Sacled distance measured in [m].
Definition: tfmini_i2c.h:48
enum TFMiniI2CStatus status
Definition: tfmini_i2c.h:45
struct i2c_transaction trans
Definition: tfmini_i2c.h:43
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98