Code to load a LPC1114 over tx/rx. I have only tested with a 1114 chip but it should work with other LPC uControllers
Dependencies: DirectoryList MODSERIAL mbed
Fork of ika_shouyu_poppoyaki by
Diff: command_interface.cpp
- Revision:
- 35:0b434ef4af49
- Parent:
- 30:e0d7524661ca
- Child:
- 39:f68f9fa1e88e
diff -r eaca33d3e632 -r 0b434ef4af49 command_interface.cpp --- a/command_interface.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/command_interface.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -4,7 +4,7 @@ #include "_user_settings.h" -int try_and_check( char *command, char *expected_return_str, int mode ) +int try_and_check( char *command, char *expected_return_str ) { char rtn_str[ STR_BUFF_SIZE ]; int result = 1; @@ -15,14 +15,14 @@ get_string( rtn_str ); print_result( result = strcmp( expected_return_str, rtn_str ) ); - if ( result && !mode ) - error( "command failed\r\n" ); +// if ( result && !mode ) +// error( "command failed\r\n" ); return ( result ); } -int try_and_check2( char *command, char *expected_return_str, int mode ) +int try_and_check2( char *command, char *expected_return_str ) { char rtn_str[ STR_BUFF_SIZE ]; int result = 1; @@ -34,8 +34,8 @@ get_string( rtn_str ); print_result( result = strcmp( expected_return_str, rtn_str ) ); - if ( result && !mode ) - error( "command failed\r\n" ); +// if ( result && !mode ) +// error( "command failed\r\n" ); return ( result ); } @@ -70,7 +70,7 @@ sprintf( command, "%d\n", checksum ); - return ( try_and_check( command, "OK", 0 ) ); + return ( try_and_check( command, "OK" ) ); } @@ -79,11 +79,11 @@ char command_str[ STR_BUFF_SIZE ]; sprintf( command_str, "P 0 %d\r\n", last_sector ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( 1 ); *(command_str) = 'E'; - return ( try_and_check( command_str, "0", 0 ) ); + return ( try_and_check( command_str, "0" ) ); }