111111111

在数字化转型、技术创新与科技自立的驱动下,企业研发正面临工具链碎片化、算力资源不足、跨地域协作效率低、安全合规压力大、创新成本高企等多重痛点。华为开发者空间依托华为30多年研发实践沉淀,整合昇腾、鸿蒙、鲲鹏、GaussDB、欧拉等根技术生态,提供 “云开发环境+全流程工具链+行业解决方案”一体化服务,已助力多个行业企业实现智研创新,实现从技术创新到商业价值的闭环落地。

今天大家都很帅很好看的哦哦啊啊

华为开发者空间是什么?
华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了昇腾、鸿蒙、鲲鹏、GaussDB、欧拉等华为根技术资源及工具,支持桌面、容器、CLI等多种方式进行云上开发;开发者空间整合云上AI开发工具链,一键开发AI Agent、部署MCP并提供配套技术案例,打造开发者智能AI应用开发平台。立足于开发者的体验提升,华为开发者空间从工具与资源的易获取性、开发效率与易用性、学习与成长支持、国产信创适配、开源框架对接、及协同编程六大维度进行深度优化,实现更多入口、更快拉起、更多权益、更好的体验。通过技术赋能与生态贡献,成为广大开发者的技术同行partner。

一、工具与资源的易获取性
华为开发者空间以全栈集成、免费赋能、多端协同为核心,构建了无壁垒的开发资源体系。

(1)在工具链集成方面:平台整合了CodeArts IDE、ModelArts Studio、AI Notebook、Astro低代码平台等核心工具,覆盖从代码编写、调试、测试到AI模型训练、部署的全流程开发场景。其中,CodeArts IDE预置鸿蒙、昇腾专属开发环境,开发者无需手动配置,即可一键拉取代码仓并开展远程调试,大幅减少环境适配成本;Astro低代码平台则以可视化拖拽能力,为业务型开发者提供快速构建应用的捷径。

(2)为降低开发门槛:平台推出了免费资源包:180小时云开发环境、100万次云函数调用、鸿蒙云手机、云数据库、MaaS Tokens、2小时免费AI Notebook等基础权益免费开放,让个人开发者与初创团队无需投入额外成本即可开展项目研发。同时,免费开放昇腾NPU算力,支持AI推理任务高效运行,例如DeepSeek-R1模型部署仅需1-2分钟即可启动,为AI开发者提供了低成本的算力支撑。

【乐知行企业案例】基于华为开发者空间的车路云监控中心:智能网联小车实时数据可视化系统实现

企业背景:乐知行是专注智能网联教学解决方案的科技企业,服务百余所高校,核心需求是解决教学场景中算力不足、POC验证效率低、品牌影响力弱等问题。核心痛点:高性能算力资源短缺、教学环境部署复杂、品牌信任度建立难。

华为开发者空间赋能实践:①基于华为开发者空间的AI Notebook与鲲鹏云开发环境,乐知行构建了“车路云监控中心”教学平台,实现智能网联小车深度学习模型的快速训练与调试;②通过华为开发者空间的云端协同能力,将车、路、云三端数据实时上传至鲲鹏云环境,学生可在本地监控远程车辆状态、交通信息,实现“车路云一体化”的实训体验;③受邀参与华为全联接大会展示,通过多车辆实操体验环节触达国内外客户,同步将案例上架华为开发者空间案例中心,获取精准教育行业流量。

点击查看:https://bbs.huaweicloud.com/blogs/464856

二、开发效率与易用性
华为开发者空间以AI原生能力为驱动,通过智能辅助、极简化配置、自动化流程,大大提升开发效率。

(1)在AI赋能方面:CodeArts Doer智能编码助手能够实现代码生成、语法纠错、单元测试自动生成等功能,使开发效率提升40%左右,让开发者从重复性工作中解放出来专注于核心逻辑创新;Astro支持拖拽式开发,业务用户可快速构建应用,如登录页开发周期从小时级缩短至分钟级,极大降低了应用开发的技术门槛。

(2)环境配置极简化:环境配置的繁琐是长期困扰开发者的痛点,华为开发者空间通过预置镜像与一键部署功能,将环境搭建速度从小时级降至秒级。平台提供鲲鹏、昇腾等多种开发镜像,开发者可根据项目需求一键创建沙箱环境;针对鸿蒙开发场景,平台提供鸿蒙云手机沙箱,支持远程调试与适配测试,配合专属迁移工具链,可降低50%的适配成本。

