This is the final version of Mini Gateway for Automation and Security desgined for Renesas GR Peach Design Contest

Dependencies:   GR-PEACH_video GraphicsFramework HTTPServer R_BSP mbed-rpc mbed-rtos Socket lwip-eth lwip-sys lwip FATFileSystem

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
vipinranka
Date:
Wed Jan 11 11:41:30 2017 +0000
Revision:
12:9a20164dcc47
This is the final version MGAS Project for Renesas GR Peach Design Contest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vipinranka 12:9a20164dcc47 1 /* mbed Microcontroller Library
vipinranka 12:9a20164dcc47 2 * Copyright (c) 2006-2013 ARM Limited
vipinranka 12:9a20164dcc47 3 *
vipinranka 12:9a20164dcc47 4 * Licensed under the Apache License, Version 2.0 (the "License");
vipinranka 12:9a20164dcc47 5 * you may not use this file except in compliance with the License.
vipinranka 12:9a20164dcc47 6 * You may obtain a copy of the License at
vipinranka 12:9a20164dcc47 7 *
vipinranka 12:9a20164dcc47 8 * http://www.apache.org/licenses/LICENSE-2.0
vipinranka 12:9a20164dcc47 9 *
vipinranka 12:9a20164dcc47 10 * Unless required by applicable law or agreed to in writing, software
vipinranka 12:9a20164dcc47 11 * distributed under the License is distributed on an "AS IS" BASIS,
vipinranka 12:9a20164dcc47 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vipinranka 12:9a20164dcc47 13 * See the License for the specific language governing permissions and
vipinranka 12:9a20164dcc47 14 * limitations under the License.
vipinranka 12:9a20164dcc47 15 */
vipinranka 12:9a20164dcc47 16
vipinranka 12:9a20164dcc47 17 // This implementation of the wait functions will be compiled only
vipinranka 12:9a20164dcc47 18 // if the RTOS is present.
vipinranka 12:9a20164dcc47 19 #ifdef MBED_CONF_RTOS_PRESENT
vipinranka 12:9a20164dcc47 20
vipinranka 12:9a20164dcc47 21 #include "platform/wait_api.h"
vipinranka 12:9a20164dcc47 22 #include "hal/us_ticker_api.h"
vipinranka 12:9a20164dcc47 23 #include "rtos/rtos.h"
vipinranka 12:9a20164dcc47 24 #include "platform/critical.h"
vipinranka 12:9a20164dcc47 25
vipinranka 12:9a20164dcc47 26 void wait(float s) {
vipinranka 12:9a20164dcc47 27 wait_us(s * 1000000.0f);
vipinranka 12:9a20164dcc47 28 }
vipinranka 12:9a20164dcc47 29
vipinranka 12:9a20164dcc47 30 void wait_ms(int ms) {
vipinranka 12:9a20164dcc47 31 wait_us(ms * 1000);
vipinranka 12:9a20164dcc47 32 }
vipinranka 12:9a20164dcc47 33
vipinranka 12:9a20164dcc47 34 void wait_us(int us) {
vipinranka 12:9a20164dcc47 35 uint32_t start = us_ticker_read();
vipinranka 12:9a20164dcc47 36 // Use the RTOS to wait for millisecond delays if possible
vipinranka 12:9a20164dcc47 37 int ms = us / 1000;
vipinranka 12:9a20164dcc47 38 if ((ms > 0) && core_util_are_interrupts_enabled()) {
vipinranka 12:9a20164dcc47 39 Thread::wait((uint32_t)ms);
vipinranka 12:9a20164dcc47 40 }
vipinranka 12:9a20164dcc47 41 // Use busy waiting for sub-millisecond delays, or for the whole
vipinranka 12:9a20164dcc47 42 // interval if interrupts are not enabled
vipinranka 12:9a20164dcc47 43 while ((us_ticker_read() - start) < (uint32_t)us);
vipinranka 12:9a20164dcc47 44 }
vipinranka 12:9a20164dcc47 45
vipinranka 12:9a20164dcc47 46 #endif // #if MBED_CONF_RTOS_PRESENT
vipinranka 12:9a20164dcc47 47