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.
MBED System Layer APIs. More...
Files | |
| file | mbed_i2c.h |
Serial communication functions needed by eMPL to communicate to the MPU devices. | |
| file | mbed_spi.h |
Serial communication functions needed by eMPL to communicate to the MPU devices. | |
Functions | |
| void | mbed_i2c_enable (void) |
| Set up the I2C port and configure the MBED as the master. | |
| void | mbed_i2c_disable (void) |
| Disable I2C communication. | |
| int | mbed_i2c_write (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char const *data) |
| Write to a device register. | |
| int | mbed_i2c_read (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char *data) |
| Read from a device. | |
| void | mbed_spi_init (PinName mosi, PinName miso, PinName sclk, PinName cs) |
| Set up the SPI port and configure the MBED as the master. | |
| void | mbed_spi_enable (void) |
| Enable SPI port. | |
| void | mbed_spi_disable (void) |
| Disable SPI communication. | |
| int | mbed_spi_write (unsigned char reg_addr, unsigned char length, unsigned char const *data) |
| Write to a device register. | |
| int | mbed_spi_read (unsigned char reg_addr, unsigned char length, unsigned char *data) |
| Read from a device. | |
Detailed Description
MBED System Layer APIs.
To interface with any platform, eMPL needs access to various system layer functions.
Function Documentation
| void mbed_i2c_disable | ( | void | ) |
Disable I2C communication.
This function will disable the I2C hardware and should be called prior to entering low-power mode.
- Returns:
- 0 if successful.
Definition at line 111 of file mbed_i2c.c.
| void mbed_i2c_enable | ( | void | ) |
Set up the I2C port and configure the MBED as the master.
- Returns:
- 0 if successful.
Definition at line 101 of file mbed_i2c.c.
| int mbed_i2c_read | ( | unsigned char | slave_addr, |
| unsigned char | reg_addr, | ||
| unsigned char | length, | ||
| unsigned char * | data | ||
| ) |
Read from a device.
- Parameters:
-
[in] slave_addr Slave address of device. [in] reg_addr Slave register to be read from. [in] length Number of bytes to read. [out] data Data from register.
- Returns:
- 0 if successful.
Definition at line 45 of file mbed_i2c.c.
| int mbed_i2c_write | ( | unsigned char | slave_addr, |
| unsigned char | reg_addr, | ||
| unsigned char | length, | ||
| unsigned char const * | data | ||
| ) |
Write to a device register.
- Parameters:
-
[in] slave_addr Slave address of device. [in] reg_addr Slave register to be written to. [in] length Number of bytes to write. [out] data Data to be written to register.
- Returns:
- 0 if successful.
Definition at line 28 of file mbed_i2c.c.
| void mbed_spi_disable | ( | void | ) |
Disable SPI communication.
This function will disable the SPI hardware and should be called prior to entering low-power mode.
Definition at line 88 of file mbed_spi.c.
| void mbed_spi_enable | ( | void | ) |
Enable SPI port.
Definition at line 76 of file mbed_spi.c.
| void mbed_spi_init | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk, | ||
| PinName | cs | ||
| ) |
Set up the SPI port and configure the MBED as the master.
Definition at line 23 of file mbed_spi.c.
| int mbed_spi_read | ( | unsigned char | reg_addr, |
| unsigned char | length, | ||
| unsigned char * | data | ||
| ) |
Read from a device.
- Parameters:
-
[in] reg_addr Slave register to be read from. [in] length Number of bytes to read. [out] data Data from register.
- Returns:
- 0 if successful.
Definition at line 60 of file mbed_spi.c.
| int mbed_spi_write | ( | unsigned char | reg_addr, |
| unsigned char | length, | ||
| unsigned char const * | data | ||
| ) |
Write to a device register.
- Parameters:
-
[in] reg_addr Slave register to be written to. [in] length Number of bytes to write. [out] data Data to be written to register.
- Returns:
- 0 if successful.
Definition at line 45 of file mbed_spi.c.
Generated on Thu Jul 14 2022 05:48:42 by
1.7.2