Avion Radio IUT / Mbed 2 deprecated MecatroPWM

Dependencies:   mbed

Committer:
qmaker
Date:
Thu Apr 15 08:43:24 2021 +0000
Revision:
3:3bc2882232a6
Parent:
0:0d257bbf5c05
en cours de dev

Who changed what in which revision?

UserRevisionLine numberNew contents of line
qmaker 0:0d257bbf5c05 1 /* mbed Microcontroller Library
qmaker 0:0d257bbf5c05 2 * Copyright (c) 2006-2012 ARM Limited
qmaker 0:0d257bbf5c05 3 *
qmaker 0:0d257bbf5c05 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
qmaker 0:0d257bbf5c05 5 * of this software and associated documentation files (the "Software"), to deal
qmaker 0:0d257bbf5c05 6 * in the Software without restriction, including without limitation the rights
qmaker 0:0d257bbf5c05 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
qmaker 0:0d257bbf5c05 8 * copies of the Software, and to permit persons to whom the Software is
qmaker 0:0d257bbf5c05 9 * furnished to do so, subject to the following conditions:
qmaker 0:0d257bbf5c05 10 *
qmaker 0:0d257bbf5c05 11 * The above copyright notice and this permission notice shall be included in
qmaker 0:0d257bbf5c05 12 * all copies or substantial portions of the Software.
qmaker 0:0d257bbf5c05 13 *
qmaker 0:0d257bbf5c05 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
qmaker 0:0d257bbf5c05 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
qmaker 0:0d257bbf5c05 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
qmaker 0:0d257bbf5c05 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
qmaker 0:0d257bbf5c05 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
qmaker 0:0d257bbf5c05 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
qmaker 0:0d257bbf5c05 20 * SOFTWARE.
qmaker 0:0d257bbf5c05 21 */
qmaker 0:0d257bbf5c05 22 #include "rtos/Semaphore.h"
qmaker 0:0d257bbf5c05 23
qmaker 0:0d257bbf5c05 24 #include <string.h>
qmaker 0:0d257bbf5c05 25
qmaker 0:0d257bbf5c05 26 namespace rtos {
qmaker 0:0d257bbf5c05 27
qmaker 0:0d257bbf5c05 28 Semaphore::Semaphore(int32_t count) {
qmaker 0:0d257bbf5c05 29 #ifdef CMSIS_OS_RTX
qmaker 0:0d257bbf5c05 30 memset(_semaphore_data, 0, sizeof(_semaphore_data));
qmaker 0:0d257bbf5c05 31 _osSemaphoreDef.semaphore = _semaphore_data;
qmaker 0:0d257bbf5c05 32 #endif
qmaker 0:0d257bbf5c05 33 _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count);
qmaker 0:0d257bbf5c05 34 }
qmaker 0:0d257bbf5c05 35
qmaker 0:0d257bbf5c05 36 int32_t Semaphore::wait(uint32_t millisec) {
qmaker 0:0d257bbf5c05 37 return osSemaphoreWait(_osSemaphoreId, millisec);
qmaker 0:0d257bbf5c05 38 }
qmaker 0:0d257bbf5c05 39
qmaker 0:0d257bbf5c05 40 osStatus Semaphore::release(void) {
qmaker 0:0d257bbf5c05 41 return osSemaphoreRelease(_osSemaphoreId);
qmaker 0:0d257bbf5c05 42 }
qmaker 0:0d257bbf5c05 43
qmaker 0:0d257bbf5c05 44 Semaphore::~Semaphore() {
qmaker 0:0d257bbf5c05 45 osSemaphoreDelete(_osSemaphoreId);
qmaker 0:0d257bbf5c05 46 }
qmaker 0:0d257bbf5c05 47
qmaker 0:0d257bbf5c05 48 }