Chinaunix首页 | 论坛 | 博客
  • 博客访问: 565169
  • 博文数量: 127
  • 博客积分: 1169
  • 博客等级: 少尉
  • 技术积分: 1298
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-16 14:29
个人简介

空白

文章分类

全部博文(127)

分类: 嵌入式

2017-02-27 14:21:50

stvd 4.3.9编译stm8s工程报如下错误:
Compiling sx1276.c...
cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include"  -clDebug\ -coDebug\ sx1276.c
#error cpstm8 sx1276.c:70(35) missing prototype
#error cpstm8 sx1276.c:276(53) missing prototype
sx1276.c:
 The command: "cxstm8 +modsl +debug -pxp -no +split -pp -l -istm8s_stdperiph_driver\inc -i"C:\Program Files (x86)\COSMIC\CXSTM8\Hstm8" -i"C:\Program Files (x86)\STMicroelectronics\st_toolset\include"  -clDebug\ -coDebug\ sx1276.c" has failed, the returned value is: 1
exit code=1.

问题原因:
sx1276.c:70行调用函数:Value = lpTypefunc.lpByteReadfunc(); lpByteReadfunc()函数没有形参,需要加上void。

点击(此处)折叠或打开

  1. typedef struct {
  2.     
  3.    void (*lpByteWritefunc)(unsigned char src);
  4.    unsigned char (*lpByteReadfunc)();
  5.    void (*lpSwitchEnStatus)(cmdEntype_t cmd);
  6.    void (*paSwitchCmdfunc)(cmdpaType_t cmd);
  7.    void (*lpRecvDataTousr)(unsigned char *lpbuf,unsigned short length);
  8.    
  9. } lpCtrlTypefunc_t;
修改为:
  1. typedef struct {
  2.     
  3.    void (*lpByteWritefunc)(unsigned char src);
  4.    unsigned char (*lpByteReadfunc)(void);           /* 加上void */
  5.    void (*lpSwitchEnStatus)(cmdEntype_t cmd);
  6.    void (*paSwitchCmdfunc)(cmdpaType_t cmd);
  7.    void (*lpRecvDataTousr)(unsigned char *lpbuf,unsigned short length);
  8.    
  9. } lpCtrlTypefunc_t;

  1. unsigned char RF_SPI_READ_BYTE()
  2. {    
  3.    unsigned char j;
  4.    unsigned char i;
  5.    j=0;
  6.    for (i = 0; i < 8; i++){    
  7.      RF_CKL_H;
  8.      j = (j << 1);                         // shift 1 place to the left or shift in 0 //
  9.      if( SX1278_SDO )                             // check to see if bit is high //
  10.        j = j | 0x01;                      // if high, make bit high //
  11.                                                  // toggle clock high //
  12.      RF_CKL_L;                              // toggle clock low //
  13.    }
  14.   
  15.    return j;                                // toggle clock low //
  16. }
修改为:
  1. unsigned char RF_SPI_READ_BYTE(void)         /* 加上void */
  2. {    
  3.    unsigned char j;
  4.    unsigned char i;
  5.    j=0;
  6.    for (i = 0; i < 8; i++){    
  7.      RF_CKL_H;
  8.      j = (j << 1);                         // shift 1 place to the left or shift in 0 //
  9.      if( SX1278_SDO )                             // check to see if bit is high //
  10.        j = j | 0x01;                      // if high, make bit high //
  11.                                                  // toggle clock high //
  12.      RF_CKL_L;                              // toggle clock low //
  13.    }
  14.   
  15.    return j;                                // toggle clock low //
  16. }





阅读(4350) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~