support 9600 baud

This commit is contained in:
nvt-se 2008-09-19 12:18:04 +00:00
parent ea52955ce9
commit 37fa4da899
2 changed files with 11 additions and 10 deletions

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: rs232.c,v 1.5 2008/05/27 13:03:19 nvt-se Exp $ * @(#)$Id: rs232.c,v 1.6 2008/09/19 12:18:04 nvt-se Exp $
*/ */
/** \addtogroup esbrs232 /** \addtogroup esbrs232
@ -61,7 +61,6 @@
void void
rs232_init(void) rs232_init(void)
{ {
// rs232_set_speed(RS232_57600);
rs232_set_speed(RS232_115200); rs232_set_speed(RS232_115200);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -95,7 +94,8 @@ void
rs232_set_speed(enum rs232_speed speed) rs232_set_speed(enum rs232_speed speed)
{ {
// baud // baud
const unsigned char br_table[4][3] = { const unsigned char br_table[5][3] = {
{0x00, 0x01, 0x00}, // 9600
{0x80, 0x00, 0x00}, // 19200 {0x80, 0x00, 0x00}, // 19200
{0x40, 0x00, 0x00}, // 38400 {0x40, 0x00, 0x00}, // 38400
{0x2a, 0x00, 0x5b}, // 57600 {0x2a, 0x00, 0x5b}, // 57600

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: rs232.h,v 1.2 2007/08/20 11:01:14 nvt-se Exp $ * @(#)$Id: rs232.h,v 1.3 2008/09/19 12:18:04 nvt-se Exp $
*/ */
/** \addtogroup esb /** \addtogroup esb
@ -50,10 +50,11 @@
#define __RS232_H__ #define __RS232_H__
enum rs232_speed { enum rs232_speed {
RS232_19200 = 0, RS232_9600 = 0,
RS232_38400 = 1, RS232_19200 = 1,
RS232_57600 = 2, RS232_38400 = 2,
RS232_115200 = 3 RS232_57600 = 3,
RS232_115200 = 4
}; };
/** /**
@ -88,8 +89,8 @@ void rs232_set_input(fp_uart_handler f);
* \param speed The speed * \param speed The speed
* *
* This function configures the speed of the RS232 * This function configures the speed of the RS232
* hardware. The allowed parameters are RS232_19200, * hardware. The allowed parameters are RS232_9600,
* RS232_38400, RS232_57600, and RS232_115200. * RS232_19200, RS232_38400, RS232_57600, and RS232_115200.
*/ */
void rs232_set_speed(enum rs232_speed speed); void rs232_set_speed(enum rs232_speed speed);