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.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: platform/mbed_interface.c
- Revision:
- 187:0387e8f68319
- Parent:
- 184:08ed48f1de7f
- Child:
- 189:f392fc9709a3
diff -r 707f6e361f3e -r 0387e8f68319 platform/mbed_interface.c
--- a/platform/mbed_interface.c Fri Jun 22 16:45:37 2018 +0100
+++ b/platform/mbed_interface.c Thu Sep 06 13:40:20 2018 +0100
@@ -25,11 +25,13 @@
#if DEVICE_SEMIHOST
// return true if a debugger is attached, indicating mbed interface is connected
-int mbed_interface_connected(void) {
+int mbed_interface_connected(void)
+{
return semihost_connected();
}
-int mbed_interface_reset(void) {
+int mbed_interface_reset(void)
+{
if (mbed_interface_connected()) {
semihost_reset();
return 0;
@@ -38,7 +40,8 @@
}
}
-WEAK int mbed_interface_uid(char *uid) {
+WEAK int mbed_interface_uid(char *uid)
+{
if (mbed_interface_connected()) {
return semihost_uid(uid); // Returns 0 if successful, -1 on failure
} else {
@@ -47,11 +50,13 @@
}
}
-int mbed_interface_disconnect(void) {
+int mbed_interface_disconnect(void)
+{
int res;
if (mbed_interface_connected()) {
- if ((res = semihost_disabledebug()) != 0)
+ if ((res = semihost_disabledebug()) != 0) {
return res;
+ }
while (mbed_interface_connected());
return 0;
} else {
@@ -59,11 +64,13 @@
}
}
-int mbed_interface_powerdown(void) {
+int mbed_interface_powerdown(void)
+{
int res;
if (mbed_interface_connected()) {
- if ((res = semihost_powerdown()) != 0)
+ if ((res = semihost_powerdown()) != 0) {
return res;
+ }
while (mbed_interface_connected());
return 0;
} else {
@@ -72,17 +79,20 @@
}
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This function shouldn't be used in new code."
- "For system reset funcionality use system_reset()")
-void mbed_reset(void) {
+ "For system reset funcionality use system_reset()")
+void mbed_reset(void)
+{
mbed_interface_reset();
}
-WEAK int mbed_uid(char *uid) {
+WEAK int mbed_uid(char *uid)
+{
return mbed_interface_uid(uid);
}
#endif
-WEAK void mbed_mac_address(char *mac) {
+WEAK void mbed_mac_address(char *mac)
+{
#if DEVICE_SEMIHOST
char uid[DEVICE_ID_LENGTH + 1];
int i;
@@ -93,7 +103,7 @@
#if defined(DEVICE_MAC_OFFSET)
p += DEVICE_MAC_OFFSET;
#endif
- for (i=0; i<6; i++) {
+ for (i = 0; i < 6; i++) {
int byte;
sscanf(p, "%2x", &byte);
mac[i] = byte;


