|
Contiki 3.x
|
Files | |
| file | board-spi.c |
| Board-specific SPI driver common to the Sensortag and LaunchPad. | |
| file | board-spi.h |
| Header file for the Sensortag/LaunchPad SPI Driver. | |
Functions | |
| bool | board_spi_write (const uint8_t *buf, size_t length) |
| Write to an SPI device. More... | |
| bool | board_spi_read (uint8_t *buf, size_t length) |
| Read from an SPI device. More... | |
| void | board_spi_flush (void) |
| Clear data from the SPI interface. More... | |
| void | board_spi_open (uint32_t bit_rate, uint32_t clk_pin) |
| Initialize the SPI interface. More... | |
| void | board_spi_close (void) |
| Close the SPI interface. More... | |
| void board_spi_close | ( | void | ) |
Close the SPI interface.
This function will stop clocks to the SSI module and will set MISO, MOSI and CLK to a low leakage state. It is recommended to call this function after a chain of calls to board_spi_read() and board_spi_write()
Definition at line 145 of file board-spi.c.
References BOARD_IOID_SPI_MOSI.
Referenced by ext_flash_close().
| void board_spi_flush | ( | void | ) |
Clear data from the SPI interface.
Definition at line 105 of file board-spi.c.
References SSI0_BASE.
Referenced by wait_ready().
| void board_spi_open | ( | uint32_t | bit_rate, |
| uint32_t | clk_pin | ||
| ) |
Initialize the SPI interface.
| bit_rate | The bit rate to use |
| clk_pin | The IOID for the clock pin. This can be IOID_0 etc |
This function will make sure the peripheral is powered, clocked and initialised. A chain of calls to board_spi_read(), board_spi_write() and board_spi_flush() must be preceded by a call to this function. It is recommended to call board_spi_close() after such chain of calls.
Definition at line 116 of file board-spi.c.
References BOARD_IOID_SPI_MOSI, and SSI0_BASE.
Referenced by ext_flash_open().
| bool board_spi_read | ( | uint8_t * | buf, |
| size_t | length | ||
| ) |
Read from an SPI device.
| buf | The buffer to store data |
| length | The number of bytes to read |
Calls to this function must be preceded by a call to board_spi_open(). It is recommended to call board_spi_close() at the end of an operation.
Definition at line 83 of file board-spi.c.
References SSI0_BASE.
Referenced by ext_flash_read(), verify_part(), and wait_ready().
| bool board_spi_write | ( | const uint8_t * | buf, |
| size_t | length | ||
| ) |
Write to an SPI device.
| buf | The buffer with the data to write |
| length | The number of bytes to write |
Calls to this function must be preceded by a call to board_spi_open(). It is recommended to call board_spi_close() at the end of an operation.
Definition at line 64 of file board-spi.c.
References SSI0_BASE.
Referenced by ext_flash_erase(), ext_flash_read(), ext_flash_write(), power_down(), power_standby(), verify_part(), wait_ready(), and write_enable().
1.8.6