标题: SX1212 MCU驱动程序 SX1212API代码详解 很好的教程下载 [打印本页]

作者: sddl_hanbin    时间: 2017-3-30 18:24
标题: SX1212 MCU驱动程序 SX1212API代码详解 很好的教程下载
SX1212API代码详解:



SX1212的MCU驱动程序51黑电子论坛整理(可移植):
  1. #include "SX1231.h"

  2.             // ======== static fucntion  ======== //
  3. static void InitMCU (void);
  4. /*====================================================
  5. main

  6. =====================================================*/
  7. void main (void) {
  8.     unsigned char rc;

  9.     InitMCU();
  10.     InitSX1212();

  11.     #if 1       // to test SPI
  12.     SpiWriteCfg(REG_SYNCBYTE4, 0x55);
  13.     if(SpiReadCfg(REG_SYNCBYTE4) != 0x55) {
  14.         while(1);   // something wrong with SPI
  15.     }

  16.     SpiWriteCfg(REG_SYNCBYTE4, 0xAA);
  17.     if(SpiReadCfg(REG_SYNCBYTE4) != 0xAA) {
  18.         while(1);   // something wrong with SPI
  19.     }

  20.     SpiWriteCfg(REG_SYNCBYTE4, SYNC_WORD4);
  21.     if(SpiReadCfg(REG_SYNCBYTE4) != SYNC_WORD4) {
  22.         while(1);   // something wrong with SPI
  23.     }
  24.     #endif

  25.     //.....
  26.     BuildPacket(0x12);
  27.     SendRfFrame((unsigned char *)(&RF_Pkt), sizeof(RF_Pkt));

  28.     while(1) {
  29.         ReceiveRfFrame((unsigned char *)(&RF_Pkt), sizeof(RF_Pkt), &rc);
  30.         if(rc == OK) {
  31.             //got packet
  32.             // ...
  33.         }
  34.         //...
  35.     }
  36. }


  37. /*=====================================================
  38. InitMCU

  39. =====================================================*/
  40. static void InitMCU (void) {
  41.     // ....
  42.     /*
  43.     Initiate MCU here
  44.     including clock, IO, .....
  45.     */
  46. }

复制代码



下载:
Driver.zip (349.66 KB, 下载次数: 85)

作者: 放开那个鸡腿    时间: 2017-9-19 16:26
好贵的说
作者: chen429483364    时间: 2018-1-18 09:57
好东西,学习学习
作者: yanzi775    时间: 2018-10-22 10:17
谢谢分享!!!




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1