Rahul Dahiya / Mbed OS STM32F7 Ethernet
Committer:
rahul_dahiya
Date:
Wed Jan 15 15:57:15 2020 +0530
Revision:
0:fb8047b156bb
STM32F7 LWIP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rahul_dahiya 0:fb8047b156bb 1 /* mbed Microcontroller Library
rahul_dahiya 0:fb8047b156bb 2 * Copyright (c) 2006-2013 ARM Limited
rahul_dahiya 0:fb8047b156bb 3 *
rahul_dahiya 0:fb8047b156bb 4 * Licensed under the Apache License, Version 2.0 (the "License");
rahul_dahiya 0:fb8047b156bb 5 * you may not use this file except in compliance with the License.
rahul_dahiya 0:fb8047b156bb 6 * You may obtain a copy of the License at
rahul_dahiya 0:fb8047b156bb 7 *
rahul_dahiya 0:fb8047b156bb 8 * http://www.apache.org/licenses/LICENSE-2.0
rahul_dahiya 0:fb8047b156bb 9 *
rahul_dahiya 0:fb8047b156bb 10 * Unless required by applicable law or agreed to in writing, software
rahul_dahiya 0:fb8047b156bb 11 * distributed under the License is distributed on an "AS IS" BASIS,
rahul_dahiya 0:fb8047b156bb 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rahul_dahiya 0:fb8047b156bb 13 * See the License for the specific language governing permissions and
rahul_dahiya 0:fb8047b156bb 14 * limitations under the License.
rahul_dahiya 0:fb8047b156bb 15 */
rahul_dahiya 0:fb8047b156bb 16 #include "drivers/Serial.h"
rahul_dahiya 0:fb8047b156bb 17 #include "platform/mbed_wait_api.h"
rahul_dahiya 0:fb8047b156bb 18
rahul_dahiya 0:fb8047b156bb 19 #if DEVICE_SERIAL
rahul_dahiya 0:fb8047b156bb 20
rahul_dahiya 0:fb8047b156bb 21 namespace mbed {
rahul_dahiya 0:fb8047b156bb 22
rahul_dahiya 0:fb8047b156bb 23 Serial::Serial(PinName tx, PinName rx, const char *name, int baud) : SerialBase(tx, rx, baud), Stream(name) {
rahul_dahiya 0:fb8047b156bb 24 }
rahul_dahiya 0:fb8047b156bb 25
rahul_dahiya 0:fb8047b156bb 26 Serial::Serial(PinName tx, PinName rx, int baud): SerialBase(tx, rx, baud), Stream(NULL) {
rahul_dahiya 0:fb8047b156bb 27 }
rahul_dahiya 0:fb8047b156bb 28
rahul_dahiya 0:fb8047b156bb 29 int Serial::_getc() {
rahul_dahiya 0:fb8047b156bb 30 // Mutex is already held
rahul_dahiya 0:fb8047b156bb 31 return _base_getc();
rahul_dahiya 0:fb8047b156bb 32 }
rahul_dahiya 0:fb8047b156bb 33
rahul_dahiya 0:fb8047b156bb 34 int Serial::_putc(int c) {
rahul_dahiya 0:fb8047b156bb 35 // Mutex is already held
rahul_dahiya 0:fb8047b156bb 36 return _base_putc(c);
rahul_dahiya 0:fb8047b156bb 37 }
rahul_dahiya 0:fb8047b156bb 38
rahul_dahiya 0:fb8047b156bb 39 void Serial::lock() {
rahul_dahiya 0:fb8047b156bb 40 _mutex.lock();
rahul_dahiya 0:fb8047b156bb 41 }
rahul_dahiya 0:fb8047b156bb 42
rahul_dahiya 0:fb8047b156bb 43 void Serial::unlock() {
rahul_dahiya 0:fb8047b156bb 44 _mutex.unlock();
rahul_dahiya 0:fb8047b156bb 45 }
rahul_dahiya 0:fb8047b156bb 46
rahul_dahiya 0:fb8047b156bb 47 } // namespace mbed
rahul_dahiya 0:fb8047b156bb 48
rahul_dahiya 0:fb8047b156bb 49 #endif