MODSERIAL with support for more devices
Dependents: 1D-Pong BMT-K9_encoder BMT-K9-Regelaar programma_filter ... more
Check the cookbook page for more information: https://mbed.org/cookbook/MODSERIAL
Did you add a device? Please send a pull request so we can keep everything in one library instead of many copies. In that case also send a PM, since currently mbed does not inform of new pull requests. I will then also add you to the developers of this library so you can do other changes directly.
Diff: FLUSH.cpp
- Revision:
- 27:9c93ce7cb9d8
- Parent:
- 2:b936b4acbd92
- Child:
- 28:76793a84f9e5
--- a/FLUSH.cpp Mon Jun 10 19:06:21 2013 +0000 +++ b/FLUSH.cpp Thu Jul 11 13:34:53 2013 +0000 @@ -28,20 +28,20 @@ void MODSERIAL::flushBuffer(IrqType type) { - uint32_t ier = _IER; + uint32_t irq_req = MODSERIAL_IRQ_REG; switch(type) { - case TxIrq: _IER &= ~(1UL << 1); break; - case RxIrq: _IER &= ~(1UL << 0); break; + case TxIrq: DISABLE_TX_IRQ; break; + case RxIrq: DISABLE_RX_IRQ; break; } buffer_in[type] = 0; buffer_out[type] = 0; buffer_count[type] = 0; buffer_overflow[type] = 0; switch(type) { - case TxIrq: _FCR = MODSERIAL_FIFO_TX_RESET; break; - case RxIrq: _FCR = MODSERIAL_FIFO_RX_RESET; break; + case TxIrq: RESET_TX_FIFO; break; + case RxIrq: RESET_RX_FIFO; break; } - _IER = ier; + MODSERIAL_IRQ_REG = irq_req; } }; // namespace AjK ends