(3)自动化流程支持:平台深度集成DevOps能力,通过自动化流水线实现构建、测试、部署全流程自动化,减少人工干预,提升开发交付的稳定性与效率。

(4)平台支持Web、CLI、IDE多入口访问:开发者可通过本地 IDE远程连接云端环境,实现跨设备、跨场景的无缝开发体验,打破空间与设备的限制。

【毕昇企业案例】华为开发者空间部署BISHENG平台实现DeepSeek vs GLM终极AI辩论赛

企业背景:BISHENG是面向AI智能体与大模型应用的平台型企业,核心需求是降低技术门槛、快速触达开发者群体,实现AI能力的商业化落地。核心痛点:缺少技术、商业、市场和持续服务。需要稳定易用的算力底座和模型服务,触达更广泛的开发者群体,最终共同赢得企业开发者和商业变现。

华为开发者空间赋能实践:①实现低代码平台+开箱即用环境,向伙伴提供稳定、高性能的底层算力支持和大模型;②合作完成案例,依托华为开发者空间的云主机部署能力,BISHENG平台实现了 “40分钟极速构建AI辩论应用”的高效落地;③生态资源联动,借助华为开发者空间的开发者社区、HC大会等生态资源,BISHENG实现单场活动触达开发者5000+,显著提升品牌影响力与开发者覆盖度。

点击查看:https://devstation.connect.huaweicloud.com/space/devportal/casecenter/c69602069cbc41dc8c45157d619b5c47/1

三、学习与成长支持
华为开发者空间构建了“学习-实践-交流”全周期成长体系,助力开发者持续提升核心竞争力。

(1)在学习资源方面:开发者学堂汇聚了1500+门精品课程,涵盖昇腾AI、鸿蒙操作系统、云原生等前沿技术领域,课程内容从基础入门到高阶实战层层递进,配合免费认证代金券,让开发者能够零成本获取专业认证,夯实技术基础。其中AI科研系列课程聚焦模型调优、RAG技术等实战内容,为开发者提供了贴合产业需求的学习路径。

(2)在实践赋能方面:华为开发者空间以“降低实践门槛、提升验证效率”为核心,打造了覆盖多技术领域、多应用场景的700+高性能沙箱环境,为开发者提供“开箱即用、按需配置、安全隔离”的一站式实践支撑,让技术验证、项目开发与场景测试无需受限于本地硬件与环境配置,全程高效顺畅。

(3)行业案例模板:平台案例中心提供70+个行业解决方案模板,涵盖智能客服、数据看板、工业互联网等多个领域,开发者可直接复用成熟案例的核心代码与架构设计,加速项目落地进程。同时,平台通过HCSD校园沙龙、技术峰会、线上研讨会等多种形式搭建了连接高校与产业、开发者与专家的交流桥梁,促进技术经验的分享与碰撞。

(4)支持高校人才培养: 华为开发者空间深度联动教育场景,以“课程赋能+实验赋能”双轮驱动,构建“理论学习-实践操作-能力转化”的完整培养体系,将华为根技术生态与高校人才培养需求精准对接,助力高校打造兼具技术前沿性与产业适配性的人才培育模式,为青年开发者筑牢成长根基。

【南京大学案例】华为开发者空间携手南京大学,打造教学课程与新技术融合创新模式

华为开发者空间携手南京大学,基于文理交融特色探索创新模式,把开发者空间融入南大学子课程与实践环节。聚焦 AI、鸿蒙、昇腾等前沿根技术,借校企优质师资合力,让南大学子在课堂解锁多元实践场景,以跨学科实践赋能科技人才创新能力跃升。

软件学院开展《计算机操作系统》课程,将原课程基于华为开发者空间云主机的课程实践进行重构。该课程面向软件工程专业大二学生,培养其理解和应用操作系统的能力,特别是开发与操作系统交互的底层软件的能力。

点击查看: https://bbs.huaweicloud.com/blogs/454018

四、国产信创适配
在合规性方面:华为开发者空间已向开发者发放150万+台云主机,支持开发者基于鲲鹏环境进行鲲鹏应用开发,助力开发者构建安全合规、高效稳定的信创应用,满足国产化开发核心需求。

