mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[sys_time] sys_time cleanup (#3580)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "mcu_periph/can_arch.h"
|
||||
#include "mcu_periph/can.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Mostly empty functions for Paparazzi compatibility,
|
||||
* since ChibiOS uses different system time functions.
|
||||
*/
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include BOARD_CONFIG
|
||||
#include <ch.h>
|
||||
@@ -44,7 +45,8 @@ static MUTEX_DECL(sys_time_mtx);
|
||||
*/
|
||||
static void thd_sys_tick(void *arg);
|
||||
static THD_WORKING_AREA(wa_thd_sys_tick, 1024);
|
||||
static void sys_tick_handler(void);
|
||||
|
||||
void sys_tick_handler(void);
|
||||
|
||||
static uint32_t cpu_ticks = 0;
|
||||
static uint32_t cpu_counter = 0;
|
||||
@@ -130,12 +132,6 @@ void sys_time_msleep(uint32_t ms)
|
||||
chThdSleepMilliseconds(ms);
|
||||
}
|
||||
|
||||
void sys_time_ssleep(uint8_t s)
|
||||
{
|
||||
chThdSleepSeconds(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sys_tick thread
|
||||
*/
|
||||
@@ -151,7 +147,7 @@ static __attribute__((noreturn)) void thd_sys_tick(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
static void sys_tick_handler(void)
|
||||
void sys_tick_handler(void)
|
||||
{
|
||||
chMtxLock(&sys_time_mtx);
|
||||
/* current time in sys_ticks */
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#ifndef SYS_TIME_ARCH_H
|
||||
#define SYS_TIME_ARCH_H
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
|
||||
@@ -41,9 +40,4 @@
|
||||
#define STM32_SYSCLK STM32_SYS_CK
|
||||
#endif
|
||||
|
||||
extern uint32_t get_sys_time_usec(void);
|
||||
extern uint32_t get_sys_time_usec100(void);
|
||||
extern uint32_t get_sys_time_msec(void);
|
||||
extern void sys_time_ssleep(uint8_t s);
|
||||
|
||||
#endif /* SYS_TIME_ARCH_H */
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "mcu_periph/hal_stm32_dma.h"
|
||||
#include "mcu_periph/timerDmaCache.h"
|
||||
#include "modules/actuators/esc_dshot_config.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -64,14 +65,6 @@ extern "C" {
|
||||
#endif // DSHOT_CHANNELS = X
|
||||
|
||||
|
||||
#if !defined STM32_SYSCLK && !defined STM32_SYS_CK
|
||||
#error neither STM32_SYSCLK or STM32_SYS_CK defined
|
||||
#endif
|
||||
#if !defined STM32_SYSCLK
|
||||
#define STM32_SYSCLK STM32_SYS_CK
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief structure defining dma channel
|
||||
* @note does not apply for DMAMUX MCU
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <stdnoreturn.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "microrl/microrl.h"
|
||||
#include "printf.h"
|
||||
//#include "stdutil.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
|
||||
|
||||
#define printScreen(...) {chprintf (chpg, __VA_ARGS__); chprintf (chpg, "\r\n");}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "modules/core/sys_mon_rtos.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include <ch.h>
|
||||
|
||||
#if !CH_DBG_STATISTICS
|
||||
|
||||
@@ -34,6 +34,7 @@ https://github.com/joewa/WS2812-LED-Driver_ChibiOS/
|
||||
#include "modules/light/light_ws2812_arch.h"
|
||||
#include "mcu_periph/hal_stm32_dma.h"
|
||||
#include "mcu_periph/gpio.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
|
||||
#include BOARD_CONFIG
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "mcu_periph/can_arch.h"
|
||||
#include "mcu_periph/can.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
@@ -20,18 +20,20 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/** @file arch/linux/mcu_periph/sys_time_arch.h
|
||||
/** @file arch/linux/mcu_periph/sys_time_arch.c
|
||||
* linux timing functions
|
||||
*/
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/timerfd.h>
|
||||
#include <time.h>
|
||||
#include "rt_priority.h"
|
||||
|
||||
#include "std.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef SYS_TIME_LED
|
||||
#include "led.h"
|
||||
#endif
|
||||
@@ -42,7 +44,8 @@
|
||||
|
||||
static struct timespec startup_time;
|
||||
|
||||
static void sys_tick_handler(void);
|
||||
void sys_tick_handler(void);
|
||||
|
||||
void *sys_time_thread_main(void *data);
|
||||
|
||||
#define NSEC_OF_SEC(sec) ((sec) * 1e9)
|
||||
@@ -109,7 +112,7 @@ void sys_time_arch_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sys_tick_handler(void)
|
||||
void sys_tick_handler(void)
|
||||
{
|
||||
/* get current time */
|
||||
struct timespec now;
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2009-2013 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file arch/linux/mcu_periph/sys_time_arch.h
|
||||
* linux timing functions
|
||||
*/
|
||||
|
||||
#ifndef SYS_TIME_ARCH_H
|
||||
#define SYS_TIME_ARCH_H
|
||||
|
||||
#include "std.h"
|
||||
#include <unistd.h>
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* WARNING: overflows after 71min34seconds!
|
||||
* @return current system time as uint32_t
|
||||
*/
|
||||
extern uint32_t get_sys_time_usec(void);
|
||||
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* WARNING: overflows after 7000 minutes!
|
||||
* @return current system time as uint32_t
|
||||
*/
|
||||
extern uint32_t get_sys_time_usec100(void);
|
||||
|
||||
/**
|
||||
* Get the time in milliseconds since startup.
|
||||
* @return milliseconds since startup as uint32_t
|
||||
*/
|
||||
extern uint32_t get_sys_time_msec(void);
|
||||
|
||||
|
||||
/** elapsed time in microsecs between two timespecs */
|
||||
static inline unsigned int sys_time_elapsed_us(struct timespec *prev, struct timespec *now)
|
||||
{
|
||||
time_t d_sec = now->tv_sec - prev->tv_sec;
|
||||
long d_nsec = now->tv_nsec - prev->tv_nsec;
|
||||
/* wrap if negative nanoseconds */
|
||||
if (d_nsec < 0) {
|
||||
d_sec -= 1;
|
||||
d_nsec += 1000000000L;
|
||||
}
|
||||
return d_sec * 1000000 + d_nsec / 1000;
|
||||
}
|
||||
|
||||
#endif /* SYS_TIME_ARCH_H */
|
||||
@@ -26,8 +26,9 @@
|
||||
*/
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "std.h"
|
||||
|
||||
void sys_tick_handler(void);
|
||||
|
||||
void sys_time_arch_init(void)
|
||||
{
|
||||
@@ -36,6 +37,24 @@ void sys_time_arch_init(void)
|
||||
sys_time.resolution_cpu_ticks = (uint32_t)(sys_time.resolution * sys_time.cpu_ticks_per_sec + 0.5);
|
||||
}
|
||||
|
||||
uint32_t get_sys_time_usec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
uint32_t get_sys_time_usec100(void)
|
||||
{
|
||||
return sys_time.nb_sec * 10000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem)/100;
|
||||
}
|
||||
|
||||
uint32_t get_sys_time_msec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000 +
|
||||
msec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
void sys_tick_handler(void)
|
||||
{
|
||||
sys_time.nb_tick++;
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2009-2011 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file arch/sim/mcu_periph/sys_time_arch.h
|
||||
* Simulator timing functions.
|
||||
*/
|
||||
|
||||
#ifndef SYS_TIME_ARCH_H
|
||||
#define SYS_TIME_ARCH_H
|
||||
|
||||
#include "std.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
extern void sys_tick_handler(void);
|
||||
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* @return microseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_usec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time in 100microseconds since startup.
|
||||
* @return 100microseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_usec100(void)
|
||||
{
|
||||
return sys_time.nb_sec * 10000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem)/100;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time in milliseconds since startup.
|
||||
* @return milliseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_msec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000 +
|
||||
msec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
#endif /* SYS_TIME_ARCH_H */
|
||||
@@ -28,7 +28,10 @@
|
||||
*/
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/cm3/systick.h>
|
||||
#include "std.h"
|
||||
|
||||
#include "libopencm3/cm3/systick.h"
|
||||
|
||||
@@ -68,6 +71,27 @@ void sys_time_arch_init(void)
|
||||
}
|
||||
|
||||
|
||||
uint32_t get_sys_time_usec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem) +
|
||||
usec_of_cpu_ticks(systick_get_reload() - systick_get_value());
|
||||
}
|
||||
|
||||
uint32_t get_sys_time_usec100(void)
|
||||
{
|
||||
return sys_time.nb_sec * 10000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem)/100 +
|
||||
usec_of_cpu_ticks(systick_get_reload() - systick_get_value())/100;
|
||||
}
|
||||
|
||||
uint32_t get_sys_time_msec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000 +
|
||||
msec_of_cpu_ticks(sys_time.nb_sec_rem) +
|
||||
msec_of_cpu_ticks(systick_get_reload() - systick_get_value());
|
||||
}
|
||||
|
||||
// FIXME : nb_tick rollover ???
|
||||
//
|
||||
// 97 days at 512hz
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2009-2011 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file arch/stm32/mcu_periph/sys_time_arch.h
|
||||
* @ingroup stm32_arch
|
||||
*
|
||||
* STM32 timing functions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SYS_TIME_ARCH_H
|
||||
#define SYS_TIME_ARCH_H
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/cm3/systick.h>
|
||||
#include "std.h"
|
||||
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* WARNING: overflows after 70min!
|
||||
* @return microseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_usec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem) +
|
||||
usec_of_cpu_ticks(systick_get_reload() - systick_get_value());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time in 100microseconds since startup.
|
||||
* WARNING: overflows after 7000min!
|
||||
* @return 100microseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_usec100(void)
|
||||
{
|
||||
return sys_time.nb_sec * 10000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem)/100 +
|
||||
usec_of_cpu_ticks(systick_get_reload() - systick_get_value())/100;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time in milliseconds since startup.
|
||||
* @return milliseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_msec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000 +
|
||||
msec_of_cpu_ticks(sys_time.nb_sec_rem) +
|
||||
msec_of_cpu_ticks(systick_get_reload() - systick_get_value());
|
||||
}
|
||||
|
||||
#endif /* SYS_TIME_ARCH_H */
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "mcu_periph/usb_serial.h"
|
||||
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
/* Max packet size for USB transfer */
|
||||
#define MAX_PACKET_SIZE 64
|
||||
|
||||
@@ -82,6 +82,8 @@ struct sys_time {
|
||||
|
||||
extern struct sys_time sys_time;
|
||||
|
||||
extern void sys_time_init(void);
|
||||
|
||||
/**
|
||||
* Sleep @param us microseconds
|
||||
*/
|
||||
@@ -93,7 +95,25 @@ void sys_time_usleep(uint32_t us);
|
||||
void sys_time_msleep(uint32_t ms);
|
||||
|
||||
|
||||
extern void sys_time_init(void);
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* WARNING: overflows after 70min!
|
||||
* @return microseconds since startup as uint32_t
|
||||
*/
|
||||
uint32_t get_sys_time_usec(void);
|
||||
|
||||
/**
|
||||
* Get the time in 100microseconds since startup.
|
||||
* WARNING: overflows after 7000min!
|
||||
* @return 100microseconds since startup as uint32_t
|
||||
*/
|
||||
uint32_t get_sys_time_usec100(void);
|
||||
|
||||
/**
|
||||
* Get the time in milliseconds since startup.
|
||||
* @return milliseconds since startup as uint32_t
|
||||
*/
|
||||
uint32_t get_sys_time_msec(void);
|
||||
|
||||
/**
|
||||
* Register a new system timer.
|
||||
@@ -228,10 +248,9 @@ static inline uint32_t nsec_of_cpu_ticks(uint32_t cpu_ticks)
|
||||
|
||||
#define USEC_OF_SEC(sec) ((sec) * 1e6)
|
||||
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
|
||||
/* architecture specific init implementation */
|
||||
extern void sys_time_arch_init(void);
|
||||
void sys_time_arch_init(void);
|
||||
|
||||
|
||||
/* Generic timer macros */
|
||||
#define SysTimeTimerStart(_t) { _t = get_sys_time_usec(); }
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "string.h"
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include <stdint.h>
|
||||
#include "peripherals/sts3032_regs.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "modules/px4_flash/px4_flash.h"
|
||||
#include "modules/px4_flash/protocol.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "modules/intermcu/intermcu_ap.h"
|
||||
|
||||
// Serial Port
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "mcu.h"
|
||||
#include "modules/radio_control/radio_control.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "mcu_periph/gpio.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "modules/intermcu/intermcu_fbw.h"
|
||||
#include "mcu.h"
|
||||
#include "modules/radio_control/radio_control.h"
|
||||
#include "mcu_periph/sys_time_arch.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
#include "mcu_periph/gpio.h"
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ int main(void)
|
||||
|
||||
|
||||
while (TRUE) {
|
||||
sys_time_ssleep(1);
|
||||
sys_time_msleep(1000);
|
||||
main_periodic_2();
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ int main(void)
|
||||
|
||||
while (1) {
|
||||
/* sleep for 1s */
|
||||
sys_time_ssleep(1);
|
||||
sys_time_msleep(1000);
|
||||
uart_transmit(&SERIAL_PORT, 'N');
|
||||
uart_transmit(&SERIAL_PORT, 'i');
|
||||
uart_transmit(&SERIAL_PORT, 'c');
|
||||
|
||||
@@ -82,7 +82,7 @@ int main(void)
|
||||
|
||||
while (1) {
|
||||
/* sleep for 1s */
|
||||
sys_time_ssleep(1);
|
||||
sys_time_msleep(1000);
|
||||
main_periodic_1();
|
||||
|
||||
/* sleep for 0.42s */
|
||||
|
||||
@@ -61,6 +61,7 @@ bool nps_bypass_ins;
|
||||
#define NPS_BYPASS_INS FALSE
|
||||
#endif
|
||||
|
||||
void sys_tick_handler(void);
|
||||
|
||||
//#if !defined (FBW) || !defined (AP)
|
||||
//#error NPS does not currently support dual processor simulation for FBW and AP on fixedwing!
|
||||
|
||||
@@ -73,6 +73,8 @@ bool nps_bypass_ins;
|
||||
#error "INDI_RPM_FEEDBACK can not be used in simulation!"
|
||||
#endif
|
||||
|
||||
void sys_tick_handler(void);
|
||||
|
||||
void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char *rc_dev)
|
||||
{
|
||||
nps_autopilot.launch = TRUE;
|
||||
|
||||
@@ -69,6 +69,8 @@ bool nps_bypass_ins;
|
||||
#error "INDI_RPM_FEEDBACK can not be used in simulation!"
|
||||
#endif
|
||||
|
||||
void sys_tick_handler(void);
|
||||
|
||||
void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char *rc_dev)
|
||||
{
|
||||
nps_autopilot.launch = TRUE;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2009-2011 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file mcu_periph/sys_time_arch.h
|
||||
* test timing functions.
|
||||
*/
|
||||
|
||||
#ifndef SYS_TIME_ARCH_H
|
||||
#define SYS_TIME_ARCH_H
|
||||
|
||||
#include "std.h"
|
||||
|
||||
extern void sys_tick_handler(void);
|
||||
|
||||
/**
|
||||
* Get the time in microseconds since startup.
|
||||
* @return microseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_usec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000000 +
|
||||
usec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time in milliseconds since startup.
|
||||
* @return milliseconds since startup as uint32_t
|
||||
*/
|
||||
static inline uint32_t get_sys_time_msec(void)
|
||||
{
|
||||
return sys_time.nb_sec * 1000 +
|
||||
msec_of_cpu_ticks(sys_time.nb_sec_rem);
|
||||
}
|
||||
|
||||
#endif /* SYS_TIME_ARCH_H */
|
||||
Reference in New Issue
Block a user