Rtos code cntains bug possible incompatability with I2C

Fork of mbed-rtos by mbed official

Committer:
mbed_official
Date:
Mon May 23 11:00:15 2016 +0100
Revision:
118:4c105b8d7cae
Parent:
107:bdd541595fc5
Synchronized with git revision 821c492eb84a24748de5c05c17f7bd9380ca28ff

Full URL: https://github.com/mbedmicro/mbed/commit/821c492eb84a24748de5c05c17f7bd9380ca28ff/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 107:bdd541595fc5 1 /* mbed Microcontroller Library
mbed_official 107:bdd541595fc5 2 * Copyright (c) 2006-2012 ARM Limited
mbed_official 107:bdd541595fc5 3 *
mbed_official 107:bdd541595fc5 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
mbed_official 107:bdd541595fc5 5 * of this software and associated documentation files (the "Software"), to deal
mbed_official 107:bdd541595fc5 6 * in the Software without restriction, including without limitation the rights
mbed_official 107:bdd541595fc5 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
mbed_official 107:bdd541595fc5 8 * copies of the Software, and to permit persons to whom the Software is
mbed_official 107:bdd541595fc5 9 * furnished to do so, subject to the following conditions:
mbed_official 107:bdd541595fc5 10 *
mbed_official 107:bdd541595fc5 11 * The above copyright notice and this permission notice shall be included in
mbed_official 107:bdd541595fc5 12 * all copies or substantial portions of the Software.
mbed_official 107:bdd541595fc5 13 *
mbed_official 107:bdd541595fc5 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
mbed_official 107:bdd541595fc5 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
mbed_official 107:bdd541595fc5 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
mbed_official 107:bdd541595fc5 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
mbed_official 107:bdd541595fc5 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mbed_official 107:bdd541595fc5 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
mbed_official 107:bdd541595fc5 20 * SOFTWARE.
mbed_official 107:bdd541595fc5 21 */
mbed_official 107:bdd541595fc5 22
mbed_official 107:bdd541595fc5 23 #include "rtos_idle.h"
mbed_official 107:bdd541595fc5 24
mbed_official 107:bdd541595fc5 25 static void default_idle_hook(void)
mbed_official 107:bdd541595fc5 26 {
mbed_official 107:bdd541595fc5 27 /* Sleep: ideally, we should put the chip to sleep.
mbed_official 107:bdd541595fc5 28 Unfortunately, this usually requires disconnecting the interface chip (debugger).
mbed_official 107:bdd541595fc5 29 This can be done, but it would break the local file system.
mbed_official 107:bdd541595fc5 30 */
mbed_official 107:bdd541595fc5 31 // sleep();
mbed_official 107:bdd541595fc5 32 }
mbed_official 107:bdd541595fc5 33 static void (*idle_hook_fptr)(void) = &default_idle_hook;
mbed_official 107:bdd541595fc5 34
mbed_official 107:bdd541595fc5 35 void rtos_attach_idle_hook(void (*fptr)(void))
mbed_official 107:bdd541595fc5 36 {
mbed_official 107:bdd541595fc5 37 //Attach the specified idle hook, or the default idle hook in case of a NULL pointer
mbed_official 107:bdd541595fc5 38 if (fptr != NULL) {
mbed_official 107:bdd541595fc5 39 idle_hook_fptr = fptr;
mbed_official 107:bdd541595fc5 40 } else {
mbed_official 107:bdd541595fc5 41 idle_hook_fptr = default_idle_hook;
mbed_official 107:bdd541595fc5 42 }
mbed_official 107:bdd541595fc5 43 }
mbed_official 107:bdd541595fc5 44
mbed_official 107:bdd541595fc5 45 void rtos_idle_loop(void)
mbed_official 107:bdd541595fc5 46 {
mbed_official 107:bdd541595fc5 47 //Continuously call the idle hook function pointer
mbed_official 107:bdd541595fc5 48 while (1) {
mbed_official 107:bdd541595fc5 49 idle_hook_fptr();
mbed_official 107:bdd541595fc5 50 }
mbed_official 107:bdd541595fc5 51 }