Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: RN52.cpp
- Revision:
- 14:3f4098e94c29
- Parent:
- 13:968af0520530
- Child:
- 15:82c3cc87bd02
diff -r 968af0520530 -r 3f4098e94c29 RN52.cpp --- a/RN52.cpp Sat Jan 30 21:03:52 2016 +0000 +++ b/RN52.cpp Sun Jan 31 20:58:42 2016 +0000 @@ -21,7 +21,7 @@ DigitalIn event_pin(p20); DigitalOut enable_pin(p5); Timer responsetime; -char dummy_response[255]; +char temp_response[255]; void RN52::init(){ @@ -31,9 +31,8 @@ //make sure event pin is pulled low if(event_pin == 0) { - char response[10]; serial.printf(GETSTATUS); - capture_response(response); + capture_response(temp_response); } } @@ -43,6 +42,8 @@ void RN52::disable(){ enable_pin = 0; + serial.printf(REBOOT); + capture_response(temp_response); } bool RN52::check_event(RN52_RESULT * result){ @@ -65,32 +66,32 @@ bool RN52::connect(){ serial.printf(CONNECT); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::disconnect(){ serial.printf(DISCONNECT); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::next_track(){ serial.printf(NEXTTRACK); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::prev_track(){ serial.printf(PREVTRACK); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::toggle_play(){ serial.printf(PLAYPAUSE); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::maxvolume(){ serial.printf(MAXVOLUME); - return capture_response(dummy_response); + return capture_response(temp_response); } bool RN52::get_status(RN52_RESULT * result){ @@ -123,10 +124,9 @@ bool RN52::get_track_metadata(RN52_RESULT * result){ -/* serial.printf(TRACK_METADATA); if(capture_response(result->response)) {//AOK - while(result->response[4] != '(') { //time(ms) - always the last one + while(result->response[3] != 'e') { //time(ms) - always the last one capture_response(result->response); switch (result->response[3]) { case 'l': //Title @@ -154,7 +154,7 @@ } } break; - case 'e': + case 'e': //time(ms) - always the last one { char duration_string[10]; copy_response(result->response, duration_string, 9); @@ -165,7 +165,6 @@ } clear_serial(); } - */ return 1; }