欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
SX1212源碼分享
[打印本頁]
作者:
wwl1985123
時間:
2017-7-20 17:20
標題:
SX1212源碼分享
#include "SX1231.h"
// ======== static fucntion ======== //
static void InitMCU (void);
/*====================================================
main
=====================================================*/
void main (void) {
unsigned char rc;
InitMCU();
InitSX1212();
#if 1 // to test SPI
SpiWriteCfg(REG_SYNCBYTE4, 0x55);
if(SpiReadCfg(REG_SYNCBYTE4) != 0x55) {
while(1); // something wrong with SPI
}
SpiWriteCfg(REG_SYNCBYTE4, 0xAA);
if(SpiReadCfg(REG_SYNCBYTE4) != 0xAA) {
while(1); // something wrong with SPI
}
SpiWriteCfg(REG_SYNCBYTE4, SYNC_WORD4);
if(SpiReadCfg(REG_SYNCBYTE4) != SYNC_WORD4) {
while(1); // something wrong with SPI
}
#endif
//.....
BuildPacket(0x12);
SendRfFrame((unsigned char *)(&RF_Pkt), sizeof(RF_Pkt));
while(1) {
ReceiveRfFrame((unsigned char *)(&RF_Pkt), sizeof(RF_Pkt), &rc);
if(rc == OK) {
//got packet
// ...
}
//...
}
}
/*=====================================================
InitMCU
=====================================================*/
static void InitMCU (void) {
// ....
/*
Initiate MCU here
including clock, IO, .....
*/
}
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1