mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Network interface and other utility functions

Network interface and other utility functions
[Platform]

Functions

int mbed_interface_connected (void)
 Functions to control the mbed interface.
int mbed_interface_reset (void)
 Instruct the mbed interface to reset, as if the reset button had been pressed.
int mbed_interface_disconnect (void)
 This will disconnect the debug aspect of the interface, so semihosting will be disabled.
int mbed_interface_powerdown (void)
 This will disconnect the debug aspect of the interface, and if the USB cable is not connected, also power down the interface.
int mbed_interface_uid (char *uid)
 This returns a string containing the 32-character UID of the mbed interface This is a weak function that can be overwritten if required.
void mbed_mac_address (char *mac)
 This returns a unique 6-byte MAC address, based on the interface UID If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
MBED_NORETURN void mbed_die (void)
 Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence.
void mbed_error_printf (const char *format,...) MBED_PRINTF(1
 Print out an error message.
void void mbed_error_vprintf (const char *format, va_list arg) MBED_PRINTF(1
 Print out an error message.
void void void mbed_error_puts (const char *str)
 Print out an error message.
 MBED_DEPRECATED_SINCE ("mbed-os-5.11","Renamed to mbed_error_vprintf to match functionality.") void mbed_error_vfprintf(const char *format

Function Documentation

MBED_DEPRECATED_SINCE ( "mbed-os-5.11"  ,
"Renamed to mbed_error_vprintf to match functionality."   
) const
MBED_NORETURN void mbed_die ( void   )

Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence.

Definition at line 25 of file mbed_board.c.

void mbed_error_printf ( const char *  format,
  ... 
)

Print out an error message.

This is typically called when handling a crash.

Note:
Synchronization level: Interrupt safe
This uses an internal 128-byte buffer to format the string, so the output may be truncated. If you need to write a potentially long string, use mbed_error_puts.
Parameters:
formatC string that contains data stream to be printed. Code snippets below show valid format.
 mbed_error_printf("Failed: %s, file: %s, line %d \n", expr, file, line);
void void void mbed_error_puts ( const char *  str )

Print out an error message.

This is typically called when handling a crash.

Unlike mbed_error_printf, there is no limit to the maximum output length. Unlike standard puts, but like standard fputs, this does not append a '
' character.

Note:
Synchronization level: Interrupt safe
Parameters:
strC string that contains data stream to be printed.

Definition at line 74 of file mbed_board.c.

void void mbed_error_vprintf ( const char *  format,
va_list  arg 
)

Print out an error message.

Similar to mbed_error_printf but uses a va_list.

Note:
Synchronization level: Interrupt safe
Parameters:
formatC string that contains data stream to be printed.
argVariable arguments list
int mbed_interface_connected ( void   )

Functions to control the mbed interface.

mbed Microcontrollers have a built-in interface to provide functionality such as drag-n-drop download, reset, serial-over-usb, and access to the mbed local file system. These functions provide means to control the interface suing semihost calls it supports. Determine whether the mbed interface is connected, based on whether debug is enabled

Returns:
1 if interface is connected, 0 otherwise

Definition at line 29 of file mbed_interface.c.

int mbed_interface_disconnect ( void   )

This will disconnect the debug aspect of the interface, so semihosting will be disabled.

The interface will still support the USB serial aspect

Returns:
0 if successful, -1 otherwise (e.g. interface not present)

Definition at line 54 of file mbed_interface.c.

int mbed_interface_powerdown ( void   )

This will disconnect the debug aspect of the interface, and if the USB cable is not connected, also power down the interface.

If the USB cable is connected, the interface will remain powered up and visible to the host

Returns:
0 if successful, -1 otherwise (e.g. interface not present)

Definition at line 68 of file mbed_interface.c.

int mbed_interface_reset ( void   )

Instruct the mbed interface to reset, as if the reset button had been pressed.

Returns:
1 if successful, 0 otherwise (e.g. interface not present)

Definition at line 34 of file mbed_interface.c.

int mbed_interface_uid ( char *  uid )

This returns a string containing the 32-character UID of the mbed interface This is a weak function that can be overwritten if required.

Parameters:
uidA 33-byte array to write the null terminated 32-byte string
Returns:
0 if successful, -1 otherwise (e.g. interface not present)

Definition at line 44 of file mbed_interface.c.

void mbed_mac_address ( char *  mac )

This returns a unique 6-byte MAC address, based on the interface UID If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)

This is a weak function that can be overwritten if you want to provide your own mechanism to provide a MAC address.

Parameters:
macA 6-byte array to write the MAC address

Definition at line 95 of file mbed_interface.c.