|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Architecture independent timing functions. More...
#include <inttypes.h>#include <stdlib.h>#include "std.h"#include <BOARD_CONFIG>Go to the source code of this file.
Data Structures | |
| struct | sys_time_timer |
| struct | sys_time |
Macros | |
| #define | SYS_TIME_NB_TIMER 16 |
| #define | SYS_TIME_FREQUENCY 1000 |
| (Default) sys_time timer frequency in Hz. | |
| #define | SYS_TIME_MSEC_PER_WEEK (1000UL * 60 * 60 * 24 * 7) |
| #define | SYS_TIME_UNIX_GPS_EPOCH_MS 315964800000ULL |
| unix time of the GPS epoch (1980-01-06) in ms | |
| #define | SYS_TIME_GPS_LEAP_SECONDS 18 |
| Difference between GPS time and UTC. | |
| #define | USEC_OF_SEC(sec) |
| #define | SysTimeTimerStart(_t) |
| #define | SysTimeTimer(_t) |
| #define | SysTimeTimerStop(_t) |
Typedefs | |
| typedef int8_t | tid_t |
| sys_time timer id type | |
| typedef void(* | sys_time_cb) (uint8_t id) |
Functions | |
| void | sys_time_init (void) |
| void | sys_time_usleep (uint32_t us) |
| Sleep. | |
| void | sys_time_msleep (uint32_t ms) |
| Sleep. | |
| uint32_t | get_sys_time_usec (void) |
| Get the time in microseconds since startup. | |
| uint32_t | get_sys_time_usec100 (void) |
| Get the time in 100microseconds since startup. | |
| uint32_t | get_sys_time_msec (void) |
| Get the time in milliseconds since startup. | |
| uint32_t | sys_time_rtc_millisecond (void) |
| Get the RTC time in milliseconds since midnight. | |
| uint32_t | get_sys_time_tow (void) |
| Get the GPS time of week in milliseconds. | |
| uint32_t | get_sys_time_unix (void) |
| Get the UTC unix time in seconds. | |
| uint64_t | get_sys_time_unix_msec (void) |
| Get the UTC unix time in milliseconds. | |
| void | sys_time_sync_gps (uint16_t week, uint32_t tow, uint32_t stamp) |
| Synchronize the time with a GPS measurement (has priority over the ground). | |
| void | sys_time_sync_unix (uint32_t unix_time, uint16_t unix_ms, uint32_t stamp) |
| Synchronize the time with the ground, only used without recent GPS sync. | |
| void | sys_time_parse_TIME_SYNC (uint8_t *buf) |
| Parse the TIME_SYNC datalink message (ground time). | |
| void | sys_time_rtc_set (uint32_t unix_time, uint16_t unix_ms) |
| Set the RTC to the UTC unix time (architecture specific, may do nothing). | |
| tid_t | sys_time_register_timer (float duration, sys_time_cb cb) |
| Register a new system timer. | |
| tid_t | sys_time_register_timer_offset (tid_t timer, float offset, sys_time_cb cb) |
| Register a new system timer with an fixed offset from another one. | |
| void | sys_time_cancel_timer (tid_t id) |
| Cancel a system timer by id. | |
| void | sys_time_update_timer (tid_t id, float duration) |
| Update the duration until a timer elapses. | |
| static bool | sys_time_check_and_ack_timer (tid_t id) |
| Check if timer has elapsed. | |
| static float | get_sys_time_float (void) |
| Get the time in seconds since startup. | |
| static uint32_t | sys_time_ticks_of_sec (float seconds) |
| static uint32_t | sys_time_ticks_of_msec (uint32_t msec) |
| static uint32_t | sys_time_ticks_of_usec (uint32_t usec) |
| static float | sec_of_sys_time_ticks (uint32_t ticks) |
| static uint32_t | msec_of_sys_time_ticks (uint32_t ticks) |
| static uint32_t | usec_of_sys_time_ticks (uint32_t ticks) |
| static uint32_t | cpu_ticks_of_sec (float seconds) |
| static uint32_t | cpu_ticks_of_usec (uint32_t usec) |
| static int32_t | signed_cpu_ticks_of_usec (int32_t usec) |
| static uint32_t | cpu_ticks_of_nsec (uint32_t nsec) |
| static uint32_t | msec_of_cpu_ticks (uint32_t cpu_ticks) |
| static uint32_t | usec_of_cpu_ticks (uint32_t cpu_ticks) |
| static uint32_t | nsec_of_cpu_ticks (uint32_t cpu_ticks) |
| void | sys_time_arch_init (void) |
Variables | |
| struct sys_time | sys_time |
Architecture independent timing functions.
Definition in file sys_time.h.
| struct sys_time_timer |
Definition at line 71 of file sys_time.h.
| Data Fields | ||
|---|---|---|
| sys_time_cb | cb | |
| uint32_t | duration | in SYS_TIME_TICKS |
| volatile bool | elapsed | |
| uint32_t | end_time | in SYS_TIME_TICKS |
| bool | in_use | |
| struct sys_time |
Definition at line 79 of file sys_time.h.
| Data Fields | ||
|---|---|---|
| uint32_t | cpu_ticks_per_sec | cpu ticks per second |
| uint32_t | gps_tow_sync | uptime in ms of the last GPS time of week sync |
| bool | gps_tow_synced | time of week synced with a GPS |
| uint32_t | gps_unix_sync | uptime in ms of the last GPS unix time sync |
| bool | gps_unix_synced | unix time synced with a GPS |
| uint64_t | ground_offset | last applied ground UTC unix time at startup in ms |
| bool | ground_synced | a ground time was applied |
| volatile uint32_t | nb_sec | full seconds since startup |
| volatile uint32_t | nb_sec_rem | remainder of seconds since startup in CPU_TICKS |
| volatile uint32_t | nb_tick | SYS_TIME_TICKS since startup. |
| float | resolution | sys_time_timer resolution in seconds |
| uint32_t | resolution_cpu_ticks | sys_time_timer resolution in cpu ticks |
| uint32_t | rtc_sync | uptime in ms of the last RTC update |
| uint32_t | ticks_per_sec | sys_time ticks per second (SYS_TIME_FREQUENCY) |
| struct sys_time_timer | timer[SYS_TIME_NB_TIMER] | |
| uint32_t | tow_offset | GPS time of week at startup in ms (0 until synced). |
| uint64_t | unix_offset | UTC unix time at startup in ms. |
| bool | unix_synced | unix time synced (GPS or ground) |
| #define SYS_TIME_FREQUENCY 1000 |
(Default) sys_time timer frequency in Hz.
sys_time.resolution is set from this define.
Definition at line 56 of file sys_time.h.
Referenced by pca9685_i2c_init(), sys_time_init(), and thd_sys_tick().
| #define SYS_TIME_GPS_LEAP_SECONDS 18 |
Difference between GPS time and UTC.
Definition at line 65 of file sys_time.h.
Referenced by gps_feed_value().
| #define SYS_TIME_MSEC_PER_WEEK (1000UL * 60 * 60 * 24 * 7) |
Definition at line 60 of file sys_time.h.
Referenced by get_sys_time_tow(), gps_feed_value(), set_tow(), sys_time_sync_gps(), and sys_time_sync_unix().
| #define SYS_TIME_NB_TIMER 16 |
Definition at line 44 of file sys_time.h.
Referenced by sys_tick_handler(), sys_time_check_and_ack_timer(), sys_time_init(), sys_time_register_timer(), and sys_time_register_timer_offset().
| #define SYS_TIME_UNIX_GPS_EPOCH_MS 315964800000ULL |
unix time of the GPS epoch (1980-01-06) in ms
Definition at line 61 of file sys_time.h.
Referenced by gps_feed_value(), sys_time_sync_gps(), and sys_time_sync_unix().
| #define SysTimeTimer | ( | _t | ) |
Definition at line 330 of file sys_time.h.
Referenced by actuators_asctec_v2_commit(), airspeed_ets_read_periodic(), baro_ets_read_periodic(), event_sysmon(), hott_event(), and periodic_sysmon().
| #define SysTimeTimerStart | ( | _t | ) |
Definition at line 329 of file sys_time.h.
Referenced by airspeed_ets_init(), baro_ets_init(), event_sysmon(), gps_mtk_read_message(), hott_event(), periodic_sysmon(), and sonar_bebop_init().
| #define SysTimeTimerStop | ( | _t | ) |
Definition at line 331 of file sys_time.h.
| #define USEC_OF_SEC | ( | sec | ) |
Definition at line 322 of file sys_time.h.
Referenced by actuators_asctec_v2_commit(), airspeed_ets_read_periodic(), baro_ets_read_periodic(), and thd_sys_tick().
| typedef void(* sys_time_cb) (uint8_t id) |
Definition at line 69 of file sys_time.h.
sys_time timer id type
Definition at line 68 of file sys_time.h.
Definition at line 300 of file sys_time.h.
References sys_time::cpu_ticks_per_sec.
Referenced by sys_tick_handler().
|
inlinestatic |
Definition at line 285 of file sys_time.h.
References sys_time::cpu_ticks_per_sec.
Referenced by sys_tick_handler().
Definition at line 290 of file sys_time.h.
References sys_time::cpu_ticks_per_sec.
Referenced by xtend_rssi_periodic().
|
inlinestatic |
Get the time in seconds since startup.
Definition at line 241 of file sys_time.h.
References sys_time::cpu_ticks_per_sec, sys_time::nb_sec, and sys_time::nb_sec_rem.
Referenced by accel_sp_cb(), actuators_faulhaber_periodic(), actuators_t4_uart_event(), actuators_uavcan_esc_status_cb(), agl_cb(), agl_dist_init(), agl_dist_timeout(), air_data_finish_calibration(), air_data_periodic(), air_data_start_calibration(), airspeed_cb(), airspeed_raw_cb(), autopilot_arming_check_motors_on(), autopilot_arming_set(), baro_raw_cb(), cc2500_delayMicroseconds(), check_anchor_timeout(), chirp_call(), ctrl_module_run(), dc_periodic(), diff_raw_cb(), ekf_run(), get_uavcan_status(), gps_cb(), gps_fix_valid(), guidance_indi_run_mode(), guidance_indi_run_mode(), gyro_cb(), hmc58xx_start_configure(), hx711_event(), imu_aspirin2_configure_mag_slave(), imu_mpu9250_configure_mag_slave(), incidence_cb(), ins_flow_init(), ins_flow_update(), logger_control_effectiveness_periodic(), logger_file_write_row(), mag_cb(), nav_lace_run(), nav_rosette_run(), nav_rosette_setup(), nav_trinity_run(), optical_flow_landing_init(), periodic_report_sysmon(), periodic_sys_id_auto_doublets(), pfc_actuators_run(), PID_divergence_control(), preflight_check(), pressure_diff_cb(), px4flow_i2c_downlink(), px4flow_i2c_frame_cb(), read_rc_setpoint_heading(), reset_all_vars(), reset_horizontal_vars(), reset_vertical_vars(), rotwing_state_feedback_cb(), rotwing_state_hover_motors_idling(), rotwing_state_hover_motors_running(), rotwing_state_periodic(), rotwing_state_pusher_motor_running(), rotwing_state_skew_angle_valid(), rpm_cb(), sdlog_chibios_init(), sdlog_write(), send_filter_status(), stabilization_attitude_read_rc_setpoint_eulers(), stabilization_attitude_read_rc_setpoint_eulers_f(), start_chirp(), start_doublet(), start_wave(), stop_chirp(), stop_doublet(), stop_wave(), sys_id_auto_doublets_on_activation(), sys_id_chirp_activate_handler(), sys_id_chirp_init(), sys_id_chirp_run(), sys_id_doublet_activate_handler(), sys_id_doublet_init(), sys_id_doublet_run(), sys_id_wave_activate_handler(), sys_id_wave_frequency_hz_set(), sys_id_wave_init(), sys_id_wave_lag_rad_set(), sys_id_wave_run(), temp_raw_cb(), uwb_ranging_cb(), vel_sp_cb(), vertical_ctrl_module_run(), and vertical_ctrl_optical_flow_cb().
| uint32_t get_sys_time_msec | ( | void | ) |
Get the time in milliseconds since startup.
Definition at line 105 of file sys_time_arch.c.
References cpu_counter, msec_of_cpu_ticks(), sys_time::nb_sec, sys_time::nb_sec_rem, and startup_time.
Referenced by ak8975_event(), ak8975_read(), approach_moving_target_enable(), bf_millis(), buzzer_tunes_periodic(), collective_tracking_control(), dc_ctrl_parrot_mykonos_command(), dc_ctrl_parrot_mykonos_periodic(), decay_map(), distributed_circular(), follow_diagonal_approach(), follow_me_parse_target_pos(), follow_me_set_wp(), gps_piksi_event(), gvf_control_2D(), gvf_ik_control_2D(), gvf_parametric_control_2D(), hackhd_command(), hackhd_periodic(), init_random(), ins_ext_pose_check_age(), mavlink_send_attitude(), mavlink_send_attitude(), mavlink_send_attitude_quaternion(), mavlink_send_global_position_int(), mavlink_send_highres_imu(), mavlink_send_local_position_ned(), mavlink_send_rc_channels(), mavlink_send_set_mode(), mavlink_send_system_time(), parseThetaTable(), reset_gamma_t0(), sbp_pos_ecef_callback(), sbus_common_decode_event(), send_downlink(), send_gvf(), send_gvf(), send_gvf_parametric(), spb_heartbeat_callback(), spektrum_init_sat(), spektrum_uart_check(), start_next_note(), target_get_pos(), target_get_vel(), target_parse_target_pos(), target_pos_set_current_offset(), uptime_msec(), and wind_estimator_periodic().
| uint32_t get_sys_time_tow | ( | void | ) |
Get the GPS time of week in milliseconds.
Synced from the GPS, or from the ground (TIME_SYNC) without GPS. Until synced this is the time since startup.
Definition at line 72 of file sys_time.c.
References SYS_TIME_MSEC_PER_WEEK, sys_time::tow_offset, and uptime_msec().
Referenced by gps_tow_from_sys_ticks().
| uint32_t get_sys_time_unix | ( | void | ) |
Get the UTC unix time in seconds.
Synced from the GPS, or from the ground (TIME_SYNC) without GPS.
Definition at line 87 of file sys_time.c.
References get_sys_time_unix_msec().
| uint64_t get_sys_time_unix_msec | ( | void | ) |
Get the UTC unix time in milliseconds.
Definition at line 77 of file sys_time.c.
References sys_time::unix_offset, sys_time::unix_synced, and uptime_msec().
Referenced by get_sys_time_unix().
| uint32_t get_sys_time_usec | ( | void | ) |
Get the time in microseconds since startup.
WARNING: overflows after 70min!
WARNING: overflows after 71min34seconds!
Definition at line 78 of file sys_time_arch.c.
References cpu_counter, sys_time::nb_sec, sys_time::nb_sec_rem, startup_time, and usec_of_cpu_ticks().
Referenced by ahrs_aligner_run(), ahrs_vectornav_event(), airspeed_adc_update(), airspeed_amsys_read_event(), airspeed_amsys_read_periodic(), airspeed_cb(), airspeed_ets_read_event(), airspeed_ets_read_periodic(), airspeed_uavcan_cb(), baro_amsys_read_event(), baro_apogee_event(), baro_bmp280_event(), baro_bmp3_event(), baro_bmp_event(), baro_dps310_event(), baro_ets_read_event(), baro_hca_read_event(), baro_mpl3115_read_event(), baro_MS5534A_event(), baro_ms5611_event(), baro_scp_event(), baro_sim_periodic(), baro_spa06_event(), bf_micros(), cloud_sensor_callback(), cloud_sim_detect(), decode_optical_flow_msg(), dps310_i2c_event(), dps310_i2c_periodic(), ekf2_time_us(), ekf_aw_propagate(), gps_cb(), gps_datalink_publish(), gps_feed_value(), gps_intermcu_parse_IMCU_REMOTE_GPS(), gps_mtk_msg(), gps_piksi_publish(), gps_sim_publish(), gps_sirf_msg(), gps_skytraq_msg(), gps_uavcan_cb(), gps_ubx_msg(), gps_ubx_parse_nav_daheading(), gps_ubx_parse_nav_relposned(), gps_udp_parse(), handle_ins_msg(), hott_periodic_event(), hx711_event(), imu_apogee_event(), imu_aspirin2_event(), imu_aspirin_event(), imu_aspirin_i2c_event(), imu_bebop_event(), imu_bmi088_event(), imu_cube_event(), imu_disco_event(), imu_heater_run(), imu_mpu9250_event(), imu_mpu_hmc_event(), imu_mpu_i2c_event(), imu_mpu_spi_event(), imu_nps_event(), imu_px4_event(), imu_px4fmu_event(), ins_alt_float_update_baro(), ins_alt_float_update_gps(), ins_ekf2_init(), ins_ekf2_parse_EXTERNAL_POSE(), ins_ekf2_update(), ins_ekf2_update_system_flags(), ins_ext_pose_msg_update(), invensense2_config(), invensense2_parse_data(), invensense3_456_config(), invensense3_456_parse_fifo_data(), invensense3_config(), invensense3_parse_fifo_data(), invensense3_parse_reg_data(), laser_range_array_parse_msg(), lidar_lite_periodic(), lidar_sf11_periodic(), lidar_vl53l5cx_periodic(), LWC_callback(), mag_hmc58xx_module_event(), mag_ist8310_module_event(), mag_lis3mdl_module_event(), mag_pitot_parse_msg(), mag_qmc5883l_module_event(), mag_rm3100_module_event(), mag_uavcan_cb(), mag_uavcan_cb2(), main(), mateksys3901l0x_parse(), mavlink_send_gps_global_origin(), mavlink_send_gps_raw_int(), meteo_stick_event(), ms45xx_i2c_event(), msec_of_stamp(), nmea_gps_msg(), nps_autopilot_run_step(), opticflow_module_run(), opticflow_pmw3901_event(), pdec_dispatch_frame(), pose_periodic(), px4flow_i2c_frame_cb(), range_msg_callback(), range_sensor_uavcan_cb(), reset_ref(), reset_vertical_ref(), sdp3x_event(), send_anchor_data(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), send_filter_status(), sensors_hitl_event(), sensors_hitl_parse_HITL_AIR_DATA(), sensors_hitl_parse_HITL_GPS(), sonar_adc_periodic(), sonar_bebop_event(), sonar_i2c_periodic(), sonar_pwm_read(), sonar_vl53l1x_publish(), spa06_event(), spa06_periodic(), stereocam_parse_msg(), sts3032_event(), superbitrf_event(), superbitrf_receive_packet_cb(), sys_time_parse_TIME_SYNC(), teraranger_event(), tfmini_i2c_periodic(), tfmini_send_abi(), v4l2_capture_thread(), video_thread_function(), and wind_estimation_quadrotor_periodic().
| uint32_t get_sys_time_usec100 | ( | void | ) |
Get the time in 100microseconds since startup.
WARNING: overflows after 7000min!
Get the time in 100microseconds since startup.
WARNING: overflows after 7000min!
WARNING: overflows after 7000 minutes!
Definition at line 94 of file sys_time_arch.c.
References cpu_counter, sys_time::nb_sec, sys_time::nb_sec_rem, startup_time, and usec_of_cpu_ticks().
Referenced by pprzlog_tp_init().
Definition at line 305 of file sys_time.h.
References cpu_ticks, and sys_time::cpu_ticks_per_sec.
Referenced by get_sys_time_msec().
Definition at line 270 of file sys_time.h.
References ticks, and sys_time::ticks_per_sec.
Referenced by windturbine_periodic().
Definition at line 315 of file sys_time.h.
References cpu_ticks, and sys_time::cpu_ticks_per_sec.
|
inlinestatic |
Definition at line 265 of file sys_time.h.
References sys_time::resolution, and ticks.
Definition at line 295 of file sys_time.h.
References sys_time::cpu_ticks_per_sec.
| void sys_time_arch_init | ( | void | ) |
Definition at line 59 of file sys_time_arch.c.
References CH_CFG_ST_FREQUENCY, sys_time::cpu_ticks_per_sec, sys_time::resolution, sys_time::resolution_cpu_ticks, rtc_ms_start, startup_time, sys_time_thread_main(), and thd_sys_tick().
Referenced by sys_time_init().
|
extern |
Cancel a system timer by id.
| id | Timer id. |
Definition at line 205 of file sys_time.c.
References sys_time_timer::cb, sys_time_timer::duration, sys_time_timer::elapsed, sys_time_timer::end_time, sys_time_timer::in_use, and sys_time::timer.
Referenced by mavlink_mission_cancel_timer(), and px4flash_event().
|
inlinestatic |
Check if timer has elapsed.
| id | Timer id |
Definition at line 226 of file sys_time.h.
References sys_time_timer::elapsed, SYS_TIME_NB_TIMER, and sys_time::timer.
Referenced by main(), main_ap_periodic(), main_fbw_periodic(), main_recovery_periodic(), mavlink_mission_periodic(), and px4flash_event().
|
extern |
Definition at line 263 of file sys_time.c.
References sys_time_timer::cb, sys_time_timer::duration, sys_time_timer::elapsed, sys_time_timer::end_time, sys_time::gps_tow_sync, sys_time::gps_tow_synced, sys_time::gps_unix_sync, sys_time::gps_unix_synced, sys_time::ground_offset, sys_time::ground_synced, sys_time_timer::in_use, sys_time::nb_sec, sys_time::nb_sec_rem, sys_time::nb_tick, sys_time::resolution, sys_time::rtc_sync, shell_add_entry(), sys_time_arch_init(), SYS_TIME_FREQUENCY, SYS_TIME_NB_TIMER, sys_time::ticks_per_sec, sys_time::timer, sys_time::tow_offset, sys_time::unix_offset, and sys_time::unix_synced.
Referenced by mcu_init().
| void sys_time_msleep | ( | uint32_t | ms | ) |
Sleep.
| ms | milliseconds |
Definition at line 135 of file sys_time_arch.c.
References sys_time_usleep().
Referenced by uavcan_tx().
| void sys_time_parse_TIME_SYNC | ( | uint8_t * | buf | ) |
Parse the TIME_SYNC datalink message (ground time).
Definition at line 221 of file sys_time.c.
References get_sys_time_usec(), and sys_time_sync_unix().
|
extern |
Register a new system timer.
| duration | Duration in seconds until the timer elapses. |
| cb | Callback function that is called from the ISR when timer elapses, or NULL |
Definition at line 172 of file sys_time.c.
References sys_time_timer::cb, sys_time_timer::duration, sys_time_timer::elapsed, sys_time_timer::end_time, sys_time_timer::in_use, sys_time::nb_tick, start_time, SYS_TIME_NB_TIMER, sys_time_ticks_of_sec(), and sys_time::timer.
Referenced by main_ap_init(), main_fbw_init(), main_init(), main_init(), main_init(), main_init(), main_init(), main_recovery_init(), mavlink_mission_set_timer(), and px4flash_init().
|
extern |
Register a new system timer with an fixed offset from another one.
| timer | timer providing start time and duration |
| offset | offset in seconds beetween the timers (will overlap if longer than duration) |
| cb | Callback function that is called from the ISR when timer elapses, or NULL |
Definition at line 188 of file sys_time.c.
References sys_time_timer::cb, sys_time_timer::duration, sys_time_timer::elapsed, sys_time_timer::end_time, sys_time_timer::in_use, offset, SYS_TIME_NB_TIMER, sys_time_ticks_of_sec(), and sys_time::timer.
Referenced by main_ap_init().
| uint32_t sys_time_rtc_millisecond | ( | void | ) |
Get the RTC time in milliseconds since midnight.
Definition at line 190 of file sys_time_arch.c.
References sys_time::cpu_ticks_per_sec, sys_time::nb_sec, sys_time::nb_sec_rem, and rtc_ms_start.
Set the RTC to the UTC unix time (architecture specific, may do nothing).
| unix_time | UTC unix time in seconds |
| unix_ms | milliseconds part of the unix time |
Set the RTC to the UTC unix time (architecture specific, may do nothing).
Definition at line 200 of file sys_time_arch.c.
Referenced by set_unix().
Synchronize the time with a GPS measurement (has priority over the ground).
| week | GPS week, 0 if unknown (only syncs the time of week) |
| tow | GPS time of week in milliseconds |
| stamp | get_sys_time_usec() timestamp at which tow was valid |
Definition at line 120 of file sys_time.c.
References sys_time::gps_tow_sync, sys_time::gps_tow_synced, sys_time::gps_unix_sync, sys_time::gps_unix_synced, msec_of_stamp(), set_tow(), set_unix(), SYS_TIME_GPS_LEAP_MS, SYS_TIME_MSEC_PER_WEEK, and SYS_TIME_UNIX_GPS_EPOCH_MS.
Referenced by gps_cb().
Synchronize the time with the ground, only used without recent GPS sync.
| unix_time | UTC unix time in seconds |
| unix_ms | milliseconds part of the unix time |
| stamp | get_sys_time_usec() timestamp at which the time was valid |
Definition at line 137 of file sys_time.c.
References sys_time::gps_tow_sync, sys_time::gps_tow_synced, sys_time::gps_unix_sync, sys_time::gps_unix_synced, sys_time::ground_offset, sys_time::ground_synced, msec_of_stamp(), offset, set_tow(), set_unix(), SYS_TIME_GPS_LEAP_MS, SYS_TIME_GPS_SYNC_TIMEOUT, SYS_TIME_GROUND_SYNC_THRESHOLD, SYS_TIME_MSEC_PER_WEEK, and SYS_TIME_UNIX_GPS_EPOCH_MS.
Referenced by sys_time_parse_TIME_SYNC().
Definition at line 255 of file sys_time.h.
References sys_time::ticks_per_sec.
|
inlinestatic |
Definition at line 250 of file sys_time.h.
References sys_time::ticks_per_sec.
Referenced by sys_tick_handler(), sys_time_register_timer(), sys_time_register_timer_offset(), and sys_time_update_timer().
Definition at line 260 of file sys_time.h.
References sys_time::ticks_per_sec.
Referenced by sys_tick_handler().
|
extern |
Update the duration until a timer elapses.
| id | Timer id |
| duration | Duration in seconds until the timer elapses. |
Definition at line 215 of file sys_time.c.
References sys_time_timer::duration, sys_time_timer::end_time, sys_time_ticks_of_sec(), and sys_time::timer.
Referenced by mavlink_mission_set_timer().
| void sys_time_usleep | ( | uint32_t | us | ) |
Sleep.
| us | microseconds |
Sleep.
using intermediate 64 bits variable to avoid wrapping
max sleep time is around 10 days (2^32 / CH_CFG_ST_FREQUENCY) at 10kHz
Definition at line 123 of file sys_time_arch.c.
Referenced by bf_delayMicroseconds(), cyrf6936_init(), humid_sht_thd(), initializeSensor(), main(), pcap01_init(), px4flash_event(), readRegister_blocking(), received_spektrum_soft_bind(), send_spektrum_bind(), sht_read_humid(), sht_read_serial(), sht_read_temp(), spektrum_bind(), spektrum_try_bind(), sys_time_msleep(), video_thread_function(), w5100_init(), writeRegister_blocking(), and xbee_dl_init().
Definition at line 310 of file sys_time.h.
References cpu_ticks, and sys_time::cpu_ticks_per_sec.
Referenced by get_sys_time_usec(), and get_sys_time_usec100().
Definition at line 275 of file sys_time.h.
References ticks, and sys_time::ticks_per_sec.
|
extern |
Definition at line 42 of file sys_time.c.