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.
Dependencies: EthernetInterface FATFileSystem GR-PEACH_video GraphicsFramework HttpServer_snapshot R_BSP mbed-rpc mbed-rtos mbed
Diff: main.cpp
- Revision:
- 10:3a176dc33f74
- Parent:
- 9:2e3ccd27b4f9
- Child:
- 11:ad8ff26679bb
--- a/main.cpp Tue Dec 15 08:13:55 2015 +0000 +++ b/main.cpp Wed Jan 27 09:05:19 2016 +0000 @@ -312,11 +312,27 @@ } static void SetI2CfromWeb(Arguments* arg, Reply* r) { - if (*(arg->argv[0]) != 0) { - sprintf(i2c_setting_str_buf, "%s,%s", arg->argv[0], arg->argv[1]); + int result = 0; + + if (arg != NULL) { + if (arg->argc >= 2) { + if ((arg->argv[0] != NULL) && (arg->argv[1] != NULL)) { + sprintf(i2c_setting_str_buf, "%s,%s", arg->argv[0], arg->argv[1]); + result = 1; + } + } else if (arg->argc == 1) { + if (arg->argv[0] != NULL) { + sprintf(i2c_setting_str_buf, "%s", arg->argv[0]); + result = 1; + } + } else { + /* Do nothing */ + } /* command analysis and execute */ - if (i2c_setting_exe(i2c_setting_str_buf) != false) { - r->putData<const char*>(i2c_setting_str_buf); + if (result != 0) { + if (i2c_setting_exe(i2c_setting_str_buf) != false) { + r->putData<const char*>(i2c_setting_str_buf); + } } } }