Paparazzi UAS  v5.15_devel-112-g521f3cf
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 "subsystems/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 
uint8_t ac_id
Definition: sim_ap.c:45
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static uint32_t msec_of_sys_time_ticks(uint32_t ticks)
Definition: sys_time.h:158
This measures a trigger pulse length (e.g.
#define TRUE
Definition: std.h:4
Architecture independent timing functions.
Device independent GPS code (interface)
unsigned long uint32_t
Definition: types.h:18
volatile bool trigger_ext_valid
Definition: trigger_ext.c:35
unsigned char uint8_t
Definition: types.h:14
Measure external trigger pulse at PPM input (default).
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:356
uint32_t trigger_delta_t0
Definition: trigger_ext.c:34
uint32_t trigger_t0
Definition: trig_ext_hw.c:8
void windturbine_periodic(void)
Definition: windturbine.c:41