![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/TESTS/mbed_drivers/lp_timeout/main.cpp@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* mbed Microcontroller Library |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2016 ARM Limited |
kadonotakashi | 0:8fdf9a60065b | 3 | * |
kadonotakashi | 0:8fdf9a60065b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kadonotakashi | 0:8fdf9a60065b | 5 | * you may not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 6 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 9 | * |
kadonotakashi | 0:8fdf9a60065b | 10 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kadonotakashi | 0:8fdf9a60065b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 13 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 14 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 15 | */ |
kadonotakashi | 0:8fdf9a60065b | 16 | |
kadonotakashi | 0:8fdf9a60065b | 17 | #if !DEVICE_LPTICKER |
kadonotakashi | 0:8fdf9a60065b | 18 | #error [NOT_SUPPORTED] Low power timer not supported for this target |
kadonotakashi | 0:8fdf9a60065b | 19 | #endif |
kadonotakashi | 0:8fdf9a60065b | 20 | |
kadonotakashi | 0:8fdf9a60065b | 21 | #include "mbed.h" |
kadonotakashi | 0:8fdf9a60065b | 22 | #include "greentea-client/test_env.h" |
kadonotakashi | 0:8fdf9a60065b | 23 | #include "utest/utest.h" |
kadonotakashi | 0:8fdf9a60065b | 24 | #include "unity/unity.h" |
kadonotakashi | 0:8fdf9a60065b | 25 | #include "../timeout/timeout_tests.h" |
kadonotakashi | 0:8fdf9a60065b | 26 | |
kadonotakashi | 0:8fdf9a60065b | 27 | using namespace utest::v1; |
kadonotakashi | 0:8fdf9a60065b | 28 | |
kadonotakashi | 0:8fdf9a60065b | 29 | utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) |
kadonotakashi | 0:8fdf9a60065b | 30 | { |
kadonotakashi | 0:8fdf9a60065b | 31 | greentea_case_failure_abort_handler(source, reason); |
kadonotakashi | 0:8fdf9a60065b | 32 | return STATUS_CONTINUE; |
kadonotakashi | 0:8fdf9a60065b | 33 | } |
kadonotakashi | 0:8fdf9a60065b | 34 | |
kadonotakashi | 0:8fdf9a60065b | 35 | Case cases[] = { |
kadonotakashi | 0:8fdf9a60065b | 36 | Case("Callback called once (attach)", test_single_call<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 37 | Case("Callback called once (attach_us)", test_single_call<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 38 | |
kadonotakashi | 0:8fdf9a60065b | 39 | Case("Callback not called when cancelled (attach)", test_cancel<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 40 | Case("Callback not called when cancelled (attach_us)", test_cancel<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | Case("Callback override (attach)", test_override<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 43 | Case("Callback override (attach_us)", test_override<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 44 | |
kadonotakashi | 0:8fdf9a60065b | 45 | Case("Multiple timeouts running in parallel (attach)", test_multiple<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 46 | Case("Multiple timeouts running in parallel (attach_us)", test_multiple<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 47 | |
kadonotakashi | 0:8fdf9a60065b | 48 | Case("Zero delay (attach)", test_no_wait<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 49 | Case("Zero delay (attach_us)", test_no_wait<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 50 | |
kadonotakashi | 0:8fdf9a60065b | 51 | Case("10 ms delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 10000, SHORT_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 52 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 53 | Case("10 ms delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 10000, SHORT_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 54 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 55 | |
kadonotakashi | 0:8fdf9a60065b | 56 | Case("1 s delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 57 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 58 | Case("1 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 59 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 60 | |
kadonotakashi | 0:8fdf9a60065b | 61 | Case("5 s delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 5000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 62 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 63 | Case("5 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 5000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 64 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 65 | |
kadonotakashi | 0:8fdf9a60065b | 66 | #if DEVICE_SLEEP |
kadonotakashi | 0:8fdf9a60065b | 67 | Case("1 s delay during sleep (attach)", test_sleep<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 68 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 69 | Case("1 s delay during sleep (attach_us)", test_sleep<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 70 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 71 | |
kadonotakashi | 0:8fdf9a60065b | 72 | Case("1 s delay during deepsleep (attach)", test_deepsleep<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 73 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 74 | Case("1 s delay during deepsleep (attach_us)", test_deepsleep<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 75 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 76 | #endif |
kadonotakashi | 0:8fdf9a60065b | 77 | |
kadonotakashi | 0:8fdf9a60065b | 78 | Case("Timing drift (attach)", test_drift<AttachTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 79 | Case("Timing drift (attach_us)", test_drift<AttachUSTester<LowPowerTimeout> >), |
kadonotakashi | 0:8fdf9a60065b | 80 | }; |
kadonotakashi | 0:8fdf9a60065b | 81 | |
kadonotakashi | 0:8fdf9a60065b | 82 | utest::v1::status_t greentea_test_setup(const size_t number_of_cases) |
kadonotakashi | 0:8fdf9a60065b | 83 | { |
kadonotakashi | 0:8fdf9a60065b | 84 | GREENTEA_SETUP(240, "timing_drift_auto"); |
kadonotakashi | 0:8fdf9a60065b | 85 | return greentea_test_setup_handler(number_of_cases); |
kadonotakashi | 0:8fdf9a60065b | 86 | } |
kadonotakashi | 0:8fdf9a60065b | 87 | |
kadonotakashi | 0:8fdf9a60065b | 88 | Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); |
kadonotakashi | 0:8fdf9a60065b | 89 | |
kadonotakashi | 0:8fdf9a60065b | 90 | int main() |
kadonotakashi | 0:8fdf9a60065b | 91 | { |
kadonotakashi | 0:8fdf9a60065b | 92 | Harness::run(specification); |
kadonotakashi | 0:8fdf9a60065b | 93 | } |