Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
windturbine.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 
30 #include "meteo/windturbine.h"
31 #include "core/trigger_ext.h"
32 #include "modules/gps/gps.h"
33 #include "mcu_periph/sys_time.h"
34 
35 
36 #include "mcu_periph/uart.h"
37 #include "pprzlink/messages.h"
39 
40 
42 {
43  if (trigger_ext_valid == TRUE) {
44  uint8_t ac_id = 0;
45  uint8_t turb_id = TURBINE_ID;
46  uint32_t sync_itow, cycle_time;
47 
50 
51  DOWNLINK_SEND_WINDTURBINE_STATUS_(DefaultChannel, DefaultDevice,
52  &ac_id,
53  &turb_id,
54  &sync_itow,
55  &cycle_time);
56  trigger_ext_valid = false;
57  }
58 }
59 
uint32_t gps_tow_from_sys_ticks(uint32_t sys_ticks)
Convert time in sys_time ticks to GPS time of week.
Definition: gps.c:393
Device independent GPS code (interface)
#define TRUE
Definition: std.h:4
Architecture independent timing functions.
static uint32_t msec_of_sys_time_ticks(uint32_t ticks)
Definition: sys_time.h:167
uint32_t trigger_t0
Definition: trigger_ext.c:33
volatile bool trigger_ext_valid
Definition: trigger_ext.c:35
uint32_t trigger_delta_t0
Definition: trigger_ext.c:34
Measure external trigger pulse at PPM input (default).
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
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
void windturbine_periodic(void)
Definition: windturbine.c:41
This measures a trigger pulse length (e.g.