Rtos API example

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)
void mbed_die (void)
 Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence.
void mbed_error_printf (const char *format,...)
 Print out an error message.
void mbed_error_vfprintf (const char *format, va_list arg)
 Print out an error message.

Function Documentation

void mbed_die ( void   )

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

Definition at line 29 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
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);

Definition at line 52 of file mbed_board.c.

void mbed_error_vfprintf ( 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

Definition at line 59 of file mbed_board.c.

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 28 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 50 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 62 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 32 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 41 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 84 of file mbed_interface.c.