Suger532 2024-03-21 18:37 采纳率: 50%
浏览 62
已结题

关于#stm32#的问题:.c(73): error: #165: too few arguments in function call换了两种参数方式(语言-c语言)

.c(73): error: #165: too few arguments in function call
换了两种参数方式,都失败了,有没有大 佬 看看
已解决:定义的形参未使用导致 uint8_t Myspi_R_MISO(void)

img

#include "stm32f10x.h"  


void Myspi_W_SS(uint8_t BitValue)//CS  pa4
{
  GPIO_WriteBit(GPIOA,GPIO_Pin_4, (BitAction)BitValue);
}

void Myspi_W_SCK(uint8_t BitValue)
     {
       GPIO_WriteBit(GPIOA,GPIO_Pin_5,(BitAction)BitValue);
     }
     
void Myspi_W_MOSI(uint8_t BitValue)
     {
       GPIO_WriteBit(GPIOA,GPIO_Pin_7,(BitAction)BitValue);
     }
     
     
uint8_t Myspi_R_MISO(uint8_t BitValue)
     {
      return GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_6);
     }
     
void Myspi_Init(void)
{

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
  
  GPIO_InitTypeDef GPIO_InitStructure;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_7;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOA,&GPIO_InitStructure);
    
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //input 浮空or上拉
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOA,&GPIO_InitStructure);
    
  Myspi_W_SS(1);
    Myspi_W_SCK(0);//模式0
}

void Myspi_Start(void)
{
  Myspi_W_SS(0);
}

void Myspi_Stop(void)
{
  Myspi_W_SS(1);
}

uint8_t Myspi_SwapByte(uint8_t ByteSend)//主出,从出
{
uint8_t i;//ByteReceive = 0x00;
    
//    for(i =0;i<0;i++)
//    {
//    Myspi_W_MOSI(ByteSend & (0x80>>i));//7bit  主发
//    Myspi_W_SCK(1);
//    if(Myspi_R_MISO( ) == 1){ ByteReceive |=  0x80;} //主收
//    Myspi_W_SCK(0);}
    
    //Myspi_W_MOSI(ByteSend & 0x40);//6
    
        for(i =0;i<8;i++)
    {
    Myspi_W_MOSI(ByteSend & 0x80);//7bit  主发  
  ByteSend <<=1;
    Myspi_W_SCK(1);
    if(Myspi_R_MISO() == 1){ByteSend|=0x01;} //主收 由从机位决定
    Myspi_W_SCK(0);}

    //return ByteReceive;
    return  ByteSend;
}



  • 写回答

2条回答 默认 最新

  • 码农阿豪 Java领域优质创作者 2024-03-21 18:37
    关注
    让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
    问题描述: 在文件.c的第73行出现了错误:函数调用中参数数量不足(#165: too few arguments in function call) 解决方法: 这个问题是因为函数调用的时候参数数量不够导致的错误,我们需要确定出现错误的函数名以及正确的参数数量。然后进行修改。 例如,假设出现错误的函数名为“testFunc”,正确的参数数量应该是3个,我们可以按照以下方式进行函数调用: testFunc(arg1, arg2, arg3); 如果还是无法解决问题,可能需要对函数的定义和声明进行检查,或者更换传递给函数的参数类型。 代码示例: 假设出现错误的代码段如下: int result = testFunc(arg1); // arg1为参数,缺少了2个参数 那么我们可以按照以下方式进行修改: int result = testFunc(arg1, arg2, arg3); // 增加2个参数 如果函数定义和声明如下: int testFunc(int arg1, float arg2); 但是我们的函数调用参数数量不够,应该是3个参数: int result = testFunc(arg1, arg2, arg3); // 增加一个参数 需要注意的是,当函数定义和声明的参数数量和类型不匹配时会出现编译错误,这种情况下需要修改函数定义和声明。
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 3月22日
  • 修改了问题 3月22日
  • 修改了问题 3月21日
  • 创建了问题 3月21日

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集