Added DEVICE_SERIAL_FC as an indicator for the flow control implementation

pull/135/head
Bogdan Marinescu 2013-12-11 10:26:18 +02:00
parent 53cd64775d
commit c3d4d3079f
5 changed files with 6 additions and 28 deletions

View File

@ -107,6 +107,7 @@ public:
*/
void send_break();
#if DEVICE_SERIAL_FC
/** Set the flow control type on the serial port
*
* @param type the flow control type (Disabled, RTS, CTS, RTSCTS)
@ -114,6 +115,7 @@ public:
* @param flow2 the second flow control pin (CTS for RTSCTS)
*/
void set_flow_control(Flow type, PinName flow1=NC, PinName flow2=NC);
#endif
static void _irq_handler(uint32_t id, SerialIrq irq_type);

View File

@ -81,6 +81,7 @@ void SerialBase::send_break() {
serial_break_clear(&_serial);
}
#ifdef DEVICE_SERIAL_FC
void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) {
FlowControl flow_type = (FlowControl)type;
switch(type) {
@ -100,6 +101,7 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) {
break;
}
}
#endif
} // namespace mbed

View File

@ -1,28 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Default versions of various HAL functions that might not be implemented for some platforms.
#include "toolchain.h"
#include "serial_api.h"
#include "error.h"
WEAK void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
WEAK void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) {
if (FlowControlNone != type)
error("hardware flow control not implemented on this platform");
}

View File

@ -26,6 +26,7 @@
#define DEVICE_ANALOGOUT 1
#define DEVICE_SERIAL 1
#define DEVICE_SERIAL_FC 1
#define DEVICE_I2C 1
#define DEVICE_I2CSLAVE 1

View File

@ -26,6 +26,7 @@
#define DEVICE_ANALOGOUT 0
#define DEVICE_SERIAL 1
#define DEVICE_SERIAL_FC 1
#define DEVICE_I2C 1
#define DEVICE_I2CSLAVE 0