うおーるぼっとをWiiリモコンでコントロールする新しいプログラムです。 以前のものより、Wiiリモコンが早く繋がる様になりました。 It is a program which controls A with the Wii remote. ※ A Bluetooth dongle and a Wii remote control are needed.
Dependencies: USBHost mbed FATFileSystem mbed-rtos
USBHost/mbed-rtos/rtos/Mutex.h@0:fccb789424fc, 2013-06-10 (annotated)
- Committer:
- jksoft
- Date:
- Mon Jun 10 16:01:50 2013 +0000
- Revision:
- 0:fccb789424fc
1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:fccb789424fc | 1 | /* mbed Microcontroller Library |
jksoft | 0:fccb789424fc | 2 | * Copyright (c) 2006-2012 ARM Limited |
jksoft | 0:fccb789424fc | 3 | * |
jksoft | 0:fccb789424fc | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
jksoft | 0:fccb789424fc | 5 | * of this software and associated documentation files (the "Software"), to deal |
jksoft | 0:fccb789424fc | 6 | * in the Software without restriction, including without limitation the rights |
jksoft | 0:fccb789424fc | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
jksoft | 0:fccb789424fc | 8 | * copies of the Software, and to permit persons to whom the Software is |
jksoft | 0:fccb789424fc | 9 | * furnished to do so, subject to the following conditions: |
jksoft | 0:fccb789424fc | 10 | * |
jksoft | 0:fccb789424fc | 11 | * The above copyright notice and this permission notice shall be included in |
jksoft | 0:fccb789424fc | 12 | * all copies or substantial portions of the Software. |
jksoft | 0:fccb789424fc | 13 | * |
jksoft | 0:fccb789424fc | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
jksoft | 0:fccb789424fc | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
jksoft | 0:fccb789424fc | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
jksoft | 0:fccb789424fc | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
jksoft | 0:fccb789424fc | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jksoft | 0:fccb789424fc | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
jksoft | 0:fccb789424fc | 20 | * SOFTWARE. |
jksoft | 0:fccb789424fc | 21 | */ |
jksoft | 0:fccb789424fc | 22 | #ifndef MUTEX_H |
jksoft | 0:fccb789424fc | 23 | #define MUTEX_H |
jksoft | 0:fccb789424fc | 24 | |
jksoft | 0:fccb789424fc | 25 | #include <stdint.h> |
jksoft | 0:fccb789424fc | 26 | #include "cmsis_os.h" |
jksoft | 0:fccb789424fc | 27 | |
jksoft | 0:fccb789424fc | 28 | namespace rtos { |
jksoft | 0:fccb789424fc | 29 | |
jksoft | 0:fccb789424fc | 30 | /** The Mutex class is used to synchronise the execution of threads. |
jksoft | 0:fccb789424fc | 31 | This is for example used to protect access to a shared resource. |
jksoft | 0:fccb789424fc | 32 | */ |
jksoft | 0:fccb789424fc | 33 | class Mutex { |
jksoft | 0:fccb789424fc | 34 | public: |
jksoft | 0:fccb789424fc | 35 | /** Create and Initialize a Mutex object */ |
jksoft | 0:fccb789424fc | 36 | Mutex(); |
jksoft | 0:fccb789424fc | 37 | |
jksoft | 0:fccb789424fc | 38 | /** Wait until a Mutex becomes available. |
jksoft | 0:fccb789424fc | 39 | @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever) |
jksoft | 0:fccb789424fc | 40 | @return status code that indicates the execution status of the function. |
jksoft | 0:fccb789424fc | 41 | */ |
jksoft | 0:fccb789424fc | 42 | osStatus lock(uint32_t millisec=osWaitForever); |
jksoft | 0:fccb789424fc | 43 | |
jksoft | 0:fccb789424fc | 44 | /** Try to lock the mutex, and return immediately |
jksoft | 0:fccb789424fc | 45 | @return true if the mutex was acquired, false otherwise. |
jksoft | 0:fccb789424fc | 46 | */ |
jksoft | 0:fccb789424fc | 47 | bool trylock(); |
jksoft | 0:fccb789424fc | 48 | |
jksoft | 0:fccb789424fc | 49 | /** Unlock the mutex that has previously been locked by the same thread |
jksoft | 0:fccb789424fc | 50 | @return status code that indicates the execution status of the function. |
jksoft | 0:fccb789424fc | 51 | */ |
jksoft | 0:fccb789424fc | 52 | osStatus unlock(); |
jksoft | 0:fccb789424fc | 53 | |
jksoft | 0:fccb789424fc | 54 | ~Mutex(); |
jksoft | 0:fccb789424fc | 55 | |
jksoft | 0:fccb789424fc | 56 | private: |
jksoft | 0:fccb789424fc | 57 | osMutexId _osMutexId; |
jksoft | 0:fccb789424fc | 58 | osMutexDef_t _osMutexDef; |
jksoft | 0:fccb789424fc | 59 | #ifdef CMSIS_OS_RTX |
jksoft | 0:fccb789424fc | 60 | int32_t _mutex_data[3]; |
jksoft | 0:fccb789424fc | 61 | #endif |
jksoft | 0:fccb789424fc | 62 | }; |
jksoft | 0:fccb789424fc | 63 | |
jksoft | 0:fccb789424fc | 64 | } |
jksoft | 0:fccb789424fc | 65 | #endif |