SDCard version
Fork of gr-peach-opencv-project-sd-card by
drivers/Serial.cpp@167:2ee3e82cb6f5, 2017-07-21 (annotated)
- Committer:
- thedo
- Date:
- Fri Jul 21 01:26:54 2017 +0000
- Revision:
- 167:2ee3e82cb6f5
gr-peach-opencv-project-sd-card
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 167:2ee3e82cb6f5 | 1 | /* mbed Microcontroller Library |
thedo | 167:2ee3e82cb6f5 | 2 | * Copyright (c) 2006-2013 ARM Limited |
thedo | 167:2ee3e82cb6f5 | 3 | * |
thedo | 167:2ee3e82cb6f5 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
thedo | 167:2ee3e82cb6f5 | 5 | * you may not use this file except in compliance with the License. |
thedo | 167:2ee3e82cb6f5 | 6 | * You may obtain a copy of the License at |
thedo | 167:2ee3e82cb6f5 | 7 | * |
thedo | 167:2ee3e82cb6f5 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
thedo | 167:2ee3e82cb6f5 | 9 | * |
thedo | 167:2ee3e82cb6f5 | 10 | * Unless required by applicable law or agreed to in writing, software |
thedo | 167:2ee3e82cb6f5 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
thedo | 167:2ee3e82cb6f5 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
thedo | 167:2ee3e82cb6f5 | 13 | * See the License for the specific language governing permissions and |
thedo | 167:2ee3e82cb6f5 | 14 | * limitations under the License. |
thedo | 167:2ee3e82cb6f5 | 15 | */ |
thedo | 167:2ee3e82cb6f5 | 16 | #include "drivers/Serial.h" |
thedo | 167:2ee3e82cb6f5 | 17 | #include "platform/mbed_wait_api.h" |
thedo | 167:2ee3e82cb6f5 | 18 | |
thedo | 167:2ee3e82cb6f5 | 19 | #if DEVICE_SERIAL |
thedo | 167:2ee3e82cb6f5 | 20 | |
thedo | 167:2ee3e82cb6f5 | 21 | namespace mbed { |
thedo | 167:2ee3e82cb6f5 | 22 | |
thedo | 167:2ee3e82cb6f5 | 23 | Serial::Serial(PinName tx, PinName rx, const char *name, int baud) : SerialBase(tx, rx, baud), Stream(name) { |
thedo | 167:2ee3e82cb6f5 | 24 | } |
thedo | 167:2ee3e82cb6f5 | 25 | |
thedo | 167:2ee3e82cb6f5 | 26 | Serial::Serial(PinName tx, PinName rx, int baud): SerialBase(tx, rx, baud), Stream(NULL) { |
thedo | 167:2ee3e82cb6f5 | 27 | } |
thedo | 167:2ee3e82cb6f5 | 28 | |
thedo | 167:2ee3e82cb6f5 | 29 | int Serial::_getc() { |
thedo | 167:2ee3e82cb6f5 | 30 | // Mutex is already held |
thedo | 167:2ee3e82cb6f5 | 31 | return _base_getc(); |
thedo | 167:2ee3e82cb6f5 | 32 | } |
thedo | 167:2ee3e82cb6f5 | 33 | |
thedo | 167:2ee3e82cb6f5 | 34 | int Serial::_putc(int c) { |
thedo | 167:2ee3e82cb6f5 | 35 | // Mutex is already held |
thedo | 167:2ee3e82cb6f5 | 36 | return _base_putc(c); |
thedo | 167:2ee3e82cb6f5 | 37 | } |
thedo | 167:2ee3e82cb6f5 | 38 | |
thedo | 167:2ee3e82cb6f5 | 39 | void Serial::lock() { |
thedo | 167:2ee3e82cb6f5 | 40 | _mutex.lock(); |
thedo | 167:2ee3e82cb6f5 | 41 | } |
thedo | 167:2ee3e82cb6f5 | 42 | |
thedo | 167:2ee3e82cb6f5 | 43 | void Serial::unlock() { |
thedo | 167:2ee3e82cb6f5 | 44 | _mutex.unlock(); |
thedo | 167:2ee3e82cb6f5 | 45 | } |
thedo | 167:2ee3e82cb6f5 | 46 | |
thedo | 167:2ee3e82cb6f5 | 47 | } // namespace mbed |
thedo | 167:2ee3e82cb6f5 | 48 | |
thedo | 167:2ee3e82cb6f5 | 49 | #endif |
thedo | 167:2ee3e82cb6f5 | 50 |