Mbed OS Reference
|
Functions | |
int | spi_master_write (spi_t *obj, int value) |
Write a byte out in master mode and receive a value. More... | |
int | spi_master_block_write (spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill) |
Write a block out in master mode and receive a value. More... | |
int | spi_slave_receive (spi_t *obj) |
Check if a value is available to read. More... | |
int | spi_slave_read (spi_t *obj) |
Get a received value out of the SPI receive buffer in slave mode. More... | |
void | spi_slave_write (spi_t *obj, int value) |
Write a value to the SPI peripheral in slave mode. More... | |
int | spi_busy (spi_t *obj) |
Checks if the specified SPI peripheral is in use. More... | |
uint8_t | spi_get_module (spi_t *obj) |
Get the module number. More... | |
const PinMap * | spi_master_mosi_pinmap (void) |
Get the pins that support SPI MOSI. More... | |
const PinMap * | spi_master_miso_pinmap (void) |
Get the pins that support SPI MISO. More... | |
const PinMap * | spi_master_clk_pinmap (void) |
Get the pins that support SPI CLK. More... | |
const PinMap * | spi_master_cs_pinmap (void) |
Get the pins that support SPI CS. More... | |
const PinMap * | spi_slave_mosi_pinmap (void) |
Get the pins that support SPI MOSI. More... | |
const PinMap * | spi_slave_miso_pinmap (void) |
Get the pins that support SPI MISO. More... | |
const PinMap * | spi_slave_clk_pinmap (void) |
Get the pins that support SPI CLK. More... | |
const PinMap * | spi_slave_cs_pinmap (void) |
Get the pins that support SPI CS. More... | |
int spi_master_write | ( | spi_t * | obj, |
int | value | ||
) |
Write a byte out in master mode and receive a value.
[in] | obj | The SPI peripheral to use for sending |
[in] | value | The value to send |
int spi_master_block_write | ( | spi_t * | obj, |
const char * | tx_buffer, | ||
int | tx_length, | ||
char * | rx_buffer, | ||
int | rx_length, | ||
char | write_fill | ||
) |
Write a block out in master mode and receive a value.
The total number of bytes sent and received will be the maximum of tx_length and rx_length. The bytes written will be padded with the value 0xff.
Note: Even if the word size / bits per frame is not 8, rx_length
and tx_length
still give lengths in bytes of input data, not numbers of words.
[in] | obj | The SPI peripheral to use for sending |
[in] | tx_buffer | Pointer to the byte-array of data to write to the device |
[in] | tx_length | Number of bytes to write, may be zero |
[in] | rx_buffer | Pointer to the byte-array of data to read from the device |
[in] | rx_length | Number of bytes to read, may be zero |
[in] | write_fill | Default data transmitted while performing a read |
int spi_slave_receive | ( | spi_t * | obj | ) |
Check if a value is available to read.
[in] | obj | The SPI peripheral to check |
int spi_slave_read | ( | spi_t * | obj | ) |
Get a received value out of the SPI receive buffer in slave mode.
Blocks until a value is available
[in] | obj | The SPI peripheral to read |
void spi_slave_write | ( | spi_t * | obj, |
int | value | ||
) |
Write a value to the SPI peripheral in slave mode.
Blocks until the SPI peripheral can be written to
[in] | obj | The SPI peripheral to write |
[in] | value | The value to write |
int spi_busy | ( | spi_t * | obj | ) |
Checks if the specified SPI peripheral is in use.
[in] | obj | The SPI peripheral to check |
uint8_t spi_get_module | ( | spi_t * | obj | ) |
Get the module number.
[in] | obj | The SPI peripheral to check |
const PinMap * spi_master_mosi_pinmap | ( | void | ) |
const PinMap * spi_master_miso_pinmap | ( | void | ) |
const PinMap * spi_master_clk_pinmap | ( | void | ) |
const PinMap * spi_master_cs_pinmap | ( | void | ) |
const PinMap * spi_slave_mosi_pinmap | ( | void | ) |
const PinMap * spi_slave_miso_pinmap | ( | void | ) |
const PinMap * spi_slave_clk_pinmap | ( | void | ) |