LDC1000在STM32上的问题

道亦无名
博客专家认证
2014-08-10 02:38:55
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 有什么用啊
...全文
1330 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
losser_world 2016-07-22
  • 打赏
  • 举报
回复
最后一页怎么看啊
  • 打赏
  • 举报
回复
引用 3 楼 u011046042 的回复:
还没有解决啊 用stm32f10
写的很清楚了啊,用来DR寄存器用来接收数据或者发送数据,这个地方是用来接收数据啊
L1008644 2014-08-11
  • 打赏
  • 举报
回复
我也在弄 楼主你解决了吗?
道亦无名 2014-08-11
  • 打赏
  • 举报
回复
还没有解决啊 用stm32f10
  • 打赏
  • 举报
回复
不知道楼主用的STM32的哪个系列,如果是F1系列,可以参考下面: Data received or to be transmitted. The data register is split into 2 buffers - one for writing (Transmit Buffer) and another one for reading (Receive buffer). A write to the data register will write into the Tx buffer and a read from the data register will return the value held in the Rx buffer.

21,597

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