五、开源框架对接
(1)代码仓互通:平台支持从GitHub、GitCode等主流开源平台一键拉取开源项目,预置编译测试环境,开发者无需手动配置依赖,即可快速开展二次开发与技术验证,加速开源技术的落地应用。通过开源生态的深度对接,华为开发者空间构建了“开源-复用-创新-回馈”的良性循环,为开发者提供了丰富的开源资源与实践机会。

(2)开源社区激励:华为开发者空间以开源生态共建为核心,通过激励机制与资源互通,赋能开源开发者与项目成长。平台推出“沃土云创开源计划”,参与昇腾、鸿蒙等开源项目的开发者提供最高200万的激励支持,鼓励开发者贡献代码、参与项目迭代,共同完善开源生态。

【GitCode企业案例】基于华为开发者空间项目同步能力实现java电商项目部署

企业背景:GitCode是代码托管与开源生态平台,核心需求是补充云端开发能力,实现代码托管与开发环境的无缝衔接。核心痛点:本地开发环境配置复杂、云端开发工具链缺失、开发者工作流中断。

华为开发者空间赋能实践:①华为开发者空间与GitCode深度集成,实现“代码托管+云端开发”的全链路打通,开发者通过GitCode项目页面,可一键调用华为开发者空间的云开发环境,实现代码的云端编译、调试与运行,提升开发效率;②智能项目同步,通过华为开发者空间的项目同步能力,GitCode仓库可一键同步至云端主机,支持开发者直接在云端进行代码阅读、修改与调试;③依托华为开发者空间的开发者社区与流量资源,GitCode的用户活跃度得到大幅提升,同时实现开源项目的“一键云上部署”,降低开源成果的落地门槛。

点击查看:https://devstation.connect.huaweicloud.com/space/devportal/casecenter/34e2a656adfa45bda1a23254b6864506/1

六、协同编程
多角色适配:不同类型、不同场景的开发者有着差异化的需求,华为开发者空间通过多角色适配与全球化服务,提供个性化的开发体验。针对个人开发者,平台提供基础会员免费资源包,支持轻量化开发、学习实践等核心需求,满足个人项目研发与技术探索的诉求;针对企业开发者,企业会员可享受专属技术支持、定制化解决方案与销售咨询服务,适配团队协作、大型项目研发等复杂场景,助力企业提升研发效率与创新能力。

总结
华为开发者空间不仅是一站式“开发工具平台”,更是“企业级研发生态的基建伙伴”——从工具资源的无缝供给到AI赋能的效率革新,从全周期的成长支持到安全合规的坚实保障,再到开源生态的共建共享与个性化的体验适配,华为开发者空间以多维度的优化升级,重新定义了开发者服务的核心价值。

未来,华为开发者空间将持续深耕技术创新与生态共建,以更优质的服务、更丰富的资源、更便捷的体验,成为全球开发者成长路上的同行者与赋能者,共同推动技术创新与产业升级。
————————————————
版权声明:本文为优快云博主「华为云开发者联盟」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

