Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
trigger_ext.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 
32 #include "trigger_ext.h"
34 #include "subsystems/gps.h"
35 #include "mcu_periph/sys_time.h"
36 #include "mcu_periph/uart.h"
37 #include "pprzlink/messages.h"
39 
40 
41 void trigger_ext_init(void)
42 {
43  trig_ext_init();
44 }
45 
47 {
48  if (trig_ext_valid == TRUE) {
49  uint8_t ac_id = 0;
50  uint8_t turb_id = TURBINE_ID;
51  uint32_t sync_itow, cycle_time;
52 
54  cycle_time = msec_of_sys_time_ticks(delta_t0);
55 
56  DOWNLINK_SEND_WINDTURBINE_STATUS_(DefaultChannel, DefaultDevice,
57  &ac_id,
58  &turb_id,
59  &sync_itow,
60  &cycle_time);
61  trig_ext_valid = false;
62  }
63 }
64 
uint32_t trigger_t0
Definition: trigger_ext.c:33
uint8_t ac_id
Definition: sim_ap.c:45
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
Measure external trigger pulse at PPM input.
static uint32_t msec_of_sys_time_ticks(uint32_t ticks)
Definition: sys_time.h:158
volatile bool trig_ext_valid
Definition: trig_ext_hw.c:10
uint32_t delta_t0
Definition: trig_ext_hw.c:9
#define TRUE
Definition: std.h:4
Architecture independent timing functions.
Device independent GPS code (interface)
unsigned long uint32_t
Definition: types.h:18
void trigger_ext_init(void)
Definition: trigger_ext.c:41
unsigned char uint8_t
Definition: types.h:14
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:360
void trig_ext_init(void)
Definition: trig_ext_hw.c:26
void trigger_ext_periodic(void)
Definition: trigger_ext.c:46