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: Autoflight2018_22_MODSERIAL
Fork of MODSERIAL by
Revision 24:9c456e647a8f, committed 2012-12-06
- Comitter:
- AjK
- Date:
- Thu Dec 06 13:06:10 2012 +0000
- Parent:
- 23:5c45c21f36b7
- Child:
- 25:ae0408ebdd68
- Commit message:
- 1.24RC for new Mbed libraries
Changed in this revision
--- a/ChangeLog.c Wed Jul 25 22:27:49 2012 +0000
+++ b/ChangeLog.c Thu Dec 06 13:06:10 2012 +0000
@@ -1,5 +1,8 @@
/* $Id:$
+1.24 6th Dec 2012
+ Beta release for new Mbed library.
+
1.23 25th July 2012
* LPC1768 code as was. This release includes "alpha" support for the LPC11U24
--- a/INIT.cpp Wed Jul 25 22:27:49 2012 +0000
+++ b/INIT.cpp Thu Dec 06 13:06:10 2012 +0000
@@ -23,10 +23,11 @@
#include "MODSERIAL.h"
#include "MACROS.h"
+
namespace AjK {
void
-MODSERIAL::init( int txSize, int rxSize )
+MODSERIAL::init( int txSize, int rxSize, PinName rx )
{
disableIrq();
@@ -37,26 +38,26 @@
_base = LPC_USART;
#else
- 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;
+ switch( _serial.index ) {
+ 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;
}
#endif
dmaSendChannel = -1;
moddma_p = (void *)NULL;
- if (_base != NULL) {
+ if ( _base != NULL ) {
buffer_size[RxIrq] = rxSize;
buffer[RxIrq] = rxSize > 0 ? (char *)malloc(buffer_size[RxIrq]) : (char *)NULL;
buffer_in[RxIrq] = 0;
buffer_out[RxIrq] = 0;
buffer_count[RxIrq] = 0;
buffer_overflow[RxIrq] = 0;
- Serial::attach(this, &MODSERIAL::isr_rx, Serial::RxIrq);
+ Serial::attach( this, &MODSERIAL::isr_rx, (SerialIrq)0 );
buffer_size[TxIrq] = txSize;
buffer[TxIrq] = txSize > 0 ? (char *)malloc(buffer_size[TxIrq]) : (char *)NULL;
@@ -64,7 +65,7 @@
buffer_out[TxIrq] = 0;
buffer_count[TxIrq] = 0;
buffer_overflow[TxIrq] = 0;
- Serial::attach(this, &MODSERIAL::isr_tx, Serial::TxIrq);
+ Serial::attach( this, &MODSERIAL::isr_tx, (SerialIrq)1 );
}
else {
error("MODSERIAL must have a defined UART to function.");
--- a/MODSERIAL.cpp Wed Jul 25 22:27:49 2012 +0000
+++ b/MODSERIAL.cpp Thu Dec 06 13:06:10 2012 +0000
@@ -31,19 +31,19 @@
namespace AjK {
-MODSERIAL::MODSERIAL( PinName tx, PinName rx, const char *name ) : Serial( tx, rx, name )
+MODSERIAL::MODSERIAL( PinName tx, PinName rx ) : Serial( tx, rx )
{
- init( MODSERIAL_DEFAULT_TX_BUFFER_SIZE, MODSERIAL_DEFAULT_RX_BUFFER_SIZE );
+ init( MODSERIAL_DEFAULT_TX_BUFFER_SIZE, MODSERIAL_DEFAULT_RX_BUFFER_SIZE, rx );
}
-MODSERIAL::MODSERIAL( PinName tx, PinName rx, int bufferSize, const char *name ) : Serial( tx, rx, name )
+MODSERIAL::MODSERIAL( PinName tx, PinName rx, int bufferSize ) : Serial( tx, rx )
{
- init( bufferSize, bufferSize );
+ init( bufferSize, bufferSize, rx );
}
-MODSERIAL::MODSERIAL( PinName tx, PinName rx, int txSize, int rxSize, const char *name ) : Serial( tx, rx, name )
+MODSERIAL::MODSERIAL( PinName tx, PinName rx, int txSize, int rxSize ) : Serial( tx, rx )
{
- init( txSize, rxSize );
+ init( txSize, rxSize, rx );
}
MODSERIAL::~MODSERIAL()
@@ -90,7 +90,7 @@
#ifdef __LPC11UXX_H__
NVIC_DisableIRQ( UART_IRQn );
#else
- switch(_uidx) {
+ switch( _serial.index ) {
case 0: NVIC_DisableIRQ( UART0_IRQn ); break;
case 1: NVIC_DisableIRQ( UART1_IRQn ); break;
case 2: NVIC_DisableIRQ( UART2_IRQn ); break;
@@ -105,7 +105,7 @@
#ifdef __LPC11UXX_H__
NVIC_EnableIRQ( UART_IRQn );
#else
- switch( _uidx ) {
+ switch( _serial.index ) {
case 0: NVIC_EnableIRQ( UART0_IRQn ); break;
case 1: NVIC_EnableIRQ( UART1_IRQn ); break;
case 2: NVIC_EnableIRQ( UART2_IRQn ); break;
--- a/MODSERIAL.h Wed Jul 25 22:27:49 2012 +0000
+++ b/MODSERIAL.h Thu Dec 06 13:06:10 2012 +0000
@@ -42,6 +42,7 @@
#endif
#include "mbed.h"
+#include "serial_api.h"
namespace AjK {
@@ -282,9 +283,8 @@
*
* @param tx PinName of the TX pin.
* @param rx PinName of the TX pin.
- * @param name An option name for RPC usage.
*/
- MODSERIAL(PinName tx, PinName rx, const char *name = NULL);
+ MODSERIAL(PinName tx, PinName rx);
/**
* The MODSERIAL constructor is used to initialise the serial object.
@@ -292,9 +292,8 @@
* @param tx PinName of the TX pin.
* @param rx PinName of the TX pin.
* @param bufferSize Integer of the TX and RX buffer sizes.
- * @param name An option name for RPC usage.
*/
- MODSERIAL(PinName tx, PinName rx, int bufferSize, const char *name = NULL);
+ MODSERIAL(PinName tx, PinName rx, int bufferSize);
/**
* The MODSERIAL constructor is used to initialise the serial object.
@@ -303,9 +302,8 @@
* @param rx PinName of the TX pin.
* @param txBufferSize Integer of the TX buffer sizes.
* @param rxBufferSize Integer of the RX buffer sizes.
- * @param name An option name for RPC usage.
*/
- MODSERIAL(PinName tx, PinName rx, int txBufferSize, int rxBufferSize, const char *name = NULL);
+ MODSERIAL(PinName tx, PinName rx, int txBufferSize, int rxBufferSize);
virtual ~MODSERIAL();
@@ -934,7 +932,7 @@
* Initialize the MODSERIAL object
* @ingroup INTERNALS
*/
- void init(int txSize, int rxSize);
+ void init(int txSize, int rxSize, PinName rx);
/**
* Function: flushBuffer
