5.2.1 - Updated I2C files

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Committer:
group-onsemi
Date:
Wed Jan 25 20:34:15 2017 +0000
Revision:
0:098463de4c5d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-onsemi 0:098463de4c5d 1 /* mbed Microcontroller Library
group-onsemi 0:098463de4c5d 2 * Copyright (c) 2006-2012 ARM Limited
group-onsemi 0:098463de4c5d 3 *
group-onsemi 0:098463de4c5d 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
group-onsemi 0:098463de4c5d 5 * of this software and associated documentation files (the "Software"), to deal
group-onsemi 0:098463de4c5d 6 * in the Software without restriction, including without limitation the rights
group-onsemi 0:098463de4c5d 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
group-onsemi 0:098463de4c5d 8 * copies of the Software, and to permit persons to whom the Software is
group-onsemi 0:098463de4c5d 9 * furnished to do so, subject to the following conditions:
group-onsemi 0:098463de4c5d 10 *
group-onsemi 0:098463de4c5d 11 * The above copyright notice and this permission notice shall be included in
group-onsemi 0:098463de4c5d 12 * all copies or substantial portions of the Software.
group-onsemi 0:098463de4c5d 13 *
group-onsemi 0:098463de4c5d 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
group-onsemi 0:098463de4c5d 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
group-onsemi 0:098463de4c5d 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
group-onsemi 0:098463de4c5d 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
group-onsemi 0:098463de4c5d 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
group-onsemi 0:098463de4c5d 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
group-onsemi 0:098463de4c5d 20 * SOFTWARE.
group-onsemi 0:098463de4c5d 21 */
group-onsemi 0:098463de4c5d 22 #ifndef SEMAPHORE_H
group-onsemi 0:098463de4c5d 23 #define SEMAPHORE_H
group-onsemi 0:098463de4c5d 24
group-onsemi 0:098463de4c5d 25 #include <stdint.h>
group-onsemi 0:098463de4c5d 26 #include "cmsis_os.h"
group-onsemi 0:098463de4c5d 27
group-onsemi 0:098463de4c5d 28 namespace rtos {
group-onsemi 0:098463de4c5d 29 /** \addtogroup rtos */
group-onsemi 0:098463de4c5d 30 /** @{*/
group-onsemi 0:098463de4c5d 31
group-onsemi 0:098463de4c5d 32 /** The Semaphore class is used to manage and protect access to a set of shared resources. */
group-onsemi 0:098463de4c5d 33 class Semaphore {
group-onsemi 0:098463de4c5d 34 public:
group-onsemi 0:098463de4c5d 35 /** Create and Initialize a Semaphore object used for managing resources.
group-onsemi 0:098463de4c5d 36 @param number of available resources; maximum index value is (count-1). (default: 0).
group-onsemi 0:098463de4c5d 37 */
group-onsemi 0:098463de4c5d 38 Semaphore(int32_t count=0);
group-onsemi 0:098463de4c5d 39
group-onsemi 0:098463de4c5d 40 /** Wait until a Semaphore resource becomes available.
group-onsemi 0:098463de4c5d 41 @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
group-onsemi 0:098463de4c5d 42 @return number of available tokens, or -1 in case of incorrect parameters
group-onsemi 0:098463de4c5d 43 */
group-onsemi 0:098463de4c5d 44 int32_t wait(uint32_t millisec=osWaitForever);
group-onsemi 0:098463de4c5d 45
group-onsemi 0:098463de4c5d 46 /** Release a Semaphore resource that was obtain with Semaphore::wait.
group-onsemi 0:098463de4c5d 47 @return status code that indicates the execution status of the function.
group-onsemi 0:098463de4c5d 48 */
group-onsemi 0:098463de4c5d 49 osStatus release(void);
group-onsemi 0:098463de4c5d 50
group-onsemi 0:098463de4c5d 51 ~Semaphore();
group-onsemi 0:098463de4c5d 52
group-onsemi 0:098463de4c5d 53 private:
group-onsemi 0:098463de4c5d 54 osSemaphoreId _osSemaphoreId;
group-onsemi 0:098463de4c5d 55 osSemaphoreDef_t _osSemaphoreDef;
group-onsemi 0:098463de4c5d 56 #ifdef CMSIS_OS_RTX
group-onsemi 0:098463de4c5d 57 uint32_t _semaphore_data[2];
group-onsemi 0:098463de4c5d 58 #endif
group-onsemi 0:098463de4c5d 59 };
group-onsemi 0:098463de4c5d 60
group-onsemi 0:098463de4c5d 61 }
group-onsemi 0:098463de4c5d 62 #endif
group-onsemi 0:098463de4c5d 63
group-onsemi 0:098463de4c5d 64 /** @}*/