/* * 立创开发板软硬件资料与相关扩展板软硬件资料官网全部开源 * 开发板官网:www.lckfb.com * 文档网站:wiki.lckfb.com * 技术支持常驻论坛,任何技术问题欢迎随时交流学习 * 嘉立创社区问答:https://www.jlc-bbs.com/lckfb * 关注bilibili账号:【立创开发板】,掌握我们的最新动态! * 不靠卖板赚钱,以培养中国工程师为己任 */ #include "bsp_encoder.h" #include "bsp_tb6612.h" #include "board.h" #include "PID.h" #include <ti/driverlib/driverlib.h> // 添加DriverLib头文件 // 声明外部函数(根据您的项目结构调整) #if defined(MPU6050) void Read_Quad(void); // 添加函数声明 #endif uint32_t gpio_interrup1, gpio_interrup2; int Get_Encoder_countA, Get_Encoder_countB; /******************************************************* 函数功能:外部中断模拟编码器信号 入口函数:无 返回 值:无 ***********************************************************/ void encoder_Init(void) { NVIC_ClearPendingIRQ(GPIOB_INT_IRQn); NVIC_EnableIRQ(GPIOB_INT_IRQn); } static void handle_encoder1(void); static void handle_encoder2(void); // 修复1:移除宏定义末尾的分号 #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX // 正确格式 #endif void GROUP1_IRQHandler(void) { // 获取所有编码器引脚的中断状态 uint32_t gpio_status = DL_GPIO_getEnabledInterruptStatus( ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN | ENCODER_E2A_PIN | ENCODER_E2B_PIN ); // 处理编码器1中断 if (gpio_status & (ENCODER_E1A_PIN | ENCODER_E1B_PIN)) { handle_encoder1(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN); } // 处理编码器2中断 if (gpio_status & (ENCODER_E2A_PIN | ENCODER_E2B_PIN)) { handle_encoder2(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E2A_PIN | ENCODER_E2B_PIN); } // 处理MPU6050中断 - 修复2:使用正确的条件编译 #if defined(GPIO_MPU6050_INT_IIDX) && defined(MPU6050) if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { Read_Quad(); // 确保此函数已声明 } #endif } // 编码器1处理函数 static void handle_encoder1(void) { uint32_t gpio_interrup = DL_GPIO_getEnabledInterruptStatus( ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN ); // encoderB (原始逻辑) if ((gpio_interrup & ENCODER_E1A_PIN) == ENCODER_E1A_PIN) { if (!DL_GPIO_readPins(ENCODER_PORT, ENCODER_E1B_PIN)) { Get_Encoder_countB--; } else { Get_Encoder_countB++; } } else if ((gpio_interrup & ENCODER_E1B_PIN) == ENCODER_E1B_PIN) { if (!DL_GPIO_readPins(ENCODER_PORT, ENCODER_E1A_PIN)) { Get_Encoder_countB++; } else { Get_Encoder_countB--; } } } // 编码器2处理函数 static void handle_encoder2(void) { uint32_t gpio_interrup = DL_GPIO_getEnabledInterruptStatus( ENCODER_PORT, ENCODER_E2A_PIN | ENCODER_E2B_PIN ); // encoderA (原始逻辑) if ((gpio_interrup & ENCODER_E2A_PIN) == ENCODER_E2A_PIN) { if (!DL_GPIO_readPins(ENCODER_PORT, ENCODER_E2B_PIN)) { Get_Encoder_countA--; } else { Get_Encoder_countA++; } } else if ((gpio_interrup & ENCODER_E2B_PIN) == ENCODER_E2B_PIN) { if (!DL_GPIO_readPins(ENCODER_PORT, ENCODER_E2A_PIN)) { Get_Encoder_countA++; } else { Get_Encoder_countA--; } } } [0]**** Clean-only build of configuration Debug for project 111111111 **** [1]"C:\\ti\\ccs2020\\ccs\\utils\\bin\\gmake" -k -j 16 clean -O [2]**** Build of configuration Debug for project 111111111 **** [3]"C:\\ti\\ccs2020\\ccs\\utils\\bin\\gmake" -k -j 16 all -O [4]Building file: "../empty.syscfg" [5]Invoking: SysConfig [6]"C:/ti/ccs2020/ccs/utils/sysconfig_1.24.0/sysconfig_cli.bat" --script "C:/Users/Administrator/workspace_ccstheia/111111111/empty.syscfg" -o "." -s "C:/ti/mspm0_sdk_2_05_01_00/.metadata/product.json" --compiler ticlang [7]Running script... [8]Validating... [9]info: PWM_0(/ti/driverlib/PWM): Peripheral does not retain register contents in STOP or STANDBY modes. User should take care to save and restore register configuration in application. See Retention Configuration section for more details. [10]info: TIMER_1(/ti/driverlib/TIMER): Peripheral does not retain register contents in STOP or STANDBY modes. User should take care to save and restore register configuration in application. See Retention Configuration section for more details. [11]Generating Code (empty.syscfg)... [12]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\device_linker.cmd... [13]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\device.opt... [14]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\device.cmd.genlibs... [15]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\ti_msp_dl_config.c... [16]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\ti_msp_dl_config.h... [17]Writing C:\Users\Administrator\workspace_ccstheia\111111111\Debug\Event.dot... [18]Finished building: "../empty.syscfg" [19]Building file: "C:/ti/mspm0_sdk_2_05_01_00/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c" [20]Invoking: Arm Compiler [21]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"startup_mspm0g350x_ticlang.d_raw" -MT"startup_mspm0g350x_ticlang.o" @"./device.opt" -o"startup_mspm0g350x_ticlang.o" "C:/ti/mspm0_sdk_2_05_01_00/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c" [22]Finished building: "C:/ti/mspm0_sdk_2_05_01_00/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c" [23]Building file: "../empty.c" [24]Invoking: Arm Compiler [25]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"empty.d_raw" -MT"empty.o" @"./device.opt" -o"empty.o" "../empty.c" [26]Finished building: "../empty.c" [27]Building file: "ti_msp_dl_config.c" [28]Invoking: Arm Compiler [29]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"ti_msp_dl_config.d_raw" -MT"ti_msp_dl_config.o" @"./device.opt" -o"ti_msp_dl_config.o" "ti_msp_dl_config.c" [30]Finished building: "ti_msp_dl_config.c" [31]Building file: "../BSP/MPU6050/inv_mpu.c" [32]Invoking: Arm Compiler [33]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/MPU6050/inv_mpu.d_raw" -MT"BSP/MPU6050/inv_mpu.o" @"./device.opt" -o"BSP/MPU6050/inv_mpu.o" "../BSP/MPU6050/inv_mpu.c" [34]Finished building: "../BSP/MPU6050/inv_mpu.c" [35]Building file: "../BSP/MPU6050/mspm0_i2c.c" [36]Invoking: Arm Compiler [37]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/MPU6050/mspm0_i2c.d_raw" -MT"BSP/MPU6050/mspm0_i2c.o" @"./device.opt" -o"BSP/MPU6050/mspm0_i2c.o" "../BSP/MPU6050/mspm0_i2c.c" [38]Finished building: "../BSP/MPU6050/mspm0_i2c.c" [39]Building file: "../BSP/MPU6050/mpu6050.c" [40]Invoking: Arm Compiler [41]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/MPU6050/mpu6050.d_raw" -MT"BSP/MPU6050/mpu6050.o" @"./device.opt" -o"BSP/MPU6050/mpu6050.o" "../BSP/MPU6050/mpu6050.c" [42]Finished building: "../BSP/MPU6050/mpu6050.c" [43]Building file: "../BSP/src/bsp_encoder.c" [44]Invoking: Arm Compiler [45]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/src/bsp_encoder.d_raw" -MT"BSP/src/bsp_encoder.o" @"./device.opt" -o"BSP/src/bsp_encoder.o" "../BSP/src/bsp_encoder.c" [46]Building file: "../BSP/MPU6050/inv_mpu_dmp_motion_driver.c" [47]Invoking: Arm Compiler [48]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/MPU6050/inv_mpu_dmp_motion_driver.d_raw" -MT"BSP/MPU6050/inv_mpu_dmp_motion_driver.o" @"./device.opt" -o"BSP/MPU6050/inv_mpu_dmp_motion_driver.o" "../BSP/MPU6050/inv_mpu_dmp_motion_driver.c" [49]../BSP/src/bsp_encoder.c:67:84: error: expected expression [50] 67 | if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { [51] | ^ [52]1 error generated. [53]gmake: *** [BSP/src/subdir_rules.mk:11: BSP/src/bsp_encoder.o] Error 1 [54]Finished building: "../BSP/MPU6050/inv_mpu_dmp_motion_driver.c" [55]Building file: "../BSP/src/PID.c" [56]Invoking: Arm Compiler [57]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/src/PID.d_raw" -MT"BSP/src/PID.o" @"./device.opt" -o"BSP/src/PID.o" "../BSP/src/PID.c" [58]Finished building: "../BSP/src/PID.c" [59]Building file: "../BSP/OLED/oled_software_i2c.c" [60]Invoking: Arm Compiler [61]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/OLED/oled_software_i2c.d_raw" -MT"BSP/OLED/oled_software_i2c.o" @"./device.opt" -o"BSP/OLED/oled_software_i2c.o" "../BSP/OLED/oled_software_i2c.c" [62]Finished building: "../BSP/OLED/oled_software_i2c.c" [63]Building file: "../BSP/src/XUNJI.c" [64]Invoking: Arm Compiler [65]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/src/XUNJI.d_raw" -MT"BSP/src/XUNJI.o" @"./device.opt" -o"BSP/src/XUNJI.o" "../BSP/src/XUNJI.c" [66]Finished building: "../BSP/src/XUNJI.c" [67]Building file: "../BSP/src/bsp_tb6612.c" [68]Invoking: Arm Compiler [69]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/src/bsp_tb6612.d_raw" -MT"BSP/src/bsp_tb6612.o" @"./device.opt" -o"BSP/src/bsp_tb6612.o" "../BSP/src/bsp_tb6612.c" [70]Finished building: "../BSP/src/bsp_tb6612.c" [71]Building file: "../BSP/src/timer.c" [72]Invoking: Arm Compiler [73]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"BSP/src/timer.d_raw" -MT"BSP/src/timer.o" @"./device.opt" -o"BSP/src/timer.o" "../BSP/src/timer.c" [74]Finished building: "../BSP/src/timer.c" [75]Building file: "../Board/board.c" [76]Invoking: Arm Compiler [77]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"Board/board.d_raw" -MT"Board/board.o" @"./device.opt" -o"Board/board.o" "../Board/board.c" [78]Finished building: "../Board/board.c" [79]Building file: "../MSPM0/interrupt.c" [80]Invoking: Arm Compiler [81]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"MSPM0/interrupt.d_raw" -MT"MSPM0/interrupt.o" @"./device.opt" -o"MSPM0/interrupt.o" "../MSPM0/interrupt.c" [82]Finished building: "../MSPM0/interrupt.c" [83]Building file: "../MSPM0/clock.c" [84]Invoking: Arm Compiler [85]"C:/ti/ccs2020/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -c @"device.opt" -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O0 -I"C:/Users/Administrator/workspace_ccstheia/111111111" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Board" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/MPU6050" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/OLED" -I"C:/Users/Administrator/workspace_ccstheia/111111111/MSPM0" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP" -I"C:/Users/Administrator/workspace_ccstheia/111111111/BSP/inc" -I"C:/Users/Administrator/workspace_ccstheia/111111111/Debug" -I"C:/ti/mspm0_sdk_2_05_01_00/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_05_01_00/source" -DMOTION_DRIVER_TARGET_MSPM0 -DMPU6050 -D__MSPM0G3507__ -gdwarf-3 -MMD -MP -MF"MSPM0/clock.d_raw" -MT"MSPM0/clock.o" @"./device.opt" -o"MSPM0/clock.o" "../MSPM0/clock.c" [86]Finished building: "../MSPM0/clock.c" [87]gmake: Target 'all' not remade because of errors. [88]**** Build Finished ****
08-01
<think>根据编译错误信息,问题出现在`bsp_encoder.c`文件的第67行: ```c if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { ``` 错误信息是:`expected expression`,意思是期望一个表达式。这通常是因为`GPIO_MPU6050_INT_IIDX`没有被正确定义。 在代码中,我们有以下定义: ```c #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX // 正确格式 #endif ``` 这里定义了一个宏`GPIO_MPU6050_INT_IIDX`,但它没有值。在条件判断中,我们将其与`DL_Interrupt_getPendingGroup`的返回值比较,这要求`GPIO_MPU6050_INT_IIDX`必须是一个整数(中断索引号)。 因此,我们需要给`GPIO_MPU6050_INT_IIDX`一个具体的值。这个值应该是MPU6050中断对应的中断索引号(IIDX)。这个值通常可以在设备头文件或通过SysConfig工具配置后生成的定义中找到。 ### 修复步骤: 1. **确定MPU6050中断的IIDX值**: 在SysConfig配置中,为MPU6050的中断引脚配置中断,并查看生成代码中的定义。例如,如果使用PA0作为中断引脚,那么它的中断索引号可能是`DL_INTERRUPT_INDEX0`或其他。 2. **修改宏定义**: 将`GPIO_MPU6050_INT_IIDX`定义为一个具体的值,例如: ```c #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 #endif ``` 注意:具体的索引号需要根据实际使用的GPIO引脚和中断配置来确定。 ### 修改后的代码片段: ```c // 修复1:定义宏为具体的中断索引号 #if defined(MPU6050) // 假设MPU6050的中断引脚配置在PA0,则中断索引号可能是DL_INTERRUPT_INDEX0 #define GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 #endif void GROUP1_IRQHandler(void) { // ... 编码器中断处理 ... // 处理MPU6050中断 #if defined(GPIO_MPU6050_INT_IIDX) && defined(MPU6050) if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { Read_Quad(); } #endif } ``` ### 注意事项: 1. 确保在SysConfig中正确配置了MPU6050的中断引脚,并且生成了相应的中断索引号。 2. 如果无法确定具体的中断索引号,可以查看生成的`ti_msp_dl_config.h`文件,其中会有类似这样的定义: ```c #define CONFIG_GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 ``` 然后在代码中使用这个定义。 ### 完整修复后的代码: ```c /* * 立创开发板软硬件资料与相关扩展板软硬件资料官网全部开源 * 开发板官网:www.lckfb.com * 文档网站:wiki.lckfb.com * 技术支持常驻论坛,任何技术问题欢迎随时交流学习 * 嘉立创社区问答:https://www.jlc-bbs.com/lckfb * 关注bilibili账号:【立创开发板】,掌握我们的最新动态! * 不靠卖板赚钱,以培养中国工程师为己任 */ #include "bsp_encoder.h" #include "bsp_tb6612.h" #include "board.h" #include "PID.h" #include <ti/driverlib/driverlib.h> // 添加DriverLib头文件 // 声明外部函数(根据您的项目结构调整) #if defined(MPU6050) void Read_Quad(void); // 添加函数声明 #endif uint32_t gpio_interrup1, gpio_interrup2; int Get_Encoder_countA, Get_Encoder_countB; /******************************************************* 函数功能:外部中断模拟编码器信号 入口函数:无 返回 值:无 ***********************************************************/ void encoder_Init(void) { NVIC_ClearPendingIRQ(GPIOB_INT_IRQn); NVIC_EnableIRQ(GPIOB_INT_IRQn); } static void handle_encoder1(void); static void handle_encoder2(void); // 修复1:定义宏为具体的中断索引号(根据实际配置修改) #if defined(MPU6050) // 这里需要根据实际配置填写正确的中断索引号,例如DL_INTERRUPT_INDEX0 #define GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 #endif void GROUP1_IRQHandler(void) { // 获取所有编码器引脚的中断状态 uint32_t gpio_status = DL_GPIO_getEnabledInterruptStatus( ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN | ENCODER_E2A_PIN | ENCODER_E2B_PIN ); // 处理编码器1中断 if (gpio_status & (ENCODER_E1A_PIN | ENCODER_E1B_PIN)) { handle_encoder1(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN); } // 处理编码器2中断 if (gpio_status & (ENCODER_E2A_PIN | ENCODER_E2B_PIN)) { handle_encoder2(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E2A_PIN | ENCODER_E2B_PIN); } // 处理MPU6050中断 - 修复2:使用正确的条件编译 #if defined(GPIO_MPU6050_INT_IIDX) && defined(MPU6050) if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { Read_Quad(); // 确保此函数已声明 } #endif } // ... 以下handle_encoder1和handle_encoder2函数保持不变 ... ``` ### 验证: 重新编译项目,确保错误消失。 ### 补充: 如果仍然不确定中断索引号,可以暂时注释掉MPU6050中断处理部分,先确保编码器功能正常。待确定中断索引号后再添加。 §§相关问题§§ 1.在MSPM0中如何正确配置GPIO中断的索引号(IIDX)? 2.如何通过SysConfig工具为外设(如MPU6050)配置中断引脚? 3.在共享中断向量的系统中,如何区分不同GPIO引脚触发的中断? 4.如果中断索引号配置错误,会导致哪些运行时问题? 5.在DriverLib中,DL_Interrupt_getPendingGroup函数返回值的具体含义是什么?</think>### 问题分析与修复 根据编译错误信息,问题出现在`bsp_encoder.c`文件的第67行: ```c if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { ``` 错误信息是:`expected expression`,意思是期望一个表达式。这通常是因为`GPIO_MPU6050_INT_IIDX`没有被正确定义。 在代码中,我们有以下定义: ```c #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX // 正确格式 #endif ``` 这里定义了一个宏`GPIO_MPU6050_INT_IIDX`,但它没有值。在条件判断中,我们将其与`DL_Interrupt_getPendingGroup`的返回值比较,这要求`GPIO_MPU6050_INT_IIDX`必须是一个整数(中断索引号)。 ### 完整修复方案 ```c /* * 立创开发板软硬件资料与相关扩展板软硬件资料官网全部开源 * 开发板官网:www.lckfb.com * 文档网站:wiki.lckfb.com * 技术支持常驻论坛,任何技术问题欢迎随时交流学习 * 嘉立创社区问答:https://www.jlc-bbs.com/lckfb * 关注bilibili账号:【立创开发板】,掌握我们的最新动态! * 不靠卖板赚钱,以培养中国工程师为己任 */ #include "bsp_encoder.h" #include "bsp_tb6612.h" #include "board.h" #include "PID.h" #include <ti/driverlib/driverlib.h> // 添加DriverLib头文件 // 声明外部函数(根据您的项目结构调整) #if defined(MPU6050) void Read_Quad(void); // 添加函数声明 #endif uint32_t gpio_interrup1, gpio_interrup2; int Get_Encoder_countA, Get_Encoder_countB; /******************************************************* 函数功能:外部中断模拟编码器信号 入口函数:无 返回 值:无 ***********************************************************/ void encoder_Init(void) { NVIC_ClearPendingIRQ(GPIOB_INT_IRQn); NVIC_EnableIRQ(GPIOB_INT_IRQn); } static void handle_encoder1(void); static void handle_encoder2(void); // 关键修复:定义具体的中断索引号 #if defined(MPU6050) // 根据实际硬件连接确定中断索引号 // 例如:如果MPU6050连接在PA0引脚,则使用DL_INTERRUPT_INDEX0 #define GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 #endif void GROUP1_IRQHandler(void) { // 获取所有编码器引脚的中断状态 uint32_t gpio_status = DL_GPIO_getEnabledInterruptStatus( ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN | ENCODER_E2A_PIN | ENCODER_E2B_PIN ); // 处理编码器1中断 if (gpio_status & (ENCODER_E1A_PIN | ENCODER_E1B_PIN)) { handle_encoder1(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E1A_PIN | ENCODER_E1B_PIN); } // 处理编码器2中断 if (gpio_status & (ENCODER_E2A_PIN | ENCODER_E2B_PIN)) { handle_encoder2(); DL_GPIO_clearInterruptStatus(ENCODER_PORT, ENCODER_E2A_PIN | ENCODER_E2B_PIN); } // 处理MPU6050中断 - 修复2:使用正确的条件编译 #if defined(GPIO_MPU6050_INT_IIDX) && defined(MPU6050) if (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) == GPIO_MPU6050_INT_IIDX) { Read_Quad(); // 确保此函数已声明 } #endif } // ... 以下handle_encoder1和handle_encoder2函数保持不变 ... ``` ### 关键修复点: 1. **中断索引号定义**: ```c #if defined(MPU6050) // 根据实际硬件连接确定中断索引号 #define GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX0 #endif ``` - `DL_INTERRUPT_INDEX0` 是示例值,需根据实际硬件连接确定 - 中断索引号范围:`DL_INTERRUPT_INDEX0` 到 `DL_INTERRUPT_INDEX15` 2. **确定正确的中断索引号**: - 查看芯片手册或SysConfig配置,确定MPU6050中断引脚对应的中断索引号 - 例如: - PA0 -> DL_INTERRUPT_INDEX0 - PA1 -> DL_INTERRUPT_INDEX1 - PB0 -> DL_INTERRUPT_INDEX8 3. **SysConfig配置建议**: 在SysConfig中配置MPU6050中断引脚时: ```c // 在SysConfig生成的代码中查找类似定义 #define CONFIG_GPIO_MPU6050_INT_IIDX DL_INTERRUPT_INDEX2 ``` 然后在代码中使用此定义: ```c #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX CONFIG_GPIO_MPU6050_INT_IIDX #endif ``` ### 验证步骤: 1. 替换修复后的代码 2. 确认SysConfig中MPU6050中断引脚的配置 3. 重新编译项目: ```bash **** Build Finished **** ``` 4. 使用调试器验证中断功能: - 触发编码器中断,验证计数是否正确 - 触发MPU6050中断,验证数据读取是否正常 ### 补充建议: 如果暂时不需要MPU6050功能,可以完全禁用相关代码: ```c // 注释掉MPU6050相关代码 /* #if defined(MPU6050) #define GPIO_MPU6050_INT_IIDX ... #endif ... #if defined(GPIO_MPU6050_INT_IIDX) && defined(MPU6050) if (...) { Read_Quad(); } #endif */ ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ttlasdd

感谢感谢您!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值