mirror of https://github.com/ARMmbed/mbed-os.git
Public SerialBase::enable_input
parent
b3b7f98698
commit
aa2969f999
|
@ -155,6 +155,30 @@ public:
|
||||||
*/
|
*/
|
||||||
void send_break();
|
void send_break();
|
||||||
|
|
||||||
|
/** Enable serial input
|
||||||
|
*
|
||||||
|
* If both serial input and serial output are disabled, the
|
||||||
|
* peripheral is freed. If either serial input or serial
|
||||||
|
* output is re-enabled, the peripheral is reinitialized.
|
||||||
|
*
|
||||||
|
* On reinitialisation rx interrupts will be enabled if a
|
||||||
|
* rx handler is attached. The rx handler is called once
|
||||||
|
* during reinitialisation.
|
||||||
|
*/
|
||||||
|
void enable_input(bool enable = true);
|
||||||
|
|
||||||
|
/** Enable serial output
|
||||||
|
*
|
||||||
|
* If both serial input and serial output are disabled, the
|
||||||
|
* peripheral is freed. If either serial input or serial
|
||||||
|
* output is re-enabled, the peripheral is reinitialized.
|
||||||
|
*
|
||||||
|
* On reinitialisation tx interrupts will be enabled if a
|
||||||
|
* tx handler is attached. The tx handler is called once
|
||||||
|
* during reinitialisation.
|
||||||
|
*/
|
||||||
|
void enable_output(bool enable = true);
|
||||||
|
|
||||||
#if !defined(DOXYGEN_ONLY)
|
#if !defined(DOXYGEN_ONLY)
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -303,22 +327,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
void _deinit();
|
void _deinit();
|
||||||
|
|
||||||
/** Enable serial input
|
|
||||||
*
|
|
||||||
* If both serial input and serial output are disabled, the
|
|
||||||
* peripheral is freed. If either serial input or serial
|
|
||||||
* output is re-enabled, the peripheral is reinitialized.
|
|
||||||
*/
|
|
||||||
void _enable_input(bool enable = true);
|
|
||||||
|
|
||||||
/** Enable serial output
|
|
||||||
*
|
|
||||||
* If both serial input and serial output are disabled, the
|
|
||||||
* peripheral is freed. If either serial input or serial
|
|
||||||
* output is re-enabled, the peripheral is reinitialized.
|
|
||||||
*/
|
|
||||||
void _enable_output(bool enable = true);
|
|
||||||
|
|
||||||
#if DEVICE_SERIAL_ASYNCH
|
#if DEVICE_SERIAL_ASYNCH
|
||||||
CThunk<SerialBase> _thunk_irq;
|
CThunk<SerialBase> _thunk_irq;
|
||||||
DMAUsage _tx_usage;
|
DMAUsage _tx_usage;
|
||||||
|
|
|
@ -130,8 +130,9 @@ void SerialBase::_deinit()
|
||||||
serial_free(&_serial);
|
serial_free(&_serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialBase::_enable_input(bool enable)
|
void SerialBase::enable_input(bool enable)
|
||||||
{
|
{
|
||||||
|
lock();
|
||||||
if (_rx_enabled != enable) {
|
if (_rx_enabled != enable) {
|
||||||
if (enable && !_tx_enabled) {
|
if (enable && !_tx_enabled) {
|
||||||
_init();
|
_init();
|
||||||
|
@ -156,10 +157,12 @@ void SerialBase::_enable_input(bool enable)
|
||||||
_deinit();
|
_deinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialBase::_enable_output(bool enable)
|
void SerialBase::enable_output(bool enable)
|
||||||
{
|
{
|
||||||
|
lock();
|
||||||
if (_tx_enabled != enable) {
|
if (_tx_enabled != enable) {
|
||||||
if (enable && !_rx_enabled) {
|
if (enable && !_rx_enabled) {
|
||||||
_init();
|
_init();
|
||||||
|
@ -184,6 +187,7 @@ void SerialBase::_enable_output(bool enable)
|
||||||
_deinit();
|
_deinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialBase::set_break()
|
void SerialBase::set_break()
|
||||||
|
|
|
@ -367,7 +367,7 @@ void UARTSerial::disable_tx_irq()
|
||||||
int UARTSerial::enable_input(bool enabled)
|
int UARTSerial::enable_input(bool enabled)
|
||||||
{
|
{
|
||||||
api_lock();
|
api_lock();
|
||||||
_enable_input(enabled);
|
SerialBase::enable_input(enabled);
|
||||||
api_unlock();
|
api_unlock();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -376,7 +376,7 @@ int UARTSerial::enable_input(bool enabled)
|
||||||
int UARTSerial::enable_output(bool enabled)
|
int UARTSerial::enable_output(bool enabled)
|
||||||
{
|
{
|
||||||
api_lock();
|
api_lock();
|
||||||
_enable_input(enabled);
|
SerialBase::enable_input(enabled);
|
||||||
api_unlock();
|
api_unlock();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue