Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
humid_dpicco.c
Go to the documentation of this file.
1 
9 
10 #include "mcu_periph/i2c.h"
11 #include "led.h"
12 #include "mcu_periph/uart.h"
13 #include "messages.h"
15 
16 #ifndef DOWNLINK_DEVICE
17 #define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
18 #endif
19 
20 #ifndef DPICCO_I2C_DEV
21 #define DPICCO_I2C_DEV i2c0
22 #endif
23 
24 #define DPICCO_SLAVE_ADDR 0xF0
25 
27 
30 
32 
33 
34 void dpicco_init( void ) {
36 }
37 
38 void dpicco_periodic( void ) {
39  /* init read */
41 }
42 
43 void dpicco_event( void ) {
44 
46 //LED_TOGGLE(2);
47 
48  dpicco_val[0] = (dpicco_trans.buf[0]<<8) | dpicco_trans.buf[1];
49  dpicco_val[1] = (dpicco_trans.buf[2]<<8) | dpicco_trans.buf[3];
50 
53 
54  DOWNLINK_SEND_DPICCO_STATUS(DefaultChannel, DefaultDevice, &dpicco_val[0], &dpicco_val[1], &dpicco_humid, &dpicco_temp);
56  }
57 }
unsigned short uint16_t
Definition: types.h:16
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define I2CReceive(_p, _t, _s_addr, _len)
Definition: i2c.h:140
#define DPICCO_HUMID_RANGE
Definition: humid_dpicco.h:7
#define DPICCO_TEMP_MAX
Definition: humid_dpicco.h:9
float dpicco_temp
Definition: humid_dpicco.c:29
uint16_t dpicco_val[2]
Definition: humid_dpicco.c:26
enum I2CTransactionStatus status
Definition: i2c.h:47
void dpicco_periodic(void)
Definition: humid_dpicco.c:38
#define DPICCO_TEMP_OFFS
Definition: humid_dpicco.h:11
volatile uint8_t buf[I2C_BUF_LEN]
Definition: i2c.h:46
void dpicco_event(void)
Definition: humid_dpicco.c:43
float dpicco_humid
Definition: humid_dpicco.c:28
arch independent LED (Light Emitting Diodes) API
#define DPICCO_I2C_DEV
Definition: humid_dpicco.c:21
#define DPICCO_SLAVE_ADDR
Definition: humid_dpicco.c:24
#define DPICCO_HUMID_MAX
Definition: humid_dpicco.h:6
struct i2c_transaction dpicco_trans
Definition: humid_dpicco.c:31
void dpicco_init(void)
Definition: humid_dpicco.c:34
#define DPICCO_TEMP_RANGE
Definition: humid_dpicco.h:10