mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
187:0387e8f68319
Parent:
186:707f6e361f3e
Child:
188:bcfe06ba3d64
--- a/drivers/Timer.cpp	Fri Jun 22 16:45:37 2018 +0100
+++ b/drivers/Timer.cpp	Thu Sep 06 13:40:20 2018 +0100
@@ -21,21 +21,24 @@
 
 namespace mbed {
 
-Timer::Timer() : _running(), _start(), _time(), _ticker_data(get_us_ticker_data()), _lock_deepsleep(true) {
+Timer::Timer() : _running(), _start(), _time(), _ticker_data(get_us_ticker_data()), _lock_deepsleep(true)
+{
     reset();
 }
 
-Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker_data(data), _lock_deepsleep(true) {
+Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker_data(data), _lock_deepsleep(true)
+{
     reset();
 #if DEVICE_LPTICKER
     _lock_deepsleep = (data != get_lp_ticker_data());
 #endif
 }
 
-Timer::~Timer() {
+Timer::~Timer()
+{
     core_util_critical_section_enter();
     if (_running) {
-        if(_lock_deepsleep) {
+        if (_lock_deepsleep) {
             sleep_manager_unlock_deep_sleep();
         }
     }
@@ -43,10 +46,11 @@
     core_util_critical_section_exit();
 }
 
-void Timer::start() {
+void Timer::start()
+{
     core_util_critical_section_enter();
     if (!_running) {
-        if(_lock_deepsleep) {
+        if (_lock_deepsleep) {
             sleep_manager_lock_deep_sleep();
         }
         _start = ticker_read_us(_ticker_data);
@@ -55,11 +59,12 @@
     core_util_critical_section_exit();
 }
 
-void Timer::stop() {
+void Timer::stop()
+{
     core_util_critical_section_enter();
     _time += slicetime();
     if (_running) {
-        if(_lock_deepsleep) {
+        if (_lock_deepsleep) {
             sleep_manager_unlock_deep_sleep();
         }
     }
@@ -67,26 +72,31 @@
     core_util_critical_section_exit();
 }
 
-int Timer::read_us() {
+int Timer::read_us()
+{
     return read_high_resolution_us();
 }
 
-float Timer::read() {
+float Timer::read()
+{
     return (float)read_us() / 1000000.0f;
 }
 
-int Timer::read_ms() {
+int Timer::read_ms()
+{
     return read_high_resolution_us() / 1000;
 }
 
-us_timestamp_t Timer::read_high_resolution_us() {
+us_timestamp_t Timer::read_high_resolution_us()
+{
     core_util_critical_section_enter();
     us_timestamp_t time = _time + slicetime();
     core_util_critical_section_exit();
     return time;
 }
 
-us_timestamp_t Timer::slicetime() {
+us_timestamp_t Timer::slicetime()
+{
     us_timestamp_t ret = 0;
     core_util_critical_section_enter();
     if (_running) {
@@ -96,14 +106,16 @@
     return ret;
 }
 
-void Timer::reset() {
+void Timer::reset()
+{
     core_util_critical_section_enter();
     _start = ticker_read_us(_ticker_data);
     _time = 0;
     core_util_critical_section_exit();
 }
 
-Timer::operator float() {
+Timer::operator float()
+{
     return read();
 }