Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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 "messages.h"
39 
40 
41 void trigger_ext_init ( void ) {
42  trig_ext_init();
43 }
44 
45 void trigger_ext_periodic( void ) {
46  if (trig_ext_valid == TRUE) {
47  uint8_t ac_id = 0;
48  uint8_t turb_id = TURBINE_ID;
49  uint32_t sync_itow, cycle_time;
50 
52  cycle_time = msec_of_sys_time_ticks(delta_t0);
53 
54  DOWNLINK_SEND_WINDTURBINE_STATUS_(DefaultChannel, DefaultDevice,
55  &ac_id,
56  &turb_id,
57  &sync_itow,
58  &cycle_time );
60  }
61 }
62 
uint32_t trigger_t0
Definition: trigger_ext.c:33
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
Measure external trigger pulse at PPM input.
volatile bool_t trig_ext_valid
Definition: trig_ext_hw.c:10
static uint32_t msec_of_sys_time_ticks(uint32_t ticks)
Definition: sys_time.h:147
#define FALSE
Definition: imu_chimu.h:141
uint32_t delta_t0
Definition: trig_ext_hw.c:9
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
#define TRUE
Definition: imu_chimu.h:144
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:48
void trig_ext_init(void)
Definition: trig_ext_hw.c:25
void trigger_ext_periodic(void)
Definition: trigger_ext.c:45
uint8_t ac_id
Definition: jsbsim_hw.c:27