Code for our FYDP -only one IMU works right now -RTOS is working

Dependencies:   mbed

Committer:
majik
Date:
Wed Mar 18 22:23:48 2015 +0000
Revision:
0:964eb6a2ef00
This is our FYDP code, but only one IMU works with the RTOS.

Who changed what in which revision?

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