stvd+stm8s: #error cpstm8 sx1276.c:70(35) missing prototype

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. }





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值