【mbed OS5対応バージョン】データの保存、更新、取得ができるWebサービス「milkcocoa」に接続し、データのプッシュ、送信、取得ができるライブラリです。 https://mlkcca.com/

Dependents:   mbed-os-example-wifi-milkcocoa MilkcocoaOsSample_Eth MilkcocoaOsSample_ESP8266 MilkcocoaOsSample_Eth_DigitalIn

Committer:
jksoft
Date:
Mon Mar 26 04:49:20 2018 +0000
Revision:
13:61e0cc093180
Parent:
9:5c195c1036da
???????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 9:5c195c1036da 1 /* mbed Microcontroller Library
jksoft 9:5c195c1036da 2 * Copyright (c) 2006-2013 ARM Limited
jksoft 9:5c195c1036da 3 *
jksoft 9:5c195c1036da 4 * Licensed under the Apache License, Version 2.0 (the "License");
jksoft 9:5c195c1036da 5 * you may not use this file except in compliance with the License.
jksoft 9:5c195c1036da 6 * You may obtain a copy of the License at
jksoft 9:5c195c1036da 7 *
jksoft 9:5c195c1036da 8 * http://www.apache.org/licenses/LICENSE-2.0
jksoft 9:5c195c1036da 9 *
jksoft 9:5c195c1036da 10 * Unless required by applicable law or agreed to in writing, software
jksoft 9:5c195c1036da 11 * distributed under the License is distributed on an "AS IS" BASIS,
jksoft 9:5c195c1036da 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jksoft 9:5c195c1036da 13 * See the License for the specific language governing permissions and
jksoft 9:5c195c1036da 14 * limitations under the License.
jksoft 9:5c195c1036da 15 */
jksoft 9:5c195c1036da 16 #ifndef MBED_OLDTIMER_H
jksoft 9:5c195c1036da 17 #define MBED_OLDTIMER_H
jksoft 9:5c195c1036da 18
jksoft 9:5c195c1036da 19 #include "platform/platform.h"
jksoft 9:5c195c1036da 20 #include "hal/ticker_api.h"
jksoft 9:5c195c1036da 21 #include "platform/NonCopyable.h"
jksoft 9:5c195c1036da 22
jksoft 9:5c195c1036da 23 /** \addtogroup drivers */
jksoft 9:5c195c1036da 24
jksoft 9:5c195c1036da 25 /** A general purpose timer
jksoft 9:5c195c1036da 26 *
jksoft 9:5c195c1036da 27 * @note Synchronization level: Interrupt safe
jksoft 9:5c195c1036da 28 *
jksoft 9:5c195c1036da 29 * Example:
jksoft 9:5c195c1036da 30 * @code
jksoft 9:5c195c1036da 31 * // Count the time to toggle a LED
jksoft 9:5c195c1036da 32 *
jksoft 9:5c195c1036da 33 * #include "mbed.h"
jksoft 9:5c195c1036da 34 *
jksoft 9:5c195c1036da 35 * Timer timer;
jksoft 9:5c195c1036da 36 * DigitalOut led(LED1);
jksoft 9:5c195c1036da 37 * int begin, end;
jksoft 9:5c195c1036da 38 *
jksoft 9:5c195c1036da 39 * int main() {
jksoft 9:5c195c1036da 40 * timer.start();
jksoft 9:5c195c1036da 41 * begin = timer.read_us();
jksoft 9:5c195c1036da 42 * led = !led;
jksoft 9:5c195c1036da 43 * end = timer.read_us();
jksoft 9:5c195c1036da 44 * printf("Toggle the led takes %d us", end - begin);
jksoft 9:5c195c1036da 45 * }
jksoft 9:5c195c1036da 46 * @endcode
jksoft 9:5c195c1036da 47 * @ingroup drivers
jksoft 9:5c195c1036da 48 */
jksoft 9:5c195c1036da 49 class OldTimer {
jksoft 9:5c195c1036da 50
jksoft 9:5c195c1036da 51 public:
jksoft 9:5c195c1036da 52 OldTimer();
jksoft 9:5c195c1036da 53 OldTimer(const ticker_data_t *data);
jksoft 9:5c195c1036da 54
jksoft 9:5c195c1036da 55 /** Start the timer
jksoft 9:5c195c1036da 56 */
jksoft 9:5c195c1036da 57 void start();
jksoft 9:5c195c1036da 58
jksoft 9:5c195c1036da 59 /** Stop the timer
jksoft 9:5c195c1036da 60 */
jksoft 9:5c195c1036da 61 void stop();
jksoft 9:5c195c1036da 62
jksoft 9:5c195c1036da 63 /** Reset the timer to 0.
jksoft 9:5c195c1036da 64 *
jksoft 9:5c195c1036da 65 * If it was already counting, it will continue
jksoft 9:5c195c1036da 66 */
jksoft 9:5c195c1036da 67 void reset();
jksoft 9:5c195c1036da 68
jksoft 9:5c195c1036da 69 /** Get the time passed in seconds
jksoft 9:5c195c1036da 70 *
jksoft 9:5c195c1036da 71 * @returns Time passed in seconds
jksoft 9:5c195c1036da 72 */
jksoft 9:5c195c1036da 73 float read();
jksoft 9:5c195c1036da 74
jksoft 9:5c195c1036da 75 /** Get the time passed in milli-seconds
jksoft 9:5c195c1036da 76 *
jksoft 9:5c195c1036da 77 * @returns Time passed in milli seconds
jksoft 9:5c195c1036da 78 */
jksoft 9:5c195c1036da 79 int read_ms();
jksoft 9:5c195c1036da 80
jksoft 9:5c195c1036da 81 /** Get the time passed in micro-seconds
jksoft 9:5c195c1036da 82 *
jksoft 9:5c195c1036da 83 * @returns Time passed in micro seconds
jksoft 9:5c195c1036da 84 */
jksoft 9:5c195c1036da 85 int read_us();
jksoft 9:5c195c1036da 86
jksoft 9:5c195c1036da 87 /** An operator shorthand for read()
jksoft 9:5c195c1036da 88 */
jksoft 9:5c195c1036da 89 operator float();
jksoft 9:5c195c1036da 90
jksoft 9:5c195c1036da 91 /** Get in a high resolution type the time passed in micro-seconds.
jksoft 9:5c195c1036da 92 */
jksoft 9:5c195c1036da 93 us_timestamp_t read_high_resolution_us();
jksoft 9:5c195c1036da 94
jksoft 9:5c195c1036da 95 protected:
jksoft 9:5c195c1036da 96 us_timestamp_t slicetime();
jksoft 9:5c195c1036da 97 int _running; // whether the timer is running
jksoft 9:5c195c1036da 98 us_timestamp_t _start; // the start time of the latest slice
jksoft 9:5c195c1036da 99 us_timestamp_t _time; // any accumulated time from previous slices
jksoft 9:5c195c1036da 100 const ticker_data_t *_ticker_data;
jksoft 9:5c195c1036da 101 };
jksoft 9:5c195c1036da 102
jksoft 9:5c195c1036da 103
jksoft 9:5c195c1036da 104 #endif