Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* 00002 * Copyright (c) 2013-2016, ARM Limited, All Rights Reserved 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00006 * not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #include "mbed.h" 00018 #include "greentea-client/test_env.h" 00019 #include "utest/utest.h" 00020 00021 /** 00022 NOTE: This test will have a bit of inherent drift due to it being 00023 single-threaded, so having a drift that is non-zero should be ok. However, 00024 it should still be well under the limit. 00025 **/ 00026 00027 00028 using namespace utest::v1; 00029 00030 DigitalOut led(LED1); 00031 volatile bool print_tick = false; 00032 const int ONE_SECOND_US = 1000000; 00033 const int total_ticks = 10; 00034 00035 void test_case_ticker() { 00036 for (int i = 0; i <= total_ticks; i++) { 00037 wait_us(ONE_SECOND_US); 00038 greentea_send_kv("tick", i); 00039 } 00040 } 00041 00042 // Test cases 00043 Case cases[] = { 00044 Case("Timers: wait_us", test_case_ticker), 00045 }; 00046 00047 utest::v1::status_t greentea_test_setup(const size_t number_of_cases) { 00048 GREENTEA_SETUP(total_ticks + 5, "timing_drift_auto"); 00049 return greentea_test_setup_handler(number_of_cases); 00050 } 00051 00052 Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); 00053 00054 int main() { 00055 Harness::run(specification); 00056 }
Generated on Tue Jul 12 2022 17:34:48 by
1.7.2