2668|0

2606

帖子

0

TA的资源

五彩晶圆(初级)

楼主
 

这个typedef 怎么用 [复制链接]

/*-----------------------------------------------------------------------------
Define the structure of the Capture Driver Object
------------------------------------------------------------------------------*/
typedef struct { Uint16 CmtnTrigHall;    // Output: Commutation trigger for Mod6cnt input (0 or 0x7FFF)
                 Uint16 CapCounter;      // Variable: Running count of detected edges on ECAP1,2,3
                 Uint16 DebounceCount;   // Variable: Counter/debounce delay current value
                 Uint16 DebounceAmount;  // Parameter: Counter delay amount to validate/debounce GPIO readings
                 Uint16 HallGpio;        // Variable: Most recent logic level on ECAP/GPIO
                 Uint16 HallGpioBuffer;  // Variable: Buffer of last logic level on ECAP/GPIO while being debounced
                 Uint16 HallGpioAccepted; // Variable: Debounced logic level on ECAP/GPIO
                 Uint16 EdgeDebounced;   // Variable: Trigger from Debounce function to Hall_Drv, if = 0x7FFF edge is debounced
                 Uint16 HallMap[6];      // Variable: ECAP/GPIO logic levels for HallMapPointer = 0-5
                 Uint16 CapFlag;          // Variable: ECAP flags, indicating which ECAP detected the edge
                 Uint16 StallCount;       // Variable: If motor stalls, this counter overflow triggers
                                          //           commutation to start rotation. Rotation is defined as
                                          //           an edge detection of a hall signal.
                 Uint16 HallMapPointer;   // Input/Output (see note below): During hall map creation, this variable points to the
                                          //            current commutation state.  After map creation, it
                                          //            points to the next commutation state.
                 int16 Revolutions;       // Parameter: Running counter, with a revolution defined as 1-cycle
                                          //            of the 6 hall states
                 void (*init)();          // Pointer to the init function
                 void (*read)();          // Pointer to the read function
               } HALL3;

/* Note:
- When HallMapPointer is as an input, it is defined by MOD6_CNT.
- When HallMapPointer is as an output, during hall map creation,
  this variable points to the current commutation state. 
  After map creation, it points to the next commutation state.
*/
/*-----------------------------------------------------------------------------
Define a handle for the HALL3 object
------------------------------------------------------------------------------*/
typedef HALL3 *HALL3_handle;                                               

 这里我感觉应该是 typedef HALL3*  HALL3_handle;   这可是TI的原代码

/*------------------------------------------------------------------------------
Default Initializer for the F280X HALL3 Object
------------------------------------------------------------------------------*/
#define F280XHALL3      { 0,  \
                          0,  \
                          0,  \
                         10,  \
                          0,  \
                          0,  \
                          0,  \
                          0,  \
              {0,0,0,0,0,0},  \
                          0,  \
                     0xFFFF,  \
                          0,  \
                        -10,  \
         (void (*)(Uint32))F280X_HALL3_Init,  \
                        (void (*)(Uint32))F280X_HALL3_Read  \
                         }

/*------------------------------------------------------------------------------
Target Independent Default Initializer HALL3 Object
------------------------------------------------------------------------------*/
#define HALL3_DEFAULTS F280XHALL3

/*------------------------------------------------------------------------------
Prototypes for the functions in F280XHALL3.C
------------------------------------------------------------------------------*/
void F280X_HALL3_Init(HALL3_handle);
void F280X_HALL3_Read(HALL3_handle);                                            
void F280X_HALL3_Determine_State(HALL3_handle);
void F280X_HALL3_Debounce(HALL3_handle);
void F280X_HALL3_Next_State_Ptr(HALL3_handle);
void F280X_HALL3_Create_Map(HALL3_handle);

#endif // __F280X_HALL3_H__

 
点赞 关注
个人签名工程 = 数学+物理+经济

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表