Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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: INIT.cpp
- Revision:
- 2:b936b4acbd92
- Parent:
- 0:eb2522b41db8
- Child:
- 4:28de979b77cf
--- a/INIT.cpp Sun Nov 21 02:15:07 2010 +0000
+++ b/INIT.cpp Sun Nov 21 03:31:51 2010 +0000
@@ -30,7 +30,13 @@
{
disableIrq();
- setBase();
+ switch(_uidx) {
+ case 0: _base = LPC_UART0; break;
+ case 1: _base = LPC_UART1; break;
+ case 2: _base = LPC_UART2; break;
+ case 3: _base = LPC_UART3; break;
+ default : _base = NULL; break;
+ }
if (_base != NULL) {
buffer_size[RxIrq] = rxSize;
@@ -39,6 +45,7 @@
buffer_out[RxIrq] = 0;
buffer_count[RxIrq] = 0;
buffer_overflow[RxIrq] = 0;
+ dmaInUse[RxIrq] = -1;
Serial::attach(this, &MODSERIAL::isr_rx, Serial::RxIrq);
buffer_size[TxIrq] = txSize;
@@ -47,8 +54,12 @@
buffer_out[TxIrq] = 0;
buffer_count[TxIrq] = 0;
buffer_overflow[TxIrq] = 0;
+ dmaInUse[TxIrq] = -1;
Serial::attach(this, &MODSERIAL::isr_tx, Serial::TxIrq);
}
+ else {
+ error("MODSERIAL must have a defined UART to function.");
+ }
if (!txBufferSane()) {
error("Failed to allocate memory for TX buffer");
@@ -63,16 +74,4 @@
enableIrq();
}
-void
-MODSERIAL::setBase(void)
-{
- switch(_uidx) {
- case 0: _base = LPC_UART0; break;
- case 1: _base = LPC_UART1; break;
- case 2: _base = LPC_UART2; break;
- case 3: _base = LPC_UART3; break;
- default : _base = NULL; break;
- }
-}
-
}; // namespace AjK ends
