From: asterix Date: Thu, 5 Jun 2008 17:51:56 +0000 (+0000) Subject: Generalize dataflash test module. Add sample define for serial module. X-Git-Tag: 2.0.0~512 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=7712ea822db3562922f277045ec63b740cb7b749;p=bertos.git Generalize dataflash test module. Add sample define for serial module. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1422 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cfg/cfg_ser.h b/bertos/cfg/cfg_ser.h index 75f72afa..d1647006 100644 --- a/bertos/cfg/cfg_ser.h +++ b/bertos/cfg/cfg_ser.h @@ -40,6 +40,19 @@ #ifndef CFG_SER_H #define CFG_SER_H +/** + * Example of setting for serial port and + * spi port. + * Edit these define for your project. + */ +/// Serial settings +#define CONFIG_SER_PORT 0 +#define CONFIG_SER_BAUDRATE 115200 + +/// Spi settings +#define CONFIG_SPI_PORT 0 +#define CONFIG_SPI_BAUDRATE 5000000UL + /// [bytes] Size of the outbound FIFO buffer for port 0. #define CONFIG_UART0_TXBUFSIZE 32 diff --git a/bertos/drv/dataflash_test.c b/bertos/drv/dataflash_test.c index e8147758..301ee9e1 100644 --- a/bertos/drv/dataflash_test.c +++ b/bertos/drv/dataflash_test.c @@ -86,7 +86,7 @@ #define DATAFLASH_TEST_STR_LEN 12307 // If you want use a rand function of standard library set to 1. -#define DATAFLASH_USE_RAND_FUNC 1 +#define DATAFLASH_USE_RAND_FUNC 0 /* \} */ /* @@ -121,11 +121,11 @@ int dataflash_testSetup(void) * Init SPI module and dataflash driver. */ // Open SPI comunication channel - spimaster_init(&spi_fd, SER_SPI0); - LOG_INFO("SPI0 init..ok\n"); + spimaster_init(&spi_fd, CONFIG_SPI_PORT); + LOG_INFO("SPI init..ok\n"); - ser_setbaudrate(&spi_fd, 5000000UL); - LOG_INFO("SPI0 set baudrate..ok\n"); + ser_setbaudrate(&spi_fd, CONFIG_SPI_BAUDRATE); + LOG_INFO("SPI set baudrate..ok\n"); //Init dataflash memory dataflash_hw_init();