Dependencies: TextLCD mbed wave_player SDFileSystem
Revision 0:2191f0323ae0, committed 2012-03-11
- Comitter:
- nameless129
- Date:
- Sun Mar 11 06:15:43 2012 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 2191f0323ae0 FATFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FATFileSystem.lib Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_unsupported/code/fatfilesystem/ \ No newline at end of file
diff -r 000000000000 -r 2191f0323ae0 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/SDFileSystem/#b1ddfc9a9b25
diff -r 000000000000 -r 2191f0323ae0 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r 2191f0323ae0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,105 @@ +#include "mbed.h" +#include <wave_player.h> + +//////////////////////////////////////// +//////// general setting //////// +//////////////////////////////////////// +//#define USE_TextLCD_20x4 +#define USE_FIXED_IP + +//////////////////////////////////////// +//////// For TextLCD //////// +//////////////////////////////////////// +#include "TextLCD.h" +#ifdef USE_TextLCD_20x4 +//TextLCD lcd( p24, p26, p27, p28, p29, p30, TextLCD::LCD20x4 ); // rs, e, d0-d3 +#else +TextLCD lcd( p24, p26, p27, p28, p29, p30 ); // rs, e, d0-d3 +#endif + +//////////////////////////////////////// +//////// For SD_card //////// +//////////////////////////////////////// +#include "SDFileSystem.h" +//SDFileSystem sd(p5, p6, p7, p13, "sd"); // mosi, miso, sclk, cs, name +SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs, name (HW modification candidate) + +AnalogOut DACout(p18); +wave_player waver(&DACout); + + +void test_TextLCD( void ); +void test_file_write( char *title, char *path ); +int position( void ); + +int main() { + FILE *fp; + fp = fopen("/sd/test.wav","r"); + if (fp == NULL) { + lcd.locate( 0, 0 ); + lcd.printf("File couldn't open\n"); + } else { + lcd.locate( 0, 0 ); + lcd.printf("Open ok\n"); + } + while (1) { + lcd.locate( 0, 1 ); + lcd.printf("File Playing\n"); + waver.play(fp); + } + fclose(fp); +} + + +void test_TextLCD( void ) { + // TextLCD test + +#ifdef USE_TextLCD_20x4 + lcd.locate( 0, 0 ); + for ( int i = 0, c = '0'; i < 20; i++, c++ ) + lcd.putc( c ); + + for ( int i = 0, c = 'A'; i < 20; i++, c++ ) + lcd.putc( c ); + + for ( int i = 0, c = 'a'; i < 20; i++, c++ ) + lcd.putc( c ); + for ( int i = 0, c = '0' - 10; i < 20; i++, c++ ) + lcd.putc( c ); + exit( 0 ); + wait( 300 ); + lcd.cls(); +#endif // USE_TextLCD_20x4 + + lcd.locate( 0, 0 ); + lcd.printf( "TextLCD: OK?" ); + lcd.locate( 0, 1 ); + lcd.printf( "" ); + +} + +void test_file_write( char *title, char *path ) { + // SD card test + lcd.locate( 0, position() ); + lcd.printf( "%s: ", title ); + + FILE *fp = fopen( path, "w" ); + if ( fp == NULL ) { + lcd.printf( "error" ); + error( "Could not open file for write\n" ); + } + fprintf( fp, "The mbed writing a file through the star board orange (%s)!", title ); + fclose( fp ); + + lcd.printf( "OK." ); +} + +int position( void ) { + static int p = 0; + +#ifdef USE_TextLCD_20x4 + return( ++p % 4 ); +#else + return( ++p % 2 ); +#endif +} \ No newline at end of file
diff -r 000000000000 -r 2191f0323ae0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da
diff -r 000000000000 -r 2191f0323ae0 wave_player.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wave_player.lib Sun Mar 11 06:15:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/sravet/code/wave_player/#acc3e18e77ad