STM8 SPI主机

来源:互联网 发布:origin软件怎么截图 编辑:程序博客网 时间:2024/05/15 05:59

硬件平台:stm8s103
编译环境:IAR for stm8

//spi初始化void spiMasterIint(void){    SPI->CR1 = 0x2c;        SPI->CR2 = 0x03;    SPI->CRCPR = 0x07;    SPI->CR1 |= 0x40;}spi接收发送unsigned char spiRW(unsignde char date){    while(!(SPI->SR&0x02));    SPI->DR = data;    while(!(SPI->SR&0x01));    return SPI->DR;}
0 0