mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/Ticker.cpp
- Revision:
- 189:f392fc9709a3
- Parent:
- 187:0387e8f68319
--- a/drivers/Ticker.cpp Thu Nov 08 11:46:34 2018 +0000 +++ b/drivers/Ticker.cpp Wed Feb 20 22:31:08 2019 +0000 @@ -1,5 +1,6 @@ /* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited + * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,4 +53,16 @@ } } +void Ticker::attach_us(Callback<void()> func, us_timestamp_t t) +{ + core_util_critical_section_enter(); + // lock only for the initial callback setup and this is not low power ticker + if (!_function && _lock_deepsleep) { + sleep_manager_lock_deep_sleep(); + } + _function = func; + setup(t); + core_util_critical_section_exit(); +} + } // namespace mbed