# FOC教程 **Repository Path**: xhycode/foc-tutorial ## Basic Information - **Project Name**: FOC教程 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 244 - **Created**: 2022-05-20 - **Last Updated**: 2023-08-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 环境: 使用HAL库编程, Documents:文档 FOC-407-Demo:自制电路板V1.0.0 双路无刷驱动代码 ODrive:ODrive硬件平台,单路驱动代码 芯片资源使用: PWM: 使用中央对其模式2,先向上计数再向下计数,只在向上计数时产生溢出中断。 使用PWM模式1,向上计数 CNTstate = LEDState_ON; gLED->SetLEDLeave(gLED->onLeave); } 然后我们再去实现这个引脚控制函数 void SetLedLeave(uint8_t leave) { HAL_GPIO_WritePin(SYS_LED_GPIO_Port, SYS_LED_Pin, leave); } 最后通过接口把这个SetLedLeave函数地址传给结构体 LED_EXPORT(gSysLed,1,SetLedLeave); #define LED_EXPORT(x,xOnLeave,xSetLEDLeave) \ LEDControl_Struct x = { \ .state = LEDState_OFF, \ .onoff = 0, \ .cycle = 0.0, \ .onLeave = xOnLeave, \ .startTime = 0, \ .SetLEDLeave = xSetLEDLeave, \ };