佚名通过本文主要向大家介绍了ldc1000,ldc1000中文资料,ay ldc1000,ldc1000循迹小车,ldc1000电路图等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: LDC1000在STM32上的问题
描述:
{
u8 status;
cs(0); //使能SPI传输
status =SPI2_ReadWriteByte(regaddr); //发送寄存器号
SPI2_ReadWriteByte(data); //写入寄存器的值
cs(1); //禁止SPI传输
return(status); //返回状态值
}
u8 spi_read_reg(u8 regaddr)
{
u8 reg_val;
cs(0); //使能SPI传输
SPI2_ReadWriteByte(regaddr); //发送寄存器号
reg_val=SPI2_ReadWriteByte(0XFF);//读取寄存器内容
cs(1); //禁止SPI传输
return(reg_val); //返回状态值
}
SPI_I2S_ReceiveData(SPI_TypeDef* SPIx)
uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
/* Return the data in the DR register */
return SPIx->DR;
}
这个SPI_I2S_ReceiveData 有什么用啊
描述:
stm32SPI
u8 spi_write_reg(u8 regaddr,u8 data){
u8 status;
cs(0); //使能SPI传输
status =SPI2_ReadWriteByte(regaddr); //发送寄存器号
SPI2_ReadWriteByte(data); //写入寄存器的值
cs(1); //禁止SPI传输
return(status); //返回状态值
}
u8 spi_read_reg(u8 regaddr)
{
u8 reg_val;
cs(0); //使能SPI传输
SPI2_ReadWriteByte(regaddr); //发送寄存器号
reg_val=SPI2_ReadWriteByte(0XFF);//读取寄存器内容
cs(1); //禁止SPI传输
return(reg_val); //返回状态值
}
SPI_I2S_ReceiveData(SPI_TypeDef* SPIx)
uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
/* Return the data in the DR register */
return SPIx->DR;
}
这个SPI_I2S_ReceiveData 有什么用啊