Added support for configurable callbacks of uart1 input.
This commit is contained in:
parent
ab5b1b4a65
commit
b4f3ab5af7
2 changed files with 16 additions and 5 deletions
|
@ -26,19 +26,28 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: uart1.c,v 1.2 2007/05/22 21:01:51 adamdunkels Exp $
|
* @(#)$Id: uart1.c,v 1.3 2007/09/06 11:45:08 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Machine dependent MSP430 UART1 code.
|
* Machine dependent MSP430 UART1 code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include "lib/energest.h"
|
#include "lib/energest.h"
|
||||||
#include "dev/uart1.h"
|
#include "dev/uart1.h"
|
||||||
|
|
||||||
|
static void (*uart1_input_handler)(unsigned char c);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
uart1_set_input(void (*input)(unsigned char c))
|
||||||
|
{
|
||||||
|
uart1_input_handler = input;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uart1_writeb(unsigned char c)
|
uart1_writeb(unsigned char c)
|
||||||
|
@ -117,9 +126,10 @@ uart1_interrupt(void)
|
||||||
volatile unsigned dummy;
|
volatile unsigned dummy;
|
||||||
dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
||||||
} else {
|
} else {
|
||||||
/* if(slip_input_byte(RXBUF1)) {
|
if (uart1_input_handler != NULL) {
|
||||||
LPM4_EXIT;
|
uart1_input_handler(RXBUF1);
|
||||||
}*/
|
LPM4_EXIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: uart1.h,v 1.1 2007/03/15 21:37:19 adamdunkels Exp $
|
* $Id: uart1.h,v 1.2 2007/09/06 11:45:08 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
||||||
|
|
||||||
|
void uart1_set_input(void (*input)(unsigned char c));
|
||||||
void uart1_writeb(unsigned char c);
|
void uart1_writeb(unsigned char c);
|
||||||
void uart1_init(unsigned long ubr);
|
void uart1_init(unsigned long ubr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue