Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
infrared_i2c.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 ENAC
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 
23 /*
24  * Driver for i2c infrared sensor
25  */
26 
27 #ifndef SUBSYSTEMS_SENSORS_INFRARED_I2C_H
28 #define SUBSYSTEMS_SENSORS_INFRARED_I2C_H
29 
30 #include "std.h"
31 #include "generated/airframe.h"
33 #include "mcu_periph/i2c.h"
34 
35 extern struct Infrared_raw ir_i2c;
39 
40 extern struct i2c_transaction irh_trans, irv_trans;
41 
42 extern void infrared_i2c_init(void);
43 extern void infrared_i2c_update(void);
44 extern void infrared_i2c_hor_event(void);
45 extern void infrared_i2c_ver_event(void);
46 
47 #define infrared_i2cEvent() { \
48  if (irh_trans.status == I2CTransSuccess) infrared_i2c_hor_event(); \
49  if (irv_trans.status == I2CTransSuccess) infrared_i2c_ver_event(); \
50  }
51 
52 #define infrared_i2cDownlink() DOWNLINK_SEND_DEBUG_IR_I2C(DefaultChannel, DefaultDevice, &ir_i2c.ir1, &ir_i2c.ir2, &ir_i2c.ir3)
53 
54 #define infrared_i2c_SetConfWord(_v) { \
55  ir_i2c_conf_hor_done = false; \
56  ir_i2c_conf_ver_done = false; \
57  ir_i2c_conf_word = _v; \
58  }
59 
60 #endif // SUBSYSTEMS_SENSORS_INFRARED_I2C_H
uint8_t ir_i2c_conf_word
Definition: infrared_i2c.c:50
void infrared_i2c_update(void)
Definition: infrared_i2c.c:101
void infrared_i2c_hor_event(void)
Definition: infrared_i2c.c:133
bool ir_i2c_conf_hor_done
Definition: infrared_i2c.c:51
struct i2c_transaction irh_trans irv_trans
Definition: infrared_i2c.c:67
void infrared_i2c_ver_event(void)
Definition: infrared_i2c.c:195
void infrared_i2c_init(void)
Initialisation.
Definition: infrared_i2c.c:87
I2C transaction structure.
Definition: i2c.h:93
struct Infrared_raw ir_i2c
Definition: infrared_i2c.c:48
unsigned char uint8_t
Definition: types.h:14
bool ir_i2c_conf_ver_done
Definition: infrared_i2c.c:51
bool ir_i2c_data_hor_available
Definition: infrared_i2c.c:49
bool ir_i2c_data_ver_available
Definition: infrared_i2c.c:49
Architecture independent I2C (Inter-Integrated Circuit Bus) API.