Browse Source

AP_RTC: added get_semaphore()

mission-4.1.18
Andrew Tridgell 5 years ago committed by binsir
parent
commit
e9fe85bbff
  1. 1
      libraries/AP_RTC/AP_RTC.cpp
  2. 6
      libraries/AP_RTC/AP_RTC.h

1
libraries/AP_RTC/AP_RTC.cpp

@ -63,6 +63,7 @@ void AP_RTC::set_utc_usec(uint64_t time_utc_usec, source_type type) @@ -63,6 +63,7 @@ void AP_RTC::set_utc_usec(uint64_t time_utc_usec, source_type type)
// can't allow time to go backwards, ever
return;
}
WITH_SEMAPHORE(rsem);
rtc_shift = tmp;

6
libraries/AP_RTC/AP_RTC.h

@ -49,9 +49,15 @@ public: @@ -49,9 +49,15 @@ public:
return _singleton;
}
// allow threads to lock against RTC update
HAL_Semaphore &get_semaphore(void) {
return rsem;
}
private:
static AP_RTC *_singleton;
HAL_Semaphore_Recursive rsem;
source_type rtc_source_type = SOURCE_NONE;
int64_t rtc_shift;

Loading…
Cancel
Save