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.
Fork of TUKS-COURSE-TIMER by
Functions | |
void | spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) |
Initialize the SPI peripheral. | |
void | spi_free (spi_t *obj) |
Release a SPI object. | |
void | spi_format (spi_t *obj, int bits, int mode, int slave) |
Configure the SPI format. | |
void | spi_frequency (spi_t *obj, int hz) |
Set the SPI baud rate. |
Function Documentation
void spi_format | ( | spi_t * | obj, |
int | bits, | ||
int | mode, | ||
int | slave | ||
) |
Configure the SPI format.
Set the number of bits per frame, configure clock polarity and phase, shift order and master/slave mode. The default bit order is MSB.
- Parameters:
-
[in,out] obj The SPI object to configure [in] bits The number of bits per frame [in] mode The SPI mode (clock polarity, phase, and shift direction) [in] slave Zero for master mode or non-zero for slave mode
void spi_free | ( | spi_t * | obj ) |
Release a SPI object.
TODO: spi_free is currently unimplemented This will require reference counting at the C++ level to be safe
Return the pins owned by the SPI object to their reset state Disable the SPI peripheral Disable the SPI clock
- Parameters:
-
[in] obj The SPI object to deinitialize
void spi_frequency | ( | spi_t * | obj, |
int | hz | ||
) |
Set the SPI baud rate.
Actual frequency may differ from the desired frequency due to available dividers and bus clock Configures the SPI peripheral's baud rate
- Parameters:
-
[in,out] obj The SPI object to configure [in] hz The baud rate in Hz
void spi_init | ( | spi_t * | obj, |
PinName | mosi, | ||
PinName | miso, | ||
PinName | sclk, | ||
PinName | ssel | ||
) |
Initialize the SPI peripheral.
Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral
- Parameters:
-
[out] obj The SPI object to initialize [in] mosi The pin to use for MOSI [in] miso The pin to use for MISO [in] sclk The pin to use for SCLK [in] ssel The pin to use for SSEL
Generated on Tue Jul 12 2022 17:38:59 by
