📄 hal_spi.h
字号:
/** @file
* Interface functions for the SPI bus
*
* @author Ole Saether
* @defgroup nordic_spi SPI HAL
* @{
* @ingroup nordic_hal
* Interface functions for the SPI bus
*/
#ifndef HAL_SPI_H__
#define HAL_SPI_H__
#include <stdint.h>
/** Available SPI clock divide factors
* The input argument of hal_spi_master_init must be defined in this @c enum
*/
typedef enum
{
SPI_CLK_DIV2, ///< CPU clock/2
SPI_CLK_DIV4, ///< CPU clock/4
SPI_CLK_DIV8, ///< CPU clock/8
SPI_CLK_DIV16, ///< CPU clock/16
SPI_CLK_DIV32, ///< CPU clock/32
SPI_CLK_DIV64, ///< CPU clock/64
SPI_CLK_DIV128 ///< CPU clock/128
} hal_spi_clkdivider_t;
/** Function to initialize and enable the SPI master.
*/
void hal_spi_master_init(hal_spi_clkdivider_t ck);
/** Function to read/write a byte on the SPI master
* This function writes the byte to the SPI master, then enters an infinite
* loop waiting for the operation to finish. When the operation is finished
* the SPI master interrupt bit is cleared and the received byte is returned.
* @param b byte to write
* @return The read byte
*/
uint8_t hal_spi_master_read_write(uint8_t b);
#endif // HAL_SPI_H__
/** @} